Move some macros around
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
5364c8ac9b
commit
8c71f3fcbe
|
@ -4,7 +4,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <xcb/render.h> // for xcb_render_fixed_t, XXX
|
#include <xcb/render.h> // for xcb_render_fixed_t, XXX
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "backend/gl/gl_common.h"
|
#include "backend/gl/gl_common.h"
|
||||||
|
|
||||||
#define P_PAINTREG_START(var) \
|
#define P_PAINTREG_START(reg_tgt, var) \
|
||||||
do { \
|
do { \
|
||||||
region_t reg_new; \
|
region_t reg_new; \
|
||||||
int nrects; \
|
int nrects; \
|
||||||
|
@ -244,7 +244,7 @@ bool gl_compose(const gl_texture_t *ptex, int x, int y, int dx, int dy, int widt
|
||||||
}
|
}
|
||||||
|
|
||||||
// Painting
|
// Painting
|
||||||
P_PAINTREG_START(crect) {
|
P_PAINTREG_START(reg_tgt, crect) {
|
||||||
// Calculate texture coordinates
|
// Calculate texture coordinates
|
||||||
GLfloat texture_x1 = (double)(crect.x1 - dx + x);
|
GLfloat texture_x1 = (double)(crect.x1 - dx + x);
|
||||||
GLfloat texture_y1 = (double)(crect.y1 - dy + y);
|
GLfloat texture_y1 = (double)(crect.y1 - dy + y);
|
||||||
|
@ -317,7 +317,7 @@ bool gl_dim_reg(session_t *ps, int dx, int dy, int width, int height, float z,
|
||||||
glColor4f(0.0f, 0.0f, 0.0f, factor);
|
glColor4f(0.0f, 0.0f, 0.0f, factor);
|
||||||
|
|
||||||
{
|
{
|
||||||
P_PAINTREG_START(crect) {
|
P_PAINTREG_START(reg_tgt, crect) {
|
||||||
glVertex3i(crect.x1, crect.y1, z);
|
glVertex3i(crect.x1, crect.y1, z);
|
||||||
glVertex3i(crect.x2, crect.y1, z);
|
glVertex3i(crect.x2, crect.y1, z);
|
||||||
glVertex3i(crect.x2, crect.y2, z);
|
glVertex3i(crect.x2, crect.y2, z);
|
||||||
|
@ -473,7 +473,7 @@ bool gl_blur_dst(session_t *ps, const gl_cap_t *cap, int dx, int dy, int width,
|
||||||
// XXX use multiple draw calls is probably going to be slow than
|
// XXX use multiple draw calls is probably going to be slow than
|
||||||
// just simply blur the whole area.
|
// just simply blur the whole area.
|
||||||
|
|
||||||
P_PAINTREG_START(crect) {
|
P_PAINTREG_START(reg_tgt, crect) {
|
||||||
// Texture coordinates
|
// Texture coordinates
|
||||||
const GLfloat texture_x1 = (crect.x1 - dx) * texfac_x;
|
const GLfloat texture_x1 = (crect.x1 - dx) * texfac_x;
|
||||||
const GLfloat texture_y1 = (crect.y1 - dy) * texfac_y;
|
const GLfloat texture_y1 = (crect.y1 - dy) * texfac_y;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
#define CASESTRRET(s) case s: return #s
|
||||||
|
|
||||||
// Program and uniforms for window shader
|
// Program and uniforms for window shader
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// GLSL program.
|
/// GLSL program.
|
||||||
|
|
|
@ -77,10 +77,6 @@
|
||||||
#define MSTR_(s) #s
|
#define MSTR_(s) #s
|
||||||
#define MSTR(s) MSTR_(s)
|
#define MSTR(s) MSTR_(s)
|
||||||
|
|
||||||
// Use #s here to prevent macro expansion
|
|
||||||
/// Macro used for shortening some debugging code.
|
|
||||||
#define CASESTRRET(s) case s: return #s
|
|
||||||
|
|
||||||
// X resource checker
|
// X resource checker
|
||||||
#ifdef DEBUG_XRC
|
#ifdef DEBUG_XRC
|
||||||
#include "xrescheck.h"
|
#include "xrescheck.h"
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
#define auto __auto_type
|
#define CASESTRRET(s) case s: return #s
|
||||||
|
|
||||||
/// Get session_t pointer from a pointer to a member of session_t
|
/// Get session_t pointer from a pointer to a member of session_t
|
||||||
#define session_ptr(ptr, member) ({ \
|
#define session_ptr(ptr, member) ({ \
|
||||||
|
|
Loading…
Reference in New Issue