[cairo-commit] glitz/src glitz.c, 1.1.1.1, 1.2 glitz.h, 1.2,
1.3 glitz_agl_extension.c, 1.1.1.1, 1.2 glitz_agl_pbuffer.c,
1.1.1.1, 1.2 glitz_agl_surface.c, 1.3, 1.4 glitz_aglint.h,
1.1.1.1, 1.2 glitz_format.c, 1.1.1.1, 1.2 glitz_gl.h, 1.1.1.1,
1.2 glitz_glx_extension.c, 1.2, 1.3 glitz_glx_surface.c, 1.3,
1.4 glitz_glxint.h, 1.2, 1.3 glitz_program.c, 1.2,
1.3 glitz_surface.c, 1.3, 1.4 glitz_texture.c, 1.1.1.1,
1.2 glitz_util.c, 1.1.1.1, 1.2 glitzint.h, 1.4, 1.5
David Reveman
commit at pdx.freedesktop.org
Wed Apr 28 01:59:41 PDT 2004
Committed by: davidr
Update of /cvs/cairo/glitz/src
In directory pdx:/tmp/cvs-serv29171/src
Modified Files:
glitz.c glitz.h glitz_agl_extension.c glitz_agl_pbuffer.c
glitz_agl_surface.c glitz_aglint.h glitz_format.c glitz_gl.h
glitz_glx_extension.c glitz_glx_surface.c glitz_glxint.h
glitz_program.c glitz_surface.c glitz_texture.c glitz_util.c
glitzint.h
Log Message:
Added support for direct compositing with mask surface only using multi-texturing
Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz.c 30 Mar 2004 17:07:18 -0000 1.1.1.1
--- b/glitz.c 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 139,143 ****
gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
GLITZ_GL_TEXTURE_ENV_MODE,
! GLITZ_GL_REPLACE);
if (mask->transform)
--- 139,143 ----
gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
GLITZ_GL_TEXTURE_ENV_MODE,
! GLITZ_GL_MODULATE);
if (mask->transform)
***************
*** 405,408 ****
--- 405,409 ----
glitz_region_box_t clip;
glitz_program_type_t type = 0;
+ glitz_bool_t simple_modulate = 0;
gl = dst->gl;
***************
*** 413,427 ****
height + abs (y_src));
- if (mask && SURFACE_PROGRAMMATIC (mask))
- glitz_programmatic_surface_setup (mask,
- width + abs (x_mask),
- height + abs (y_mask));
-
if (mask) {
glitz_region_box_t mask_bounds;
static glitz_color_t clear_color = { 0x0000, 0x0000, 0x0000, 0x0000 };
glitz_bool_t intermediate_translate;
! if ((dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) &&
_glitz_composite_direct (op,
src, mask, dst,
--- 414,437 ----
height + abs (y_src));
if (mask) {
+ if (SURFACE_PROGRAMMATIC (mask))
+ glitz_programmatic_surface_setup (mask,
+ width + abs (x_mask),
+ height + abs (y_mask));
+
+ if (SURFACE_SOLID (mask) && (!SURFACE_PROGRAMMATIC (src))) {
+ simple_modulate = 1;
+ if ((dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) &&
+ src->convolution)
+ simple_modulate = 0;
+ }
+ }
+
+ if (mask && (!simple_modulate)) {
glitz_region_box_t mask_bounds;
static glitz_color_t clear_color = { 0x0000, 0x0000, 0x0000, 0x0000 };
glitz_bool_t intermediate_translate;
! if ((dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK) &&
_glitz_composite_direct (op,
src, mask, dst,
***************
*** 533,540 ****
glitz_texture_bind (gl, texture);
!
gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
GLITZ_GL_TEXTURE_ENV_MODE,
! GLITZ_GL_REPLACE);
clip.x1 = x_dst;
--- 543,566 ----
glitz_texture_bind (gl, texture);
!
gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
GLITZ_GL_TEXTURE_ENV_MODE,
! (simple_modulate)? GLITZ_GL_MODULATE: GLITZ_GL_REPLACE);
!
! if (simple_modulate) {
! glitz_programmatic_surface_t *m = (glitz_programmatic_surface_t *) mask;
!
! gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
! GLITZ_GL_TEXTURE_ENV_MODE,
! GLITZ_GL_MODULATE);
! gl->color_4us (m->u.solid.color.alpha,
! m->u.solid.color.alpha,
! m->u.solid.color.alpha,
! m->u.solid.color.alpha);
! } else {
! gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
! GLITZ_GL_TEXTURE_ENV_MODE,
! GLITZ_GL_REPLACE);
! }
clip.x1 = x_dst;
Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz.h 3 Apr 2004 17:53:54 -0000 1.2
--- b/glitz.h 28 Apr 2004 08:59:38 -0000 1.3
***************
*** 1,2 ****
--- 1,3 ----
+
/*
* Copyright © 2004 David Reveman, Peter Nilsson
***************
*** 143,148 ****
#define GLITZ_FEATURE_MULTISAMPLE_MASK (1L << 5)
#define GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK (1L << 6)
! #define GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK (1L << 7)
! #define GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK (1L << 8)
typedef enum {
--- 144,150 ----
#define GLITZ_FEATURE_MULTISAMPLE_MASK (1L << 5)
#define GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK (1L << 6)
! #define GLITZ_FEATURE_ARB_MULTITEXTURE_MASK (1L << 7)
! #define GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK (1L << 8)
! #define GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK (1L << 9)
typedef enum {
Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_agl_extension.c 30 Mar 2004 17:07:18 -0000 1.1.1.1
--- b/glitz_agl_extension.c 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 42,45 ****
--- 42,46 ----
{ "GL_NV_multisample_filter_hint",
GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_MASK },
+ { "GL_ARB_multitexture", GLITZ_AGL_FEATURE_ARB_MULTITEXTURE_MASK },
{ "GL_ARB_vertex_program", GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK },
{ "GL_ARB_fragment_program", GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK },
***************
*** 96,108 ****
if (thread_info->agl_feature_mask &
! GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK)
! thread_info->feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
!
! if (thread_info->agl_feature_mask &
! GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
! thread_info->feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! if ((thread_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
! (thread_info->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK))
! thread_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
}
--- 97,114 ----
if (thread_info->agl_feature_mask &
! GLITZ_AGL_FEATURE_ARB_MULTITEXTURE_MASK) {
! thread_info->feature_mask |= GLITZ_FEATURE_ARB_MULTITEXTURE_MASK;
!
! if (thread_info->agl_feature_mask &
! GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK)
! thread_info->feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
!
! if (thread_info->agl_feature_mask &
! GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
! thread_info->feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! if ((thread_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
! (thread_info->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK))
! thread_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
! }
}
Index: glitz_agl_pbuffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_pbuffer.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_agl_pbuffer.c 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_agl_pbuffer.c 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 40,44 ****
aglCreatePBuffer (texture->width, texture->height,
! texture->target, GL_RGBA, 0, &pbuffer);
return pbuffer;
--- 40,44 ----
aglCreatePBuffer (texture->width, texture->height,
! texture->target, texture->internal_format, 0, &pbuffer);
return pbuffer;
Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_agl_surface.c 24 Apr 2004 22:10:22 -0000 1.3
--- b/glitz_agl_surface.c 28 Apr 2004 08:59:38 -0000 1.4
***************
*** 58,65 ****
{
glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT &&
! ((!surface->pbuffer) && (!surface->drawable)))
constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
surface = glitz_agl_context_push_current (surface, constraint);
--- 58,68 ----
{
glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
+ glitz_bool_t success = 1;
if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT &&
! ((!surface->pbuffer) && (!surface->drawable))) {
constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
+ success = 0;
+ }
surface = glitz_agl_context_push_current (surface, constraint);
***************
*** 70,77 ****
}
! if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT)
! return 0;
! else
! return 1;
}
--- 73,77 ----
}
! return success;
}
***************
*** 308,319 ****
glitz_format_t *format;
! format = glitz_format_find_sufficient_standard
! (templ->base.format, 1, GLITZ_FORMAT_OPTION_OFFSCREEN_MASK, format_name);
!
! if (!format)
! format = glitz_format_find_standard (templ->thread_info->formats,
! templ->thread_info->n_formats,
! GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
! format_name);
if (format)
--- 308,315 ----
glitz_format_t *format;
! format = glitz_format_find_standard (templ->thread_info->formats,
! templ->thread_info->n_formats,
! GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
! format_name);
if (format)
Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_aglint.h 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_aglint.h 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 43,48 ****
#define GLITZ_AGL_FEATURE_MULTISAMPLE_MASK (1L << 4)
#define GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_MASK (1L << 5)
! #define GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK (1L << 6)
! #define GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK (1L << 7)
typedef struct _glitz_agl_surface_t glitz_agl_surface_t;
--- 43,49 ----
#define GLITZ_AGL_FEATURE_MULTISAMPLE_MASK (1L << 4)
#define GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_MASK (1L << 5)
! #define GLITZ_AGL_FEATURE_ARB_MULTITEXTURE_MASK (1L << 6)
! #define GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK (1L << 7)
! #define GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK (1L << 8)
typedef struct _glitz_agl_surface_t glitz_agl_surface_t;
Index: glitz_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_format.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_format.c 30 Mar 2004 17:07:18 -0000 1.1.1.1
--- b/glitz_format.c 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 161,166 ****
{
glitz_format_t templ;
! unsigned long mask = GLITZ_FORMAT_RED_SIZE_MASK | GLITZ_FORMAT_GREEN_SIZE_MASK |
! GLITZ_FORMAT_BLUE_SIZE_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK;
switch (format_name) {
--- 161,167 ----
{
glitz_format_t templ;
! unsigned long mask = GLITZ_FORMAT_RED_SIZE_MASK |
! GLITZ_FORMAT_GREEN_SIZE_MASK | GLITZ_FORMAT_BLUE_SIZE_MASK |
! GLITZ_FORMAT_ALPHA_SIZE_MASK;
switch (format_name) {
***************
*** 196,239 ****
}
- glitz_format_t *
- glitz_format_find_sufficient_standard (glitz_format_t *formats,
- int n_formats,
- unsigned long options,
- glitz_format_name_t format_name)
- {
- glitz_format_t templ;
- unsigned long mask;
-
- switch (format_name) {
- case GLITZ_STANDARD_ARGB32:
- mask = GLITZ_FORMAT_RED_SIZE_MASK | GLITZ_FORMAT_GREEN_SIZE_MASK |
- GLITZ_FORMAT_BLUE_SIZE_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK;
- templ.red_size = 8;
- templ.green_size = 8;
- templ.blue_size = 8;
- templ.alpha_size = 8;
- break;
- case GLITZ_STANDARD_RGB24:
- mask = GLITZ_FORMAT_RED_SIZE_MASK | GLITZ_FORMAT_GREEN_SIZE_MASK |
- GLITZ_FORMAT_BLUE_SIZE_MASK;
- templ.red_size = 8;
- templ.green_size = 8;
- templ.blue_size = 8;
- break;
- case GLITZ_STANDARD_A8:
- mask = GLITZ_FORMAT_ALPHA_SIZE_MASK;
- templ.alpha_size = 8;
- break;
- case GLITZ_STANDARD_A1:
- mask = GLITZ_FORMAT_ALPHA_SIZE_MASK;
- templ.alpha_size = 1;
- break;
- }
-
- _glitz_format_add_options (options, &templ, &mask);
-
- return glitz_format_find (formats, n_formats, mask, &templ, 0);
- }
-
void
glitz_format_calculate_pixel_transfer_info (glitz_format_t *format)
--- 197,200 ----
Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_gl.h 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_gl.h 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 73,76 ****
--- 73,77 ----
#define GLITZ_GL_TEXTURE_MAG_FILTER 0x2800
#define GLITZ_GL_TEXTURE_MIN_FILTER 0x2801
+ #define GLITZ_GL_MODULATE 0x2100
#define GLITZ_GL_NEAREST 0x2600
#define GLITZ_GL_LINEAR 0x2601
***************
*** 93,103 ****
#define GLITZ_GL_COLOR_BUFFER_BIT 0x00004000
! #define GLITZ_GL_ALPHA 0x1906
! #define GLITZ_GL_RGB 0x1907
! #define GLITZ_GL_COLOR 0x1800
! #define GLITZ_GL_DITHER 0x0BD0
! #define GLITZ_GL_RGBA 0x1908
! #define GLITZ_GL_BGR 0x80E0
! #define GLITZ_GL_BGRA 0x80E1
#define GLITZ_GL_FRONT_AND_BACK 0x0408
--- 94,105 ----
#define GLITZ_GL_COLOR_BUFFER_BIT 0x00004000
! #define GLITZ_GL_ALPHA 0x1906
! #define GLITZ_GL_RGB 0x1907
! #define GLITZ_GL_LUMINANCE_ALPHA 0x190A
! #define GLITZ_GL_COLOR 0x1800
! #define GLITZ_GL_DITHER 0x0BD0
! #define GLITZ_GL_RGBA 0x1908
! #define GLITZ_GL_BGR 0x80E0
! #define GLITZ_GL_BGRA 0x80E1
#define GLITZ_GL_FRONT_AND_BACK 0x0408
Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_glx_extension.c 3 Apr 2004 17:53:54 -0000 1.2
--- b/glitz_glx_extension.c 28 Apr 2004 08:59:38 -0000 1.3
***************
*** 49,52 ****
--- 49,53 ----
{ "GL_NV_multisample_filter_hint",
GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_MASK },
+ { "GL_ARB_multitexture", GLITZ_GLX_FEATURE_ARB_MULTITEXTURE_MASK },
{ "GL_ARB_vertex_program", GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK },
{ "GL_ARB_fragment_program", GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK },
***************
*** 127,144 ****
if (screen_info->glx_feature_mask &
! GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK) {
! screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK;
! screen_info->feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
! }
! if (screen_info->glx_feature_mask &
! GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
! screen_info->glx_feature_mask |=
! GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! screen_info->feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
! }
! if ((screen_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
! (screen_info->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK))
! screen_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
}
--- 128,145 ----
if (screen_info->glx_feature_mask &
! GLITZ_GLX_FEATURE_ARB_MULTITEXTURE_MASK) {
! screen_info->feature_mask |= GLITZ_FEATURE_ARB_MULTITEXTURE_MASK;
! if (screen_info->glx_feature_mask &
! GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK)
! screen_info->feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
! if (screen_info->glx_feature_mask &
! GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
! screen_info->feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
!
! if ((screen_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
! (screen_info->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK))
! screen_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
! }
}
Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_glx_surface.c 24 Apr 2004 22:10:22 -0000 1.3
--- b/glitz_glx_surface.c 28 Apr 2004 08:59:38 -0000 1.4
***************
*** 56,62 ****
{
glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
! if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT && (!surface->drawable))
constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
surface = glitz_glx_context_push_current (surface, constraint);
--- 56,66 ----
{
glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
+ glitz_bool_t success = 1;
! if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT &&
! (!surface->drawable)) {
constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
+ success = 0;
+ }
surface = glitz_glx_context_push_current (surface, constraint);
***************
*** 67,74 ****
}
! if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT)
! return 0;
! else
! return 1;
}
--- 71,75 ----
}
! return success;
}
***************
*** 336,347 ****
glitz_format_t *format;
! format = glitz_format_find_sufficient_standard
! (templ->base.format, 1, GLITZ_FORMAT_OPTION_OFFSCREEN_MASK, format_name);
!
! if (!format)
! format = glitz_format_find_standard (templ->screen_info->formats,
! templ->screen_info->n_formats,
! GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
! format_name);
if (format)
return _glitz_glx_surface_create (templ->screen_info, format,
--- 337,344 ----
glitz_format_t *format;
! format = glitz_format_find_standard (templ->screen_info->formats,
! templ->screen_info->n_formats,
! GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
! format_name);
if (format)
return _glitz_glx_surface_create (templ->screen_info, format,
Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_glxint.h 3 Apr 2004 17:53:54 -0000 1.2
--- b/glitz_glxint.h 28 Apr 2004 08:59:38 -0000 1.3
***************
*** 38,51 ****
#include "glitz_glxext.h"
! #define GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK (1L << 0)
! #define GLITZ_GLX_FEATURE_TEXTURE_NPOT_MASK (1L << 1)
! #define GLITZ_GLX_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK (1L << 2)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_MASK (1L << 3)
! #define GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK (1L << 4)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_MASK (1L << 5)
! #define GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK (1L << 6)
! #define GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK (1L << 7)
! #define GLITZ_GLX_FEATURE_GLX13_MASK (1L << 8)
! #define GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK (1L << 9)
typedef struct _glitz_glx_surface glitz_glx_surface_t;
--- 38,52 ----
#include "glitz_glxext.h"
! #define GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK (1L << 0)
! #define GLITZ_GLX_FEATURE_TEXTURE_NPOT_MASK (1L << 1)
! #define GLITZ_GLX_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK (1L << 2)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_MASK (1L << 3)
! #define GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK (1L << 4)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_MASK (1L << 5)
! #define GLITZ_GLX_FEATURE_ARB_MULTITEXTURE_MASK (1L << 6)
! #define GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK (1L << 7)
! #define GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK (1L << 8)
! #define GLITZ_GLX_FEATURE_GLX13_MASK (1L << 9)
! #define GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK (1L << 10)
typedef struct _glitz_glx_surface glitz_glx_surface_t;
Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_program.c 24 Apr 2004 22:10:22 -0000 1.2
--- b/glitz_program.c 28 Apr 2004 08:59:38 -0000 1.3
***************
*** 518,522 ****
glitz_texture_t *mask_texture)
{
! int offset = _glitz_program_offset (src_texture, mask_texture);
if (!programs->fragment_simple[offset])
--- 518,528 ----
glitz_texture_t *mask_texture)
{
! int offset;
!
! /* This is done without fragment program */
! if (mask_texture->internal_format == GLITZ_GL_LUMINANCE_ALPHA)
! return;
!
! offset = _glitz_program_offset (src_texture, mask_texture);
if (!programs->fragment_simple[offset])
***************
*** 643,646 ****
--- 649,662 ----
}
+ /* no fragment proram needed for solid programmatic surface and
+ mask in lumniance alpha texture format */
+ if (dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK) {
+ if ((surface->type == GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) &&
+ (mask_texture->internal_format == GLITZ_GL_LUMINANCE_ALPHA)) {
+ glitz_programmatic_surface_bind (dst->gl, surface, dst->feature_mask);
+ return;
+ }
+ }
+
if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
if (!programs->fragment_programmatic[type_offset])
***************
*** 663,672 ****
glitz_surface_t *mask)
{
! glitz_program_type_t type = GLITZ_PROGRAM_TYPE_NONE;
if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
! if (dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK)
!
if (src->convolution) {
if (mask && SURFACE_PROGRAMMATIC (mask) &&
--- 679,687 ----
glitz_surface_t *mask)
{
! glitz_program_type_t type = GLITZ_PROGRAM_TYPE_NOT_SUPPORTED;
if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
! if (dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) {
if (src->convolution) {
if (mask && SURFACE_PROGRAMMATIC (mask) &&
***************
*** 685,702 ****
}
! if (mask && mask->convolution) {
! if (SURFACE_PROGRAMMATIC (src) &&
! ((glitz_programmatic_surface_t *) src)->type ==
! GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
! if (dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) {
! type = GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION_AND_SOLID_SRC;
! goto OK2;
! } else {
! type = GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC;
! goto OK1;
}
}
- type = GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION;
- goto OK1;
}
--- 700,718 ----
}
! if (mask && mask->convolution) {
! if (SURFACE_PROGRAMMATIC (src) &&
! ((glitz_programmatic_surface_t *) src)->type ==
! GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
! if (dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) {
! type = GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION_AND_SOLID_SRC;
! goto OK2;
! } else {
! type = GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC;
! goto OK1;
! }
}
+ type = GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION;
+ goto OK1;
}
}
***************
*** 709,731 ****
type = GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC;
goto OK1;
! }
}
!
! if (SURFACE_PROGRAMMATIC (src) &&
! ((glitz_programmatic_surface_t *) src)->type ==
! GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
type = GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC;
goto OK1;
}
!
! if (mask && SURFACE_PROGRAMMATIC (mask) &&
! ((glitz_programmatic_surface_t *) mask)->type ==
! GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
type = GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC;
goto OK1;
}
! if (mask && (!SURFACE_PROGRAMMATIC (mask)))
! type = GLITZ_PROGRAM_TYPE_SIMPLE;
OK1:
--- 725,750 ----
type = GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC;
goto OK1;
! }
}
!
! if (SURFACE_SOLID (src)) {
type = GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC;
goto OK1;
}
!
! if (mask && SURFACE_SOLID (mask)) {
type = GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC;
goto OK1;
}
! if (mask && (!SURFACE_PROGRAMMATIC (mask))) {
! if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
! type = GLITZ_PROGRAM_TYPE_SIMPLE;
! } else if ((mask->texture->internal_format == GLITZ_GL_LUMINANCE_ALPHA) &&
! (dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK)) {
! type = GLITZ_PROGRAM_TYPE_SIMPLE;
! } else
! type = GLITZ_PROGRAM_TYPE_NOT_SUPPORTED;
! }
OK1:
***************
*** 768,772 ****
break;
case GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC:
! glitz_program_enable_programmatic (dst, (glitz_programmatic_surface_t *) src,
src_texture, mask_texture,
GLITZ_PROGRAM_SRC_OPERATION_OFFSET);
--- 787,792 ----
break;
case GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC:
! glitz_program_enable_programmatic (dst,
! (glitz_programmatic_surface_t *) src,
src_texture, mask_texture,
GLITZ_PROGRAM_SRC_OPERATION_OFFSET);
Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_surface.c 6 Apr 2004 16:28:03 -0000 1.3
--- b/glitz_surface.c 28 Apr 2004 08:59:38 -0000 1.4
***************
*** 131,134 ****
--- 131,144 ----
}
+ static glitz_bool_t
+ _glitz_surface_try_push_current (glitz_surface_t *surface,
+ glitz_constraint_t constraint)
+ {
+ if (!surface->backend->push_current (surface, constraint))
+ return 0;
+
+ return 1;
+ }
+
void
glitz_surface_pop_current (glitz_surface_t *surface)
***************
*** 518,524 ****
char *pixels)
{
! unsigned char *pixel_buf;
int rowstride, area_rowstride, bytes_per_pixel;
- unsigned int i;
glitz_gl_enum_t format, type;
--- 528,533 ----
char *pixels)
{
! unsigned char *pixel_buf = NULL;
int rowstride, area_rowstride, bytes_per_pixel;
glitz_gl_enum_t format, type;
***************
*** 539,549 ****
copy the part we want, not very efficient. We only want to read the
area requested. I think it can be fixed with glPixelStore parameters. */
! if (glitz_surface_push_current (surface,
! GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
! rowstride = surface->width * bytes_per_pixel;
! rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
! pixel_buf = (unsigned char *) malloc (surface->height * rowstride);
!
surface->gl->read_pixels (0, 0, surface->width, surface->height,
format, type, pixel_buf);
--- 548,561 ----
copy the part we want, not very efficient. We only want to read the
area requested. I think it can be fixed with glPixelStore parameters. */
+ if (_glitz_surface_try_push_current (surface,
+ GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
! if (format == GLITZ_GL_LUMINANCE_ALPHA)
! rowstride = surface->width * 2;
! else
! rowstride = surface->width * bytes_per_pixel;
!
! rowstride = (rowstride + 3) & -4;
! pixel_buf = malloc (surface->height * rowstride);
surface->gl->read_pixels (0, 0, surface->width, surface->height,
format, type, pixel_buf);
***************
*** 554,560 ****
glitz_texture_bind (surface->gl, texture);
! rowstride = texture->width * bytes_per_pixel;
! rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
! pixel_buf = (unsigned char *) malloc (texture->height * rowstride);
surface->gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
--- 566,576 ----
glitz_texture_bind (surface->gl, texture);
! if (format == GLITZ_GL_LUMINANCE_ALPHA) {
! rowstride = texture->width * 2;
! } else
! rowstride = texture->width * bytes_per_pixel;
!
! rowstride = (rowstride + 3) & -4;
! pixel_buf = malloc (texture->height * rowstride);
surface->gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
***************
*** 572,585 ****
glitz_surface_pop_current (surface);
! area_rowstride = width * bytes_per_pixel;
! area_rowstride += (area_rowstride % 4)? (4 - (area_rowstride % 4)): 0;
! for (i = 0; i < height; i++) {
! memcpy (&pixels[(height - i - 1) * area_rowstride],
! &pixel_buf[(surface->height - y - height + i) * rowstride + x],
! area_rowstride);
}
!
! free (pixel_buf);
}
slim_hidden_def(glitz_surface_read_pixels);
--- 588,616 ----
glitz_surface_pop_current (surface);
! area_rowstride = (width * bytes_per_pixel + 3) & -4;
! if (format == GLITZ_GL_LUMINANCE_ALPHA) {
! int i, j, k;
!
! /* Unpad and flip A8 image data. */
! for (i = 0; i < (int) height; i++) {
! for (j = 0, k = 1; j < (int) width; j++, k += 2) {
! pixels[(height - i - 1) * area_rowstride + j] =
! pixel_buf[(surface->height - y - height + i) * rowstride + x + k];
! }
! }
! } else {
! int i;
!
! /* Flip image data. */
! for (i = 0; i < (int) height; i++) {
! memcpy (&pixels[(height - i - 1) * area_rowstride],
! &pixel_buf[(surface->height - y - height + i) * rowstride + x],
! area_rowstride);
! }
}
!
! if (pixel_buf)
! free (pixel_buf);
}
slim_hidden_def(glitz_surface_read_pixels);
***************
*** 593,599 ****
char *pixels)
{
! unsigned char *pixel_buf;
glitz_gl_enum_t format, type;
int bytes_per_pixel;
if (SURFACE_PROGRAMMATIC (surface))
--- 624,631 ----
char *pixels)
{
! unsigned char *pixel_buf = NULL;
glitz_gl_enum_t format, type;
int bytes_per_pixel;
+ glitz_bool_t drawable = 0;
if (SURFACE_PROGRAMMATIC (surface))
***************
*** 610,615 ****
type = glitz_get_gl_data_type_from_bpp (surface->format->bpp);
! if (glitz_surface_push_current (surface,
! GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
glitz_region_box_t bounds;
--- 642,680 ----
type = glitz_get_gl_data_type_from_bpp (surface->format->bpp);
! drawable =
! _glitz_surface_try_push_current (surface,
! GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
!
! if (format == GLITZ_GL_LUMINANCE_ALPHA) {
! int i, j, k, src_rowstride, dst_rowstride;
!
! src_rowstride = (width + 3) & -4;
! dst_rowstride = (width * 2 + 3) & -4;
! pixel_buf = malloc (dst_rowstride * height);
!
! /* Pad and flip A8 image data. */
! for (i = 0; i < (int) height; i++) {
! for (j = 0, k = 0; j < (int) width; j++, k += 2) {
! pixel_buf[i * dst_rowstride + k] =
! pixel_buf[i * dst_rowstride + k + 1] =
! pixels[(height - i - 1) * src_rowstride + j];
! }
! }
! pixels = pixel_buf;
! } else if (!drawable) {
! int i, rowstride;
!
! rowstride = (width * bytes_per_pixel + 3) & -4;
! pixel_buf = malloc (rowstride * height);
!
! /* Flip image data. */
! for (i = 0; i < (int) height; i++)
! memcpy (&pixel_buf[i * rowstride],
! &pixels[(height - i - 1) * rowstride], rowstride);
!
! pixels = pixel_buf;
! }
!
! if (drawable) {
glitz_region_box_t bounds;
***************
*** 622,646 ****
surface->gl->disable (GLITZ_GL_DITHER);
glitz_set_operator (surface->gl, GLITZ_OPERATOR_SRC);
- surface->gl->pixel_zoom (1.0, -1.0);
-
- _glitz_set_raster_pos (surface->gl, x, surface->height - y);
surface->gl->draw_pixels (width, height, format, type, pixels);
glitz_surface_dirty (surface, &bounds);
} else {
- int i, rowstride;
glitz_texture_t *texture;
-
- rowstride = width * bytes_per_pixel;
- rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
- pixel_buf = (unsigned char *) malloc (rowstride * height);
-
- /* TODO: This is very ugly and I like to remove it as soon as possible.
- Needs some changes to texture handling, as images will become upside
- down without it. */
- for (i = 0; i < (int) height; i++)
- memcpy (&pixel_buf[i * rowstride],
- &pixels[(height - i - 1) * rowstride], rowstride);
texture = glitz_surface_get_texture (surface);
--- 687,704 ----
surface->gl->disable (GLITZ_GL_DITHER);
glitz_set_operator (surface->gl, GLITZ_OPERATOR_SRC);
+
+ if (format == GLITZ_GL_LUMINANCE_ALPHA) {
+ surface->gl->pixel_zoom (1.0, 1.0);
+ _glitz_set_raster_pos (surface->gl, x, surface->height - y - height);
+ } else {
+ surface->gl->pixel_zoom (1.0, -1.0);
+ _glitz_set_raster_pos (surface->gl, x, surface->height - y);
+ }
surface->gl->draw_pixels (width, height, format, type, pixels);
glitz_surface_dirty (surface, &bounds);
} else {
glitz_texture_t *texture;
texture = glitz_surface_get_texture (surface);
***************
*** 650,654 ****
surface->gl->pixel_store_i (GLITZ_GL_PACK_SKIP_ROWS, 0);
surface->gl->pixel_store_i (GLITZ_GL_PACK_SKIP_PIXELS, 0);
!
surface->gl->tex_sub_image_2d (texture->target, 0,
x, surface->height - y - height,
--- 708,712 ----
surface->gl->pixel_store_i (GLITZ_GL_PACK_SKIP_ROWS, 0);
surface->gl->pixel_store_i (GLITZ_GL_PACK_SKIP_PIXELS, 0);
!
surface->gl->tex_sub_image_2d (texture->target, 0,
x, surface->height - y - height,
***************
*** 659,667 ****
glitz_texture_unbind (surface->gl, texture);
-
- free (pixel_buf);
}
glitz_surface_pop_current (surface);
}
slim_hidden_def(glitz_surface_draw_pixels);
--- 717,726 ----
glitz_texture_unbind (surface->gl, texture);
}
glitz_surface_pop_current (surface);
+
+ if (pixel_buf)
+ free (pixel_buf);
}
slim_hidden_def(glitz_surface_draw_pixels);
***************
*** 709,714 ****
glitz_surface_gl_begin (glitz_surface_t *surface)
{
! if (!glitz_surface_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT))
! glitz_surface_status_add (surface, GLITZ_STATUS_NOT_SUPPORTED_MASK);
}
slim_hidden_def(glitz_surface_gl_begin);
--- 768,772 ----
glitz_surface_gl_begin (glitz_surface_t *surface)
{
! glitz_surface_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
}
slim_hidden_def(glitz_surface_gl_begin);
Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_texture.c 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_texture.c 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 67,70 ****
--- 67,79 ----
texture->allocated = 0;
+ switch (texture->format) {
+ case GLITZ_GL_LUMINANCE_ALPHA:
+ texture->internal_format = GLITZ_GL_LUMINANCE_ALPHA;
+ break;
+ default:
+ texture->internal_format = GLITZ_GL_RGBA;
+ break;
+ }
+
if (!(target_mask & GLITZ_TEXTURE_TARGET_NPOT_MASK)) {
_glitz_texture_find_best_target (width, height,
***************
*** 107,111 ****
glitz_texture_bind (gl, texture);
! gl->tex_image_2d (texture->target, 0, GLITZ_GL_RGBA,
texture->width, texture->height,
0, texture->format, GLITZ_GL_UNSIGNED_BYTE, NULL);
--- 116,121 ----
glitz_texture_bind (gl, texture);
! gl->tex_image_2d (texture->target, 0,
! texture->internal_format,
texture->width, texture->height,
0, texture->format, GLITZ_GL_UNSIGNED_BYTE, NULL);
Index: glitz_util.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_util.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_util.c 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_util.c 28 Apr 2004 08:59:38 -0000 1.2
***************
*** 109,113 ****
switch (bpp) {
case 8:
! return GLITZ_GL_ALPHA;
break;
case 24:
--- 109,113 ----
switch (bpp) {
case 8:
! return GLITZ_GL_LUMINANCE_ALPHA;
break;
case 24:
Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitzint.h 6 Apr 2004 16:28:03 -0000 1.4
--- b/glitzint.h 28 Apr 2004 08:59:38 -0000 1.5
***************
*** 223,228 ****
typedef struct _glitz_texture {
glitz_gl_uint_t name;
! unsigned int target;
! unsigned int format;
glitz_bool_t allocated;
--- 223,229 ----
typedef struct _glitz_texture {
glitz_gl_uint_t name;
! glitz_gl_enum_t target;
! glitz_gl_enum_t format;
! glitz_gl_enum_t internal_format;
glitz_bool_t allocated;
***************
*** 275,278 ****
--- 276,284 ----
(surface->hint_mask & GLITZ_HINT_PROGRAMMATIC_MASK)
+ #define SURFACE_SOLID(surface) \
+ ((surface->hint_mask & GLITZ_HINT_PROGRAMMATIC_MASK) && \
+ ((glitz_programmatic_surface_t *) surface)->type == \
+ GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE)
+
#define SURFACE_REPEAT(surface) \
(surface->hint_mask & GLITZ_INT_HINT_REPEAT_MASK)
***************
*** 568,577 ****
glitz_format_name_t format_name);
- glitz_format_t *
- glitz_format_find_sufficient_standard (glitz_format_t *formats,
- int n_formats,
- unsigned long options,
- glitz_format_name_t format_name);
-
void
glitz_format_calculate_pixel_transfer_info (glitz_format_t *format);
--- 574,577 ----
More information about the cairo-commit
mailing list