[cairo-commit] libglc/src glc.c,1.21,1.22 glc.h,1.15,1.16 glc_agl_extension.c,1.6,1.7 glc_agl_format.c,1.6,1.7 glc_agl_info.c,1.7,1.8 glc_glx_extension.c,1.13,1.14 glc_glx_format.c,1.16,1.17 glc_glx_info.c,1.12,1.13 glc_glx_surface.c,1.17,1.18 glc_program.c,1.5,1.6 glc_programmatic.c,1.1,1.2 glc_surface.c,1.19,1.20 glc_texture.c,1.10,1.11 glcint.h,1.22,1.23
David Reveman
commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005
Committed by: davidr
Update of /cvs/cairo/libglc/src
In directory pdx:/tmp/cvs-serv10305/src
Modified Files:
glc.c glc.h glc_agl_extension.c glc_agl_format.c
glc_agl_info.c glc_glx_extension.c glc_glx_format.c
glc_glx_info.c glc_glx_surface.c glc_program.c
glc_programmatic.c glc_surface.c glc_texture.c glcint.h
Log Message:
Added solid programmatic surfaces
Index: glc.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** a/glc.c 27 Feb 2004 14:46:23 -0000 1.21
--- b/glc.c 5 Mar 2004 07:48:22 -0000 1.22
***************
*** 40,43 ****
--- 40,46 ----
(surface->repeat)
+ #define PROG_OR_REPEAT(surface) \
+ (surface->repeat || surface->programmatic)
+
#define GLREPEAT(surface, texture) \
(surface->repeat && texture->repeatable)
***************
*** 83,91 ****
double src_width, src_height, mask_width, mask_height;
! /* TODO: support direct compositing with programmatic mask surface
! and mask surface with convolution filter */
! if (mask->programmatic || mask->convolution)
return 0;
!
/* We cannot continue if we have a rotating transformation or
if both surfaces have transformations or the surface not being
--- 86,94 ----
double src_width, src_height, mask_width, mask_height;
! /* Only one of src or mask can be processed using fragment program */
! if ((src->programmatic || src->convolution) &&
! (mask->programmatic || mask->convolution))
return 0;
!
/* We cannot continue if we have a rotating transformation or
if both surfaces have transformations or the surface not being
***************
*** 95,103 ****
return 0;
! if ((TRANSFORM (src) && (TRANSFORM (mask) || (!REPEAT (mask)))) ||
! (TRANSFORM (mask) && (TRANSFORM (src) || (!REPEAT (src)))))
return 0;
}
!
src_texture = glc_surface_get_texture (src);
mask_texture = glc_surface_get_texture (mask);
--- 98,106 ----
return 0;
! if ((TRANSFORM (src) && (TRANSFORM (mask) || (!PROG_OR_REPEAT (mask)))) ||
! (TRANSFORM (mask) && (TRANSFORM (src) || (!PROG_OR_REPEAT (src)))))
return 0;
}
!
src_texture = glc_surface_get_texture (src);
mask_texture = glc_surface_get_texture (mask);
***************
*** 113,117 ****
glDisable (GL_SCISSOR_TEST);
! if (!glc_surface_enable_program (dst, src, src_texture, mask_texture)) {
glc_surface_pop_current (dst);
return 0;
--- 116,121 ----
glDisable (GL_SCISSOR_TEST);
! if (!glc_surface_enable_program (dst, src, mask,
! src_texture, mask_texture)) {
glc_surface_pop_current (dst);
return 0;
***************
*** 119,126 ****
glc_set_operator (op);
!
dst->proc_address->gl_active_texture_arb (GL_TEXTURE0_ARB);
glc_texture_bind (src_texture);
!
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
--- 123,130 ----
glc_set_operator (op);
!
dst->proc_address->gl_active_texture_arb (GL_TEXTURE0_ARB);
glc_texture_bind (src_texture);
!
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
***************
*** 134,140 ****
dst->proc_address->gl_active_texture_arb (GL_TEXTURE1_ARB);
glc_texture_bind (mask_texture);
!
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
!
if (TRANSFORM (mask))
glc_texture_ensure_filter (mask_texture, mask->filter);
--- 138,144 ----
dst->proc_address->gl_active_texture_arb (GL_TEXTURE1_ARB);
glc_texture_bind (mask_texture);
!
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
!
if (TRANSFORM (mask))
glc_texture_ensure_filter (mask_texture, mask->filter);
***************
*** 142,146 ****
glc_texture_ensure_filter (mask_texture, GLC_FILTER_NEAREST);
!
/* calculate source area */
src_region.x1 = src_region.y1 = 0.0;
--- 146,150 ----
glc_texture_ensure_filter (mask_texture, GLC_FILTER_NEAREST);
!
/* calculate source area */
src_region.x1 = src_region.y1 = 0.0;
***************
*** 261,265 ****
(GL_TEXTURE1_ARB, mask_tl.x, mask_tl.y);
glVertex2d (dst_region.x1, dst_region.y1);
!
dst->proc_address->gl_multi_tex_coord_2d_arb
(GL_TEXTURE0_ARB, src_br.x, src_tl.y);
--- 265,269 ----
(GL_TEXTURE1_ARB, mask_tl.x, mask_tl.y);
glVertex2d (dst_region.x1, dst_region.y1);
!
dst->proc_address->gl_multi_tex_coord_2d_arb
(GL_TEXTURE0_ARB, src_br.x, src_tl.y);
***************
*** 267,271 ****
(GL_TEXTURE1_ARB, mask_br.x, mask_tl.y);
glVertex2d (dst_region.x2, dst_region.y1);
!
dst->proc_address->gl_multi_tex_coord_2d_arb
(GL_TEXTURE0_ARB, src_br.x, src_br.y);
--- 271,275 ----
(GL_TEXTURE1_ARB, mask_br.x, mask_tl.y);
glVertex2d (dst_region.x2, dst_region.y1);
!
dst->proc_address->gl_multi_tex_coord_2d_arb
(GL_TEXTURE0_ARB, src_br.x, src_br.y);
***************
*** 285,288 ****
--- 289,293 ----
dst->proc_address->gl_active_texture_arb (GL_TEXTURE0_ARB);
+
glc_texture_unbind (src_texture);
***************
*** 311,314 ****
--- 316,321 ----
int x_mask,
int y_mask,
+ int x_dst,
+ int y_dst,
glc_region_box_t *bounds,
glc_region_box_t *mbounds)
***************
*** 337,345 ****
if (!REPEAT (src)) {
! region.x1 = 0;
! region.y1 = 0;
! region.x2 = src->width - x_src;
! region.y2 = src->height - y_src;
!
if (TRANSFORM (src))
glc_matrix_transform_region (src->transform, ®ion);
--- 344,356 ----
if (!REPEAT (src)) {
! region.x1 = x_dst;
! region.y1 = y_dst;
! if (x_src < 0) region.x1 -= x_src;
! if (y_src < 0) region.y1 -= y_src;
! region.x2 = region.x1 + src->width;
! region.y2 = region.y1 + src->height;
! if (x_src > 0) region.x2 -= x_src;
! if (y_src > 0) region.y2 -= y_src;
!
if (TRANSFORM (src))
glc_matrix_transform_region (src->transform, ®ion);
***************
*** 359,366 ****
if (!REPEAT (mask)) {
! region.x1 = 0;
! region.y1 = 0;
! region.x2 = mask->width - x_mask;
! region.y2 = mask->height - y_mask;
if (TRANSFORM (mask))
--- 370,381 ----
if (!REPEAT (mask)) {
! region.x1 = x_dst;
! region.y1 = y_dst;
! if (x_mask < 0) region.x1 -= x_mask;
! if (y_mask < 0) region.y1 -= y_mask;
! region.x2 = region.x1 + mask->width;
! region.y2 = region.y1 + mask->height;
! if (x_mask > 0) region.x2 -= x_mask;
! if (y_mask > 0) region.y2 -= y_mask;
if (TRANSFORM (mask))
***************
*** 401,405 ****
if (src->programmatic)
! glc_programmatic_surface_setup (src, width + x_src, height + y_src);
if (mask) {
--- 416,427 ----
if (src->programmatic)
! glc_programmatic_surface_setup (src,
! width + abs (x_src),
! height + abs (y_src));
!
! if (mask && mask->programmatic)
! glc_programmatic_surface_setup (mask,
! width + abs (x_mask),
! height + abs (y_mask));
if (mask) {
***************
*** 428,433 ****
bounds.y1 = y_dst;
bounds.y2 = y_dst + height;
!
! glc_mask_bounds (src, mask, dst, x_src, y_src, x_mask, y_mask,
&bounds, &mask_bounds);
--- 450,456 ----
bounds.y1 = y_dst;
bounds.y2 = y_dst + height;
!
! glc_mask_bounds (src, mask, dst,
! x_src, y_src, x_mask, y_mask, x_dst, y_dst,
&bounds, &mask_bounds);
***************
*** 464,468 ****
y_dst - mask_bounds.y1);
}
!
glc_composite (GLC_OPERATOR_SRC,
mask, NULL, mask_surface,
--- 487,491 ----
y_dst - mask_bounds.y1);
}
!
glc_composite (GLC_OPERATOR_SRC,
mask, NULL, mask_surface,
***************
*** 470,475 ****
0, 0,
0, 0,
! mask_surface->width,
! mask_surface->height);
if (intermediate_translate)
--- 493,498 ----
0, 0,
0, 0,
! mask_surface->width - (x_dst - mask_bounds.x1),
! mask_surface->height - (y_dst - mask_bounds.y1));
if (intermediate_translate)
***************
*** 530,534 ****
if (src->convolution || src->programmatic)
! glc_surface_enable_program (dst, src, texture, NULL);
if ((!TRANSFORM (src)) && GLREPEAT (src, texture)) {
--- 553,557 ----
if (src->convolution || src->programmatic)
! glc_surface_enable_program (dst, src, mask, texture, NULL);
if ((!TRANSFORM (src)) && GLREPEAT (src, texture)) {
***************
*** 612,616 ****
/* Shift all coordinates with source offset */
if (x_src) {
! x_src = (x_src % src->width);
tl.x -= x_src;
bl.x -= x_src;
--- 635,641 ----
/* Shift all coordinates with source offset */
if (x_src) {
! x_src = abs (x_src);
! if (REPEAT (src))
! x_src = (x_src % src->width);
tl.x -= x_src;
bl.x -= x_src;
***************
*** 619,623 ****
}
if (y_src) {
! y_src = (y_src % src->height);
tl.y -= y_src;
bl.y -= y_src;
--- 644,650 ----
}
if (y_src) {
! y_src = abs (y_src);
! if (REPEAT (src))
! y_src = (y_src % src->height);
tl.y -= y_src;
bl.y -= y_src;
Index: glc.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** a/glc.h 29 Feb 2004 17:37:42 -0000 1.15
--- b/glc.h 5 Mar 2004 07:48:22 -0000 1.16
***************
*** 141,145 ****
#define GLC_FEATURE_OFFSCREEN_DRAWING_MASK (1L << 0)
#define GLC_FEATURE_CONVOLUTION_FILTER_MASK (1L << 1)
! #define GLC_FEATURE_PROGRAMMATIC_SURFACE_MASK (1L << 2)
#define GLC_FEATURE_TEXTURE_RECTANGLE_MASK (1L << 3)
#define GLC_FEATURE_TEXTURE_NPOT_MASK (1L << 4)
--- 141,145 ----
#define GLC_FEATURE_OFFSCREEN_DRAWING_MASK (1L << 0)
#define GLC_FEATURE_CONVOLUTION_FILTER_MASK (1L << 1)
! #define GLC_FEATURE_GRADIENT_MASK (1L << 2)
#define GLC_FEATURE_TEXTURE_RECTANGLE_MASK (1L << 3)
#define GLC_FEATURE_TEXTURE_NPOT_MASK (1L << 4)
***************
*** 317,320 ****
--- 317,323 ----
glc_surface_t *
+ glc_solid_create (glc_color_t *color);
+
+ glc_surface_t *
glc_linear_gradient_create (glc_colorpoint_t *start,
glc_colorpoint_t *end,
Index: glc_agl_extension.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_extension.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** a/glc_agl_extension.c 29 Feb 2004 17:37:42 -0000 1.6
--- b/glc_agl_extension.c 5 Mar 2004 07:48:22 -0000 1.7
***************
*** 94,98 ****
GLC_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
thread_info->feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! thread_info->feature_mask |= GLC_FEATURE_PROGRAMMATIC_SURFACE_MASK;
}
--- 94,98 ----
GLC_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
thread_info->feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! thread_info->feature_mask |= GLC_FEATURE_GRADIENT_MASK;
}
Index: glc_agl_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_format.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** a/glc_agl_format.c 12 Feb 2004 12:49:39 -0000 1.6
--- b/glc_agl_format.c 5 Mar 2004 07:48:22 -0000 1.7
***************
*** 180,184 ****
sizeof (glc_format_t) * thread_info->n_formats);
! memcpy (&thread_info->formats[index], format, sizeof (glc_format_t));
}
}
--- 180,184 ----
sizeof (glc_format_t) * thread_info->n_formats);
! thread_info->formats[index] = *format;
}
}
Index: glc_agl_info.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_info.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/glc_agl_info.c 26 Feb 2004 10:16:04 -0000 1.7
--- b/glc_agl_info.c 5 Mar 2004 07:48:22 -0000 1.8
***************
*** 166,170 ****
| GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK
| GLC_FEATURE_CONVOLUTION_FILTER_MASK
! | GLC_FEATURE_PROGRAMMATIC_SURFACE_MASK
#endif
--- 166,170 ----
| GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK
| GLC_FEATURE_CONVOLUTION_FILTER_MASK
! | GLC_FEATURE_GRADIENT_MASK
#endif
Index: glc_glx_extension.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_extension.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** a/glc_glx_extension.c 29 Feb 2004 17:37:42 -0000 1.13
--- b/glc_glx_extension.c 5 Mar 2004 07:48:22 -0000 1.14
***************
*** 100,105 ****
screen_info->feature_mask |= GLC_FEATURE_MULTISAMPLE_MASK;
! /* All geforce fx cards seems to support multisample with pbuffers */
! if (!strncmp ("GeForce FX", (char *) glGetString (GL_RENDERER), 10))
screen_info->feature_mask |= GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
}
--- 100,105 ----
screen_info->feature_mask |= GLC_FEATURE_MULTISAMPLE_MASK;
! /* All geforce cards seems to support multisample with pbuffers */
! if (!strncmp ("GeForce", (char *) glGetString (GL_RENDERER), 7))
screen_info->feature_mask |= GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
}
***************
*** 155,159 ****
GLC_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
screen_info->feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! screen_info->feature_mask |= GLC_FEATURE_PROGRAMMATIC_SURFACE_MASK;
#endif
--- 155,159 ----
GLC_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
screen_info->feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! screen_info->feature_mask |= GLC_FEATURE_GRADIENT_MASK;
#endif
Index: glc_glx_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_format.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** a/glc_glx_format.c 23 Feb 2004 22:38:14 -0000 1.16
--- b/glc_glx_format.c 5 Mar 2004 07:48:22 -0000 1.17
***************
*** 85,89 ****
sizeof (glc_format_t) * screen_info->n_formats);
! memcpy (&screen_info->formats[index], format, sizeof (glc_format_t));
}
}
--- 85,89 ----
sizeof (glc_format_t) * screen_info->n_formats);
! screen_info->formats[index] = *format;
}
}
Index: glc_glx_info.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_info.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** a/glc_glx_info.c 26 Feb 2004 10:16:04 -0000 1.12
--- b/glc_glx_info.c 5 Mar 2004 07:48:22 -0000 1.13
***************
*** 318,322 ****
| GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK
| GLC_FEATURE_CONVOLUTION_FILTER_MASK
! | GLC_FEATURE_PROGRAMMATIC_SURFACE_MASK
#endif
--- 318,322 ----
| GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK
| GLC_FEATURE_CONVOLUTION_FILTER_MASK
! | GLC_FEATURE_GRADIENT_MASK
#endif
Index: glc_glx_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_surface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** a/glc_glx_surface.c 26 Feb 2004 10:16:04 -0000 1.17
--- b/glc_glx_surface.c 5 Mar 2004 07:48:22 -0000 1.18
***************
*** 169,173 ****
surface->base.feature_mask &= ~GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
surface->base.feature_mask &= ~GLC_FEATURE_CONVOLUTION_FILTER_MASK;
! surface->base.feature_mask &= ~GLC_FEATURE_PROGRAMMATIC_SURFACE_MASK;
surface->base.feature_mask &= ~GLC_FEATURE_MULTISAMPLE_MASK;
surface->base.feature_mask &= ~GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
--- 169,173 ----
surface->base.feature_mask &= ~GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
surface->base.feature_mask &= ~GLC_FEATURE_CONVOLUTION_FILTER_MASK;
! surface->base.feature_mask &= ~GLC_FEATURE_GRADIENT_MASK;
surface->base.feature_mask &= ~GLC_FEATURE_MULTISAMPLE_MASK;
surface->base.feature_mask &= ~GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
***************
*** 196,200 ****
GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
surface->base.feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! surface->base.feature_mask |= GLC_FEATURE_PROGRAMMATIC_SURFACE_MASK;
}
--- 196,200 ----
GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
surface->base.feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! surface->base.feature_mask |= GLC_FEATURE_GRADIENT_MASK;
}
Index: glc_program.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_program.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glc_program.c 27 Feb 2004 14:46:23 -0000 1.5
--- b/glc_program.c 5 Mar 2004 07:48:22 -0000 1.6
***************
*** 34,92 ****
#include <stdio.h>
- #ifdef GL_ARB_fragment_program
-
#define EXPAND_NONE ""
! #define EXPAND_2D_SRC "2D"
! #define EXPAND_RECT_SRC "RECT"
#define EXPAND_MASK_TEMP "TEMP mask;\n"
! #define EXPAND_2D_MASK_OP \
"TEX mask, fragment.texcoord[1], texture[1], 2D;\n" \
"MUL result.color, color, mask.a;\n"
! #define EXPAND_RECT_MASK_OP \
"TEX mask, fragment.texcoord[1], texture[1], RECT;\n" \
"MUL result.color, color, mask.a;\n"
- #define EXPAND_NO_MASK_OP \
- "MOV result.color, color;\n"
typedef struct _glc_program_expand_t glc_program_expand_t;
static const struct _glc_program_expand_t {
! char *src_tex;
! char *mask_temporary;
! char *mask_operation;
} _program_expand_map[] = {
/* GLC_PROGRAM_2DSRC_2DMASK_OFFSET */
! { EXPAND_2D_SRC, EXPAND_MASK_TEMP, EXPAND_2D_MASK_OP },
/* GLC_PROGRAM_RECTSRC_2DMASK_OFFSET */
! { EXPAND_RECT_SRC, EXPAND_MASK_TEMP, EXPAND_2D_MASK_OP },
/* GLC_PROGRAM_2DSRC_RECTMASK_OFFSET */
! { EXPAND_2D_SRC, EXPAND_MASK_TEMP, EXPAND_RECT_MASK_OP },
/* GLC_PROGRAM_RECTSRC_RECTMASK_OFFSET */
! { EXPAND_RECT_SRC, EXPAND_MASK_TEMP, EXPAND_RECT_MASK_OP },
/* GLC_PROGRAM_NOSRC_2DMASK_OFFSET */
! { EXPAND_NONE, EXPAND_MASK_TEMP, EXPAND_2D_MASK_OP },
/* GLC_PROGRAM_NOSRC_RECTMASK_OFFSET */
! { EXPAND_NONE, EXPAND_MASK_TEMP, EXPAND_RECT_MASK_OP },
/* GLC_PROGRAM_2DSRC_NOMASK_OFFSET */
! { EXPAND_2D_SRC, EXPAND_NONE, EXPAND_NO_MASK_OP },
/* GLC_PROGRAM_RECTSRC_NOMASK_OFFSET */
! { EXPAND_RECT_SRC, EXPAND_NONE, EXPAND_NO_MASK_OP },
/* GLC_PROGRAM_NOSRC_NOMASK_OFFSET */
! { EXPAND_NONE, EXPAND_NONE, EXPAND_NO_MASK_OP },
};
/*
* Passes texture coordinates to convolution filter
! * fragment programs. Texture unit 1 is reserved for MASK
! * in Porter-Duff compositing.
*
* program.local[0]: Vertical pixel offset in texture coordinates
--- 34,133 ----
#include <stdio.h>
#define EXPAND_NONE ""
! #define EXPAND_2D_TEX "2D"
! #define EXPAND_RECT_TEX "RECT"
! #define EXPAND_NO_PD_OP \
! "MOV result.color, color;\n"
!
! #define EXPAND_SRC_TEMP "TEMP src;\n"
! #define EXPAND_SRC_2D_PD_OP \
! "TEX src, fragment.texcoord[0], texture[0], 2D;\n" \
! "MUL result.color, src, color.a;\n"
! #define EXPAND_SRC_RECT_PD_OP \
! "TEX src, fragment.texcoord[0], texture[0], RECT;\n" \
! "MUL result.color, src, color.a;\n"
!
#define EXPAND_MASK_TEMP "TEMP mask;\n"
! #define EXPAND_MASK_2D_PD_OP \
"TEX mask, fragment.texcoord[1], texture[1], 2D;\n" \
"MUL result.color, color, mask.a;\n"
! #define EXPAND_MASK_RECT_PD_OP \
"TEX mask, fragment.texcoord[1], texture[1], RECT;\n" \
"MUL result.color, color, mask.a;\n"
typedef struct _glc_program_expand_t glc_program_expand_t;
static const struct _glc_program_expand_t {
! int index;
! char *tex;
! char *temporary;
! char *operation;
} _program_expand_map[] = {
+ /* src is operation surface */
+
/* GLC_PROGRAM_2DSRC_2DMASK_OFFSET */
! { 0, EXPAND_2D_TEX, EXPAND_MASK_TEMP, EXPAND_MASK_2D_PD_OP },
/* GLC_PROGRAM_RECTSRC_2DMASK_OFFSET */
! { 0, EXPAND_RECT_TEX, EXPAND_MASK_TEMP, EXPAND_MASK_2D_PD_OP },
/* GLC_PROGRAM_2DSRC_RECTMASK_OFFSET */
! { 0, EXPAND_2D_TEX, EXPAND_MASK_TEMP, EXPAND_MASK_RECT_PD_OP },
/* GLC_PROGRAM_RECTSRC_RECTMASK_OFFSET */
! { 0, EXPAND_RECT_TEX, EXPAND_MASK_TEMP, EXPAND_MASK_RECT_PD_OP },
/* GLC_PROGRAM_NOSRC_2DMASK_OFFSET */
! { 0, EXPAND_NONE, EXPAND_MASK_TEMP, EXPAND_MASK_2D_PD_OP },
/* GLC_PROGRAM_NOSRC_RECTMASK_OFFSET */
! { 0, EXPAND_NONE, EXPAND_MASK_TEMP, EXPAND_MASK_RECT_PD_OP },
/* GLC_PROGRAM_2DSRC_NOMASK_OFFSET */
! { 0, EXPAND_2D_TEX, EXPAND_NONE, EXPAND_NO_PD_OP },
/* GLC_PROGRAM_RECTSRC_NOMASK_OFFSET */
! { 0, EXPAND_RECT_TEX, EXPAND_NONE, EXPAND_NO_PD_OP },
/* GLC_PROGRAM_NOSRC_NOMASK_OFFSET */
! { 0, EXPAND_NONE, EXPAND_NONE, EXPAND_NO_PD_OP },
!
!
! /* mask is operation surface */
!
! /* GLC_PROGRAM_2DSRC_2DMASK_OFFSET */
! { 1, EXPAND_2D_TEX, EXPAND_SRC_TEMP, EXPAND_SRC_2D_PD_OP },
!
! /* GLC_PROGRAM_RECTSRC_2DMASK_OFFSET */
! { 1, EXPAND_2D_TEX, EXPAND_SRC_TEMP, EXPAND_SRC_RECT_PD_OP },
!
! /* GLC_PROGRAM_2DSRC_RECTMASK_OFFSET */
! { 1, EXPAND_RECT_TEX, EXPAND_SRC_TEMP, EXPAND_SRC_2D_PD_OP },
!
! /* GLC_PROGRAM_RECTSRC_RECTMASK_OFFSET */
! { 1, EXPAND_RECT_TEX, EXPAND_SRC_TEMP, EXPAND_SRC_RECT_PD_OP },
!
! /* GLC_PROGRAM_NOSRC_2DMASK_OFFSET */
! { 1, EXPAND_2D_TEX, EXPAND_NONE, EXPAND_NO_PD_OP },
!
! /* GLC_PROGRAM_NOSRC_RECTMASK_OFFSET */
! { 1, EXPAND_RECT_TEX, EXPAND_NONE, EXPAND_NO_PD_OP },
!
! /* GLC_PROGRAM_2DSRC_NOMASK_OFFSET */
! { 1, EXPAND_NONE, EXPAND_SRC_TEMP, EXPAND_SRC_2D_PD_OP },
!
! /* GLC_PROGRAM_RECTSRC_NOMASK_OFFSET */
! { 1, EXPAND_NONE, EXPAND_SRC_TEMP, EXPAND_SRC_RECT_PD_OP },
!
! /* GLC_PROGRAM_NOSRC_NOMASK_OFFSET */
! { 1, EXPAND_NONE, EXPAND_NONE, EXPAND_NO_PD_OP }
};
+ #ifdef GL_ARB_fragment_program
+
/*
* Passes texture coordinates to convolution filter
! * fragment programs.
*
* program.local[0]: Vertical pixel offset in texture coordinates
***************
*** 98,110 ****
"!!ARBvp1.0\n"
"OPTION ARB_position_invariant;\n"
! "ATTRIB coord = vertex.texcoord[0];\n"
"PARAM vertical_offset = program.local[0];\n"
"PARAM horizontal_offset = program.local[1];\n"
! "MOV result.texcoord[0], coord;\n"
"ADD result.texcoord[2], coord, vertical_offset;\n"
"SUB result.texcoord[3], coord, vertical_offset;\n"
"ADD result.texcoord[4], coord, horizontal_offset;\n"
"SUB result.texcoord[5], coord, horizontal_offset;\n"
! "MOV result.texcoord[1], vertex.texcoord[1];\n"
"END";
--- 139,151 ----
"!!ARBvp1.0\n"
"OPTION ARB_position_invariant;\n"
! "ATTRIB coord = vertex.texcoord[%d];\n"
"PARAM vertical_offset = program.local[0];\n"
"PARAM horizontal_offset = program.local[1];\n"
! "MOV result.texcoord[%d], coord;\n"
"ADD result.texcoord[2], coord, vertical_offset;\n"
"SUB result.texcoord[3], coord, vertical_offset;\n"
"ADD result.texcoord[4], coord, horizontal_offset;\n"
"SUB result.texcoord[5], coord, horizontal_offset;\n"
! "MOV result.texcoord[%d], vertex.texcoord[%d];\n"
"END";
***************
*** 156,160 ****
/* center */
! "TEX in, fragment.texcoord[0], texture[0], %s;\n"
"MUL color, in, k1.y;\n"
--- 197,201 ----
/* center */
! "TEX in, fragment.texcoord[%d], texture[%d], %s;\n"
"MUL color, in, k1.y;\n"
***************
*** 162,197 ****
"MOV coord.x, west.x;\n"
"MOV coord.y, north.y;\n"
! "TEX in, coord, texture[0], %s;\n"
"MAD color, in, k0.x, color;\n"
/* north */
! "TEX in, north, texture[0], %s;\n"
"MAD color, in, k0.y, color;\n"
/* north east */
"MOV coord.x, east.x;\n"
! "TEX in, coord, texture[0], %s;\n"
"MAD color, in, k0.z, color;\n"
/* east */
! "TEX in, east, texture[0], %s;\n"
"MAD color, in, k1.x, color;\n"
/* south east */
"MOV coord.y, south.y;\n"
! "TEX in, coord, texture[0], %s;\n"
"MAD color, in, k2.z, color;\n"
/* south */
! "TEX in, south, texture[0], %s;\n"
"MAD color, in, k2.y, color;\n"
/* south west */
"MOV coord.x, west.x;\n"
! "TEX in, coord, texture[0], %s;\n"
"MAD color, in, k2.x, color;\n"
/* west */
! "TEX in, west, texture[0], %s;\n"
"MAD color, in, k1.x, color;\n"
--- 203,238 ----
"MOV coord.x, west.x;\n"
"MOV coord.y, north.y;\n"
! "TEX in, coord, texture[%d], %s;\n"
"MAD color, in, k0.x, color;\n"
/* north */
! "TEX in, north, texture[%d], %s;\n"
"MAD color, in, k0.y, color;\n"
/* north east */
"MOV coord.x, east.x;\n"
! "TEX in, coord, texture[%d], %s;\n"
"MAD color, in, k0.z, color;\n"
/* east */
! "TEX in, east, texture[%d], %s;\n"
"MAD color, in, k1.x, color;\n"
/* south east */
"MOV coord.y, south.y;\n"
! "TEX in, coord, texture[%d], %s;\n"
"MAD color, in, k2.z, color;\n"
/* south */
! "TEX in, south, texture[%d], %s;\n"
"MAD color, in, k2.y, color;\n"
/* south west */
"MOV coord.x, west.x;\n"
! "TEX in, coord, texture[%d], %s;\n"
"MAD color, in, k2.x, color;\n"
/* west */
! "TEX in, west, texture[%d], %s;\n"
"MAD color, in, k1.x, color;\n"
***************
*** 202,205 ****
--- 243,263 ----
char *_glc_fragment_program_programmatic[] = {
+ /*
+ * Solid.
+ *
+ * fragment.color: color
+ *
+ * Author: David Reveman <c99drn at cs.umu.se>
+ */
+ "!!ARBfp1.0\n"
+ "ATTRIB color = fragment.color;\n"
+
+ /* expanded with mask/src temporary */
+ "%s"
+
+ /* expanded with mask/src operation */
+ "%s"
+
+ "END",
/*
***************
*** 221,225 ****
"PARAM gradient = program.local[2];\n"
"PARAM angle = program.local[3];\n"
! "ATTRIB pos = fragment.texcoord[0];\n"
"TEMP color, distance, position;\n"
--- 279,283 ----
"PARAM gradient = program.local[2];\n"
"PARAM angle = program.local[3];\n"
! "ATTRIB pos = fragment.texcoord[%d];\n"
"TEMP color, distance, position;\n"
***************
*** 261,265 ****
"PARAM end_color = program.local[1];\n"
"PARAM gradient = program.local[2];\n"
! "ATTRIB position = fragment.texcoord[0];\n"
"TEMP color, distance;\n"
--- 319,323 ----
"PARAM end_color = program.local[1];\n"
"PARAM gradient = program.local[2];\n"
! "ATTRIB position = fragment.texcoord[%d];\n"
"TEMP color, distance;\n"
***************
*** 371,377 ****
sprintf (program_buffer,
_glc_fragment_program_simple,
! expand->mask_temporary,
! expand->src_tex,
! expand->mask_operation);
return glc_program_compile_fragment_arb (proc_address, program_buffer);
--- 429,435 ----
sprintf (program_buffer,
_glc_fragment_program_simple,
! expand->temporary,
! expand->tex,
! expand->operation);
return glc_program_compile_fragment_arb (proc_address, program_buffer);
***************
*** 379,382 ****
--- 437,457 ----
static unsigned long
+ glc_program_compile_vertex_convolution
+ (glc_gl_proc_address_list_t *proc_address,
+ int offset)
+ {
+ char program_buffer[512];
+ int conv_index = (offset)? 1: 0;
+ int other_index = (offset)? 0: 1;
+
+ sprintf (program_buffer,
+ _glc_vertex_program_convolution,
+ conv_index, conv_index,
+ other_index, other_index);
+
+ return glc_program_compile_vertex_arb (proc_address, program_buffer);
+ }
+
+ static unsigned long
glc_program_compile_convolution (glc_gl_proc_address_list_t *proc_address,
int offset)
***************
*** 387,395 ****
sprintf (program_buffer,
_glc_fragment_program_convolution,
! expand->mask_temporary,
! expand->src_tex, expand->src_tex, expand->src_tex,
! expand->src_tex, expand->src_tex, expand->src_tex,
! expand->src_tex, expand->src_tex, expand->src_tex,
! expand->mask_operation);
return glc_program_compile_fragment_arb (proc_address, program_buffer);
--- 462,476 ----
sprintf (program_buffer,
_glc_fragment_program_convolution,
! expand->temporary,
! expand->index, expand->index, expand->tex,
! expand->index, expand->tex,
! expand->index, expand->tex,
! expand->index, expand->tex,
! expand->index, expand->tex,
! expand->index, expand->tex,
! expand->index, expand->tex,
! expand->index, expand->tex,
! expand->index, expand->tex,
! expand->operation);
return glc_program_compile_fragment_arb (proc_address, program_buffer);
***************
*** 404,411 ****
const glc_program_expand_t *expand = &_program_expand_map[offset];
! sprintf (program_buffer,
! _glc_fragment_program_programmatic[type],
! expand->mask_temporary,
! expand->mask_operation);
return glc_program_compile_fragment_arb (proc_address, program_buffer);
--- 485,504 ----
const glc_program_expand_t *expand = &_program_expand_map[offset];
! switch (type) {
! case GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE:
! sprintf (program_buffer,
! _glc_fragment_program_programmatic[type],
! expand->temporary,
! expand->operation);
! break;
! case GLC_PROGRAMMATIC_SURFACE_LINEAR_GRADIENT_TYPE:
! case GLC_PROGRAMMATIC_SURFACE_RADIAL_GRADIENT_TYPE:
! sprintf (program_buffer,
! _glc_fragment_program_programmatic[type],
! expand->index,
! expand->temporary,
! expand->operation);
! break;
! }
return glc_program_compile_fragment_arb (proc_address, program_buffer);
***************
*** 439,456 ****
glc_programs_t *programs,
glc_surface_t *src,
glc_texture_t *src_texture,
! glc_texture_t *mask_texture)
{
! int offset;
! if (!(src->feature_mask & GLC_FEATURE_CONVOLUTION_FILTER_MASK))
! return 0;
! if (!programs->vertex_convolution[0])
! programs->vertex_convolution[0] =
! glc_program_compile_vertex_arb (proc_address,
! _glc_vertex_program_convolution);
! offset = _glc_program_offset (src_texture, mask_texture);
if (!programs->fragment_convolution[offset])
--- 532,560 ----
glc_programs_t *programs,
glc_surface_t *src,
+ glc_surface_t *mask,
glc_texture_t *src_texture,
! glc_texture_t *mask_texture,
! int offset)
{
! glc_texture_t *texture;
! glc_surface_t *surface;
! int vertex_offset = (offset)? 1: 0;
! if (offset) {
! texture = mask_texture;
! surface = mask;
! } else {
! texture = src_texture;
! surface = src;
! }
! if (!(surface->feature_mask & GLC_FEATURE_CONVOLUTION_FILTER_MASK))
! return 1;
! offset += _glc_program_offset (src_texture, mask_texture);
!
! if (!programs->vertex_convolution[vertex_offset])
! programs->vertex_convolution[vertex_offset] =
! glc_program_compile_vertex_convolution (proc_address, vertex_offset);
if (!programs->fragment_convolution[offset])
***************
*** 465,475 ****
programs->vertex_convolution[0]);
proc_address->gl_program_local_param_4d_arb (GL_VERTEX_PROGRAM_ARB, 0,
! src_texture->texcoord_width /
! (double) src_texture->width,
0.000, 0.0, 0.0);
proc_address->gl_program_local_param_4d_arb (GL_VERTEX_PROGRAM_ARB, 1,
0.000,
! src_texture->texcoord_height /
! (double) src_texture->height,
0.0, 0.0);
--- 569,579 ----
programs->vertex_convolution[0]);
proc_address->gl_program_local_param_4d_arb (GL_VERTEX_PROGRAM_ARB, 0,
! texture->texcoord_width /
! (double) texture->width,
0.000, 0.0, 0.0);
proc_address->gl_program_local_param_4d_arb (GL_VERTEX_PROGRAM_ARB, 1,
0.000,
! texture->texcoord_height /
! (double) texture->height,
0.0, 0.0);
***************
*** 478,494 ****
programs->fragment_convolution[offset]);
proc_address->gl_program_local_param_4d_arb (GL_FRAGMENT_PROGRAM_ARB, 0,
! src->convolution->m[0][0],
! src->convolution->m[0][1],
! src->convolution->m[0][2],
0.0);
proc_address->gl_program_local_param_4d_arb (GL_FRAGMENT_PROGRAM_ARB, 1,
! src->convolution->m[1][0],
! src->convolution->m[1][1],
! src->convolution->m[1][2],
0.0);
proc_address->gl_program_local_param_4d_arb (GL_FRAGMENT_PROGRAM_ARB, 2,
! src->convolution->m[2][0],
! src->convolution->m[2][1],
! src->convolution->m[2][2],
0.0);
return 1;
--- 582,598 ----
programs->fragment_convolution[offset]);
proc_address->gl_program_local_param_4d_arb (GL_FRAGMENT_PROGRAM_ARB, 0,
! surface->convolution->m[0][0],
! surface->convolution->m[0][1],
! surface->convolution->m[0][2],
0.0);
proc_address->gl_program_local_param_4d_arb (GL_FRAGMENT_PROGRAM_ARB, 1,
! surface->convolution->m[1][0],
! surface->convolution->m[1][1],
! surface->convolution->m[1][2],
0.0);
proc_address->gl_program_local_param_4d_arb (GL_FRAGMENT_PROGRAM_ARB, 2,
! surface->convolution->m[2][0],
! surface->convolution->m[2][1],
! surface->convolution->m[2][2],
0.0);
return 1;
***************
*** 498,561 ****
}
static glc_bool_t
! glc_program_enable_programmatic (glc_gl_proc_address_list_t *proc_address,
! glc_programs_t *programs,
glc_programmatic_surface_t *surface,
! glc_texture_t *mask_texture)
{
! int type_offset, offset = _glc_program_offset (NULL, mask_texture);
type_offset = offset + GLC_FRAGMENT_PROGRAM_TYPES * surface->type;
-
- if (!programs->fragment_programmatic[type_offset])
- programs->fragment_programmatic[type_offset] =
- glc_program_compile_programmatic (surface->type, proc_address, offset);
! if (programs->fragment_programmatic[type_offset]) {
! glEnable (GL_FRAGMENT_PROGRAM_ARB);
! proc_address->gl_bind_program_arb
! (GL_FRAGMENT_PROGRAM_ARB, programs->fragment_programmatic[type_offset]);
!
glc_programmatic_surface_set_parameters (proc_address, surface);
return 1;
}
return 0;
}
- #endif
-
glc_bool_t
glc_program_enable (glc_surface_t *dst,
glc_surface_t *src,
glc_texture_t *src_texture,
glc_texture_t *mask_texture)
{
!
! #ifdef GL_ARB_fragment_program
! if ((!mask_texture) && (!src->convolution) && (!src->programmatic))
return 1;
if (src->programmatic)
return
! glc_program_enable_programmatic (dst->proc_address,
! dst->programs,
(glc_programmatic_surface_t *) src,
! mask_texture);
!
! if (src->convolution)
return
! glc_program_enable_convolution (dst->proc_address,
! dst->programs,
! src,
! src_texture,
! mask_texture);
!
! return
! glc_program_enable_simple (dst->proc_address,
! dst->programs,
! src_texture,
! mask_texture);
#endif
--- 602,716 ----
}
+ #endif
+
static glc_bool_t
! glc_program_enable_programmatic (glc_surface_t *dst,
glc_programmatic_surface_t *surface,
! glc_texture_t *src_texture,
! glc_texture_t *mask_texture,
! int offset)
{
! int type_offset, add_offset;
! glc_gl_proc_address_list_t *proc_address = dst->proc_address;
! glc_programs_t *programs = dst->programs;
!
! if (offset)
! add_offset = _glc_program_offset (src_texture, NULL);
! else
! add_offset = _glc_program_offset (NULL, mask_texture);
!
! offset += add_offset;
type_offset = offset + GLC_FRAGMENT_PROGRAM_TYPES * surface->type;
! /* no fragment proram needed for solid programmatic surface and no mask */
! if ((surface->type == GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) &&
! (add_offset == GLC_PROGRAM_NOSRC_NOMASK_OFFSET)) {
glc_programmatic_surface_set_parameters (proc_address, surface);
return 1;
}
+
+ #ifdef GL_ARB_fragment_program
+ if (dst->feature_mask & GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
+ if (!programs->fragment_programmatic[type_offset])
+ programs->fragment_programmatic[type_offset] =
+ glc_program_compile_programmatic (surface->type, proc_address, offset);
+
+ if (programs->fragment_programmatic[type_offset]) {
+ glEnable (GL_FRAGMENT_PROGRAM_ARB);
+ proc_address->gl_bind_program_arb
+ (GL_FRAGMENT_PROGRAM_ARB,
+ programs->fragment_programmatic[type_offset]);
+
+ glc_programmatic_surface_set_parameters (proc_address, surface);
+
+ return 1;
+ }
+ }
+ #endif
return 0;
}
glc_bool_t
glc_program_enable (glc_surface_t *dst,
glc_surface_t *src,
+ glc_surface_t *mask,
glc_texture_t *src_texture,
glc_texture_t *mask_texture)
{
! /* fragment operation on both src and mask is not supported yet */
! if ((src->programmatic || src->convolution) &&
! (mask && (mask->programmatic || mask->convolution)))
! return 0;
!
! if ((!mask) && (!src->programmatic) && (!src->convolution))
return 1;
if (src->programmatic)
return
! glc_program_enable_programmatic (dst,
(glc_programmatic_surface_t *) src,
! src_texture,
! mask_texture,
! GLC_PROGRAM_SRC_OPERATION_OFFSET);
!
! #ifdef GL_ARB_fragment_program
! if (dst->feature_mask & GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
! if (mask && mask->programmatic)
! return
! glc_program_enable_programmatic (dst,
! (glc_programmatic_surface_t *) mask,
! src_texture,
! mask_texture,
! GLC_PROGRAM_MASK_OPERATION_OFFSET);
!
! if (src->convolution)
! return
! glc_program_enable_convolution (dst->proc_address,
! dst->programs,
! src,
! mask,
! src_texture,
! mask_texture,
! GLC_PROGRAM_SRC_OPERATION_OFFSET);
!
! if (mask && mask->convolution)
! return
! glc_program_enable_convolution (dst->proc_address,
! dst->programs,
! src,
! mask,
! src_texture,
! mask_texture,
! GLC_PROGRAM_MASK_OPERATION_OFFSET);
!
return
! glc_program_enable_simple (dst->proc_address,
! dst->programs,
! src_texture,
! mask_texture);
! }
#endif
Index: glc_programmatic.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_programmatic.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/glc_programmatic.c 26 Feb 2004 10:16:04 -0000 1.1
--- b/glc_programmatic.c 5 Mar 2004 07:48:23 -0000 1.2
***************
*** 114,118 ****
surface->texture.texcoord_width =
surface->texture.texcoord_height = 1.0;
! surface->texture.repeatable = surface->texture.repeat = 0;
return surface;
--- 114,119 ----
surface->texture.texcoord_width =
surface->texture.texcoord_height = 1.0;
! surface->texture.repeatable = surface->texture.repeat = 1;
! surface->base.repeat = 0;
return surface;
***************
*** 131,136 ****
--- 132,155 ----
surface->texture.texcoord_height = surface->base.height =
surface->texture.height = height;
+ surface->base.repeat = 0;
}
+ glc_surface_t *
+ glc_solid_create (glc_color_t *color)
+ {
+ glc_programmatic_surface_t *surface;
+
+ surface = _glc_programmatic_surface_create ();
+ if (!surface)
+ return NULL;
+
+ surface->type = GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE;
+ surface->attributes.solid.color = *color;
+ surface->texture.target = 0;
+
+ return &surface->base;
+ }
+ slim_hidden_def(glc_solid_create);
+
/* TODO: support color stops */
glc_surface_t *
***************
*** 150,155 ****
gradient = &surface->attributes.linear_gradient;
! memcpy (&gradient->start, start, sizeof (glc_colorpoint_t));
! memcpy (&gradient->end, end, sizeof (glc_colorpoint_t));
return &surface->base;
--- 169,174 ----
gradient = &surface->attributes.linear_gradient;
! gradient->start = *start;
! gradient->end = *end;
return &surface->base;
***************
*** 173,184 ****
gradient = &surface->attributes.radial_gradient;
! memcpy (&gradient->start, start, sizeof (glc_colorpoint_t));
if (n_stops) {
! memcpy (&gradient->stop, stops, sizeof (glc_colorstop_t));
} else {
gradient->stop.stop = 0;
! memcpy (&gradient->stop.color, &gradient->start.color,
! sizeof (glc_color_t));
}
--- 192,202 ----
gradient = &surface->attributes.radial_gradient;
! gradient->start = *start;
if (n_stops) {
! gradient->stop = *stops;
} else {
gradient->stop.stop = 0;
! gradient->stop.color = gradient->start.color;
}
***************
*** 192,198 ****
glc_programmatic_surface_t *surface)
{
#ifdef GL_ARB_fragment_program
- switch (surface->type) {
case GLC_PROGRAMMATIC_SURFACE_LINEAR_GRADIENT_TYPE: {
glc_linear_gradient_t *gradient = &surface->attributes.linear_gradient;
--- 210,222 ----
glc_programmatic_surface_t *surface)
{
+ switch (surface->type) {
+ case GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE: {
+ glc_solid_t *solid = &surface->attributes.solid;
+
+ glColor4us (solid->color.red, solid->color.green, solid->color.blue,
+ solid->color.alpha);
+ } break;
#ifdef GL_ARB_fragment_program
case GLC_PROGRAMMATIC_SURFACE_LINEAR_GRADIENT_TYPE: {
glc_linear_gradient_t *gradient = &surface->attributes.linear_gradient;
***************
*** 264,269 ****
0.0);
} break;
- }
#endif
}
--- 288,296 ----
0.0);
} break;
#endif
+ default:
+ break;
+ }
+
}
Index: glc_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_surface.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** a/glc_surface.c 26 Feb 2004 10:16:04 -0000 1.19
--- b/glc_surface.c 5 Mar 2004 07:48:23 -0000 1.20
***************
*** 112,123 ****
glc_surface_enable_program (glc_surface_t *surface,
glc_surface_t *src,
glc_texture_t *src_texture,
glc_texture_t *mask_texture)
{
! if (surface->feature_mask & GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
! return
! glc_program_enable (surface, src, src_texture, mask_texture);
!
! return 0;
}
--- 112,120 ----
glc_surface_enable_program (glc_surface_t *surface,
glc_surface_t *src,
+ glc_surface_t *mask,
glc_texture_t *src_texture,
glc_texture_t *mask_texture)
{
! return glc_program_enable (surface, src, mask, src_texture, mask_texture);
}
***************
*** 150,159 ****
if (surface->n_transforms > 1) {
! memcpy (&surface->transforms[surface->n_transforms - 1],
! &surface->transforms[surface->n_transforms - 2],
! sizeof (glc_matrix_t));
} else
! memcpy (&surface->transforms[surface->n_transforms - 1],
! &identity, sizeof (glc_matrix_t));
surface->transform = &surface->transforms[surface->n_transforms - 1];
--- 147,154 ----
if (surface->n_transforms > 1) {
! surface->transforms[surface->n_transforms - 1] =
! surface->transforms[surface->n_transforms - 2];
} else
! surface->transforms[surface->n_transforms - 1] = identity;
surface->transform = &surface->transforms[surface->n_transforms - 1];
***************
*** 401,405 ****
} else {
if (!surface->dirty) {
! memcpy (&surface->dirty_region, region, sizeof (glc_region_box_t));
} else
glc_union_region (region,
--- 396,400 ----
} else {
if (!surface->dirty) {
! surface->dirty_region = *region;
} else
glc_union_region (region,
Index: glc_texture.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_texture.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** a/glc_texture.c 29 Feb 2004 17:37:42 -0000 1.10
--- b/glc_texture.c 5 Mar 2004 07:48:23 -0000 1.11
***************
*** 154,157 ****
--- 154,160 ----
glc_filter_t filter)
{
+ if (!texture->target)
+ return;
+
if (texture->filter != filter) {
switch (filter) {
***************
*** 176,179 ****
--- 179,185 ----
glc_bool_t repeat)
{
+ if (!texture->target)
+ return;
+
if (texture->repeat != repeat) {
if (repeat) {
***************
*** 191,195 ****
glc_texture_bind (glc_texture_t *texture)
{
!
#if defined(GL_EXT_texture_rectangle)
glDisable (GL_TEXTURE_RECTANGLE_EXT);
--- 197,201 ----
glc_texture_bind (glc_texture_t *texture)
{
!
#if defined(GL_EXT_texture_rectangle)
glDisable (GL_TEXTURE_RECTANGLE_EXT);
***************
*** 199,202 ****
--- 205,211 ----
glDisable (GL_TEXTURE_2D);
+
+ if (!texture->target)
+ return;
glEnable (texture->target);
***************
*** 216,222 ****
glc_region_box_t *region)
{
- if (!texture)
- return;
-
glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT);
--- 225,228 ----
Index: glcint.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glcint.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** a/glcint.h 29 Feb 2004 17:37:42 -0000 1.22
--- b/glcint.h 5 Mar 2004 07:48:23 -0000 1.23
***************
*** 124,128 ****
typedef enum {
! GLC_PROGRAMMATIC_SURFACE_LINEAR_GRADIENT_TYPE = 0,
GLC_PROGRAMMATIC_SURFACE_RADIAL_GRADIENT_TYPE
} glc_programmatic_surface_type_t;
--- 124,129 ----
typedef enum {
! GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE = 0,
! GLC_PROGRAMMATIC_SURFACE_LINEAR_GRADIENT_TYPE,
GLC_PROGRAMMATIC_SURFACE_RADIAL_GRADIENT_TYPE
} glc_programmatic_surface_type_t;
***************
*** 141,146 ****
#define GLC_PROGRAM_NOSRC_NOMASK_OFFSET 8
! #define GLC_VERTEX_PROGRAM_TYPES 1
! #define GLC_FRAGMENT_PROGRAM_TYPES 9
#define GLC_FRAGMENT_PROGRAMMATIC_PROGRAM_TYPES \
(GLC_FRAGMENT_PROGRAM_TYPES * GLC_PROGRAMMATIC_SURFACE_NUM)
--- 142,150 ----
#define GLC_PROGRAM_NOSRC_NOMASK_OFFSET 8
! #define GLC_PROGRAM_SRC_OPERATION_OFFSET 0
! #define GLC_PROGRAM_MASK_OPERATION_OFFSET 9
!
! #define GLC_VERTEX_PROGRAM_TYPES 2
! #define GLC_FRAGMENT_PROGRAM_TYPES 18
#define GLC_FRAGMENT_PROGRAMMATIC_PROGRAM_TYPES \
(GLC_FRAGMENT_PROGRAM_TYPES * GLC_PROGRAMMATIC_SURFACE_NUM)
***************
*** 247,250 ****
--- 251,258 ----
};
+ typedef struct _glc_solid_t {
+ glc_color_t color;
+ } glc_solid_t;
+
typedef struct _glc_linear_gradient_t {
glc_colorpoint_t start;
***************
*** 258,261 ****
--- 266,270 ----
typedef union _glc_programmatic_attributes_t {
+ glc_solid_t solid;
glc_linear_gradient_t linear_gradient;
glc_radial_gradient_t radial_gradient;
***************
*** 398,401 ****
--- 407,411 ----
glc_surface_enable_program (glc_surface_t *surface,
glc_surface_t *src,
+ glc_surface_t *mask,
glc_texture_t *src_texture,
glc_texture_t *mask_texture);
***************
*** 442,445 ****
--- 452,456 ----
glc_program_enable (glc_surface_t *dst,
glc_surface_t *src,
+ glc_surface_t *mask,
glc_texture_t *src_texture,
glc_texture_t *mask_texture);
***************
*** 539,542 ****
--- 550,554 ----
slim_hidden_proto(glc_composite_tri_fan)
slim_hidden_proto(glc_color_triangles)
+ slim_hidden_proto(glc_solid_create)
slim_hidden_proto(glc_linear_gradient_create)
slim_hidden_proto(glc_radial_gradient_create)
More information about the cairo-commit
mailing list