$NetBSD$ --- src/cairo-gl-composite.c.orig 2010-10-05 08:03:35.934882001 +0000 +++ src/cairo-gl-composite.c @@ -76,7 +76,7 @@ _cairo_gl_pattern_texture_setup (cairo_g cairo_matrix_t m; cairo_gl_surface_t *surface; cairo_surface_attributes_t *attributes; - attributes = &operand->texture.attributes; + attributes = &operand->A.texture.attributes; status = _cairo_pattern_acquire_surface (src, &dst->base, src_x, src_y, @@ -102,8 +102,8 @@ _cairo_gl_pattern_texture_setup (cairo_g assert (_cairo_gl_surface_is_texture (surface)); operand->type = CAIRO_GL_OPERAND_TEXTURE; - operand->texture.surface = surface; - operand->texture.tex = surface->tex; + operand->A.texture.surface = surface; + operand->A.texture.tex = surface->tex; /* Translate the matrix from * (unnormalized src -> unnormalized src) to * (unnormalized dst -> unnormalized src) @@ -141,10 +141,10 @@ _cairo_gl_solid_operand_init (cairo_gl_o const cairo_color_t *color) { operand->type = CAIRO_GL_OPERAND_CONSTANT; - operand->constant.color[0] = color->red * color->alpha; - operand->constant.color[1] = color->green * color->alpha; - operand->constant.color[2] = color->blue * color->alpha; - operand->constant.color[3] = color->alpha; + operand->A.constant.color[0] = color->red * color->alpha; + operand->A.constant.color[1] = color->green * color->alpha; + operand->A.constant.color[2] = color->blue * color->alpha; + operand->A.constant.color[3] = color->alpha; return CAIRO_STATUS_SUCCESS; } @@ -170,24 +170,24 @@ _cairo_gl_gradient_operand_init (cairo_g status = _cairo_gl_create_gradient_texture (dst, gradient, - &operand->linear.gradient); + &operand->A.linear.gradient); if (unlikely (status)) return status; /* Translation matrix from the destination fragment coordinates * (pixels from lower left = 0,0) to the coordinates in the */ - cairo_matrix_init_translate (&operand->linear.m, -x0, -y0); - cairo_matrix_multiply (&operand->linear.m, + cairo_matrix_init_translate (&operand->A.linear.m, -x0, -y0); + cairo_matrix_multiply (&operand->A.linear.m, &pattern->matrix, - &operand->linear.m); - cairo_matrix_translate (&operand->linear.m, 0, dst->height); - cairo_matrix_scale (&operand->linear.m, 1.0, -1.0); + &operand->A.linear.m); + cairo_matrix_translate (&operand->A.linear.m, 0, dst->height); + cairo_matrix_scale (&operand->A.linear.m, 1.0, -1.0); - operand->linear.segment_x = x1 - x0; - operand->linear.segment_y = y1 - y0; + operand->A.linear.segment_x = x1 - x0; + operand->A.linear.segment_y = y1 - y0; - operand->linear.extend = pattern->extend; + operand->A.linear.extend = pattern->extend; operand->type = CAIRO_GL_OPERAND_LINEAR_GRADIENT; return CAIRO_STATUS_SUCCESS; @@ -204,26 +204,26 @@ _cairo_gl_gradient_operand_init (cairo_g status = _cairo_gl_create_gradient_texture (dst, gradient, - &operand->radial.gradient); + &operand->A.radial.gradient); if (unlikely (status)) return status; /* Translation matrix from the destination fragment coordinates * (pixels from lower left = 0,0) to the coordinates in the */ - cairo_matrix_init_translate (&operand->radial.m, -x0, -y0); - cairo_matrix_multiply (&operand->radial.m, + cairo_matrix_init_translate (&operand->A.radial.m, -x0, -y0); + cairo_matrix_multiply (&operand->A.radial.m, &pattern->matrix, - &operand->radial.m); - cairo_matrix_translate (&operand->radial.m, 0, dst->height); - cairo_matrix_scale (&operand->radial.m, 1.0, -1.0); - - operand->radial.circle_1_x = x1 - x0; - operand->radial.circle_1_y = y1 - y0; - operand->radial.radius_0 = r0; - operand->radial.radius_1 = r1; + &operand->A.radial.m); + cairo_matrix_translate (&operand->A.radial.m, 0, dst->height); + cairo_matrix_scale (&operand->A.radial.m, 1.0, -1.0); + + operand->A.radial.circle_1_x = x1 - x0; + operand->A.radial.circle_1_y = y1 - y0; + operand->A.radial.radius_0 = r0; + operand->A.radial.radius_1 = r1; - operand->radial.extend = pattern->extend; + operand->A.radial.extend = pattern->extend; operand->type = CAIRO_GL_OPERAND_RADIAL_GRADIENT; return CAIRO_STATUS_SUCCESS; @@ -239,15 +239,15 @@ _cairo_gl_operand_destroy (cairo_gl_oper case CAIRO_GL_OPERAND_CONSTANT: break; case CAIRO_GL_OPERAND_LINEAR_GRADIENT: - _cairo_gl_gradient_destroy (operand->linear.gradient); + _cairo_gl_gradient_destroy (operand->A.linear.gradient); break; case CAIRO_GL_OPERAND_RADIAL_GRADIENT: - _cairo_gl_gradient_destroy (operand->radial.gradient); + _cairo_gl_gradient_destroy (operand->A.radial.gradient); break; case CAIRO_GL_OPERAND_TEXTURE: _cairo_pattern_release_surface (NULL, /* XXX */ - &operand->texture.surface->base, - &operand->texture.attributes); + &operand->A.texture.surface->base, + &operand->A.texture.attributes); break; default: case CAIRO_GL_OPERAND_COUNT: @@ -362,21 +362,21 @@ _cairo_gl_operand_bind_to_shader (cairo_ strcpy (custom_part, "_constant"); _cairo_gl_shader_bind_vec4 (ctx, uniform_name, - operand->constant.color[0], - operand->constant.color[1], - operand->constant.color[2], - operand->constant.color[3]); + operand->A.constant.color[0], + operand->A.constant.color[1], + operand->A.constant.color[2], + operand->A.constant.color[3]); break; case CAIRO_GL_OPERAND_LINEAR_GRADIENT: strcpy (custom_part, "_matrix"); _cairo_gl_shader_bind_matrix (ctx, uniform_name, - &operand->linear.m); + &operand->A.linear.m); strcpy (custom_part, "_segment"); _cairo_gl_shader_bind_vec2 (ctx, uniform_name, - operand->linear.segment_x, - operand->linear.segment_y); + operand->A.linear.segment_x, + operand->A.linear.segment_y); strcpy (custom_part, "_sampler"); _cairo_gl_shader_bind_texture(ctx, uniform_name, @@ -386,20 +386,20 @@ _cairo_gl_operand_bind_to_shader (cairo_ strcpy (custom_part, "_matrix"); _cairo_gl_shader_bind_matrix (ctx, uniform_name, - &operand->radial.m); + &operand->A.radial.m); strcpy (custom_part, "_circle_1"); _cairo_gl_shader_bind_vec2 (ctx, uniform_name, - operand->radial.circle_1_x, - operand->radial.circle_1_y); + operand->A.radial.circle_1_x, + operand->A.radial.circle_1_y); strcpy (custom_part, "_radius_0"); _cairo_gl_shader_bind_float (ctx, uniform_name, - operand->radial.radius_0); + operand->A.radial.radius_0); strcpy (custom_part, "_radius_1"); _cairo_gl_shader_bind_float (ctx, uniform_name, - operand->radial.radius_1); + operand->A.radial.radius_1); strcpy (custom_part, "_sampler"); _cairo_gl_shader_bind_texture(ctx, uniform_name, @@ -482,7 +482,7 @@ _cairo_gl_operand_setup_fixed (cairo_gl_ { switch (operand->type) { case CAIRO_GL_OPERAND_CONSTANT: - glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, operand->constant.color); + glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, operand->A.constant.color); glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_CONSTANT); glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_CONSTANT); break; @@ -527,7 +527,7 @@ _cairo_gl_operand_setup_fixed (cairo_gl_ glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); if (operand->type == CAIRO_GL_OPERAND_TEXTURE && - operand->texture.attributes.has_component_alpha) + operand->A.texture.attributes.has_component_alpha) glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); else glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_ALPHA); @@ -551,15 +551,15 @@ _cairo_gl_operand_needs_setup (cairo_gl_ case CAIRO_GL_OPERAND_SPANS: return FALSE; case CAIRO_GL_OPERAND_CONSTANT: - return dest->constant.color[0] != source->constant.color[0] || - dest->constant.color[1] != source->constant.color[1] || - dest->constant.color[2] != source->constant.color[2] || - dest->constant.color[3] != source->constant.color[3]; + return dest->A.constant.color[0] != source->A.constant.color[0] || + dest->A.constant.color[1] != source->A.constant.color[1] || + dest->A.constant.color[2] != source->A.constant.color[2] || + dest->A.constant.color[3] != source->A.constant.color[3]; case CAIRO_GL_OPERAND_TEXTURE: - return dest->texture.surface != source->texture.surface || - dest->texture.attributes.extend != source->texture.attributes.extend || - dest->texture.attributes.filter != source->texture.attributes.filter || - dest->texture.attributes.has_component_alpha != source->texture.attributes.has_component_alpha; + return dest->A.texture.surface != source->A.texture.surface || + dest->A.texture.attributes.extend != source->A.texture.attributes.extend || + dest->A.texture.attributes.filter != source->A.texture.attributes.filter || + dest->A.texture.attributes.has_component_alpha != source->A.texture.attributes.has_component_alpha; case CAIRO_GL_OPERAND_LINEAR_GRADIENT: case CAIRO_GL_OPERAND_RADIAL_GRADIENT: /* XXX: improve this */ @@ -621,12 +621,12 @@ _cairo_gl_context_setup_operand (cairo_g break; case CAIRO_GL_OPERAND_TEXTURE: glActiveTexture (GL_TEXTURE0 + tex_unit); - glBindTexture (ctx->tex_target, operand->texture.tex); + glBindTexture (ctx->tex_target, operand->A.texture.tex); glEnable (ctx->tex_target); _cairo_gl_texture_set_extend (ctx, ctx->tex_target, - operand->texture.attributes.extend); + operand->A.texture.attributes.extend); _cairo_gl_texture_set_filter (ctx, ctx->tex_target, - operand->texture.attributes.filter); + operand->A.texture.attributes.filter); glClientActiveTexture (GL_TEXTURE0 + tex_unit); glTexCoordPointer (2, GL_FLOAT, vertex_size, @@ -634,18 +634,18 @@ _cairo_gl_context_setup_operand (cairo_g glEnableClientState (GL_TEXTURE_COORD_ARRAY); break; case CAIRO_GL_OPERAND_LINEAR_GRADIENT: - _cairo_gl_gradient_reference (operand->linear.gradient); + _cairo_gl_gradient_reference (operand->A.linear.gradient); glActiveTexture (GL_TEXTURE0 + tex_unit); - glBindTexture (GL_TEXTURE_1D, operand->linear.gradient->tex); - _cairo_gl_texture_set_extend (ctx, GL_TEXTURE_1D, operand->linear.extend); + glBindTexture (GL_TEXTURE_1D, operand->A.linear.gradient->tex); + _cairo_gl_texture_set_extend (ctx, GL_TEXTURE_1D, operand->A.linear.extend); _cairo_gl_texture_set_filter (ctx, GL_TEXTURE_1D, CAIRO_FILTER_BILINEAR); glEnable (GL_TEXTURE_1D); break; case CAIRO_GL_OPERAND_RADIAL_GRADIENT: - _cairo_gl_gradient_reference (operand->radial.gradient); + _cairo_gl_gradient_reference (operand->A.radial.gradient); glActiveTexture (GL_TEXTURE0 + tex_unit); - glBindTexture (GL_TEXTURE_1D, operand->radial.gradient->tex); - _cairo_gl_texture_set_extend (ctx, GL_TEXTURE_1D, operand->radial.extend); + glBindTexture (GL_TEXTURE_1D, operand->A.radial.gradient->tex); + _cairo_gl_texture_set_extend (ctx, GL_TEXTURE_1D, operand->A.radial.extend); _cairo_gl_texture_set_filter (ctx, GL_TEXTURE_1D, CAIRO_FILTER_BILINEAR); glEnable (GL_TEXTURE_1D); break; @@ -683,12 +683,12 @@ _cairo_gl_context_destroy_operand (cairo glDisableClientState (GL_TEXTURE_COORD_ARRAY); break; case CAIRO_GL_OPERAND_LINEAR_GRADIENT: - _cairo_gl_gradient_destroy (ctx->operands[tex_unit].linear.gradient); + _cairo_gl_gradient_destroy (ctx->operands[tex_unit].A.linear.gradient); glActiveTexture (GL_TEXTURE0 + tex_unit); glDisable (GL_TEXTURE_1D); break; case CAIRO_GL_OPERAND_RADIAL_GRADIENT: - _cairo_gl_gradient_destroy (ctx->operands[tex_unit].radial.gradient); + _cairo_gl_gradient_destroy (ctx->operands[tex_unit].A.radial.gradient); glActiveTexture (GL_TEXTURE0 + tex_unit); glDisable (GL_TEXTURE_1D); break; @@ -913,7 +913,7 @@ _cairo_gl_composite_begin (cairo_gl_comp glEnable (GL_BLEND); component_alpha = ((setup->mask.type == CAIRO_GL_OPERAND_TEXTURE) && - setup->mask.texture.attributes.has_component_alpha); + setup->mask.A.texture.attributes.has_component_alpha); /* Do various magic for component alpha */ if (component_alpha) { @@ -1094,7 +1094,7 @@ _cairo_gl_operand_emit (cairo_gl_operand break; case CAIRO_GL_OPERAND_TEXTURE: { - cairo_surface_attributes_t *src_attributes = &operand->texture.attributes; + cairo_surface_attributes_t *src_attributes = &operand->A.texture.attributes; double s = x; double t = y;