1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2009 Eric Anholt
4 * Copyright © 2009 Chris Wilson
5 * Copyright © 2005,2010 Red Hat, Inc
6 * Copyright © 2011 Linaro Limited
7 * Copyright © 2011,2015 Samsung Research America, Inc - Silicon Valley
9 * This library is free software; you can redistribute it and/or
10 * modify it either under the terms of the GNU Lesser General Public
11 * License version 2.1 as published by the Free Software Foundation
12 * (the "LGPL") or, at your option, under the terms of the Mozilla
13 * Public License Version 1.1 (the "MPL"). If you do not alter this
14 * notice, a recipient may use your version of this file under either
15 * the MPL or the LGPL.
17 * You should have received a copy of the LGPL along with this library
18 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
20 * You should have received a copy of the MPL along with this library
21 * in the file COPYING-MPL-1.1
23 * The contents of this file are subject to the Mozilla Public License
24 * Version 1.1 (the "License"); you may not use this file except in
25 * compliance with the License. You may obtain a copy of the License at
26 * http://www.mozilla.org/MPL/
28 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
29 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
30 * the specific language governing rights and limitations.
32 * The Original Code is the cairo graphics library.
34 * The Initial Developer of the Original Code is Red Hat, Inc.
37 * Benjamin Otte <otte@gnome.org>
38 * Carl Worth <cworth@cworth.org>
39 * Chris Wilson <chris@chris-wilson.co.uk>
40 * Eric Anholt <eric@anholt.net>
41 * T. Zachary Laine <whatwasthataddress@gmail.com>
42 * Alexandros Frantzis <alexandros.frantzis@linaro.org>
43 * Henry Song <hsong@sisa.samsung.com>
46 #ifndef CAIRO_GL_PRIVATE_H
47 #define CAIRO_GL_PRIVATE_H
49 #define GL_GLEXT_PROTOTYPES
54 #include "cairo-gl-gradient-private.h"
56 #include "cairo-device-private.h"
57 #include "cairo-error-private.h"
58 #include "cairo-rtree-private.h"
59 #include "cairo-scaled-font-private.h"
60 #include "cairo-spans-compositor-private.h"
61 #include "cairo-array-private.h"
62 #include "cairo-stroke-dash-private.h"
66 #if CAIRO_HAS_EVASGL_SURFACE
69 #if CAIRO_HAS_GL_SURFACE
70 #if CAIRO_HAS_CGL_FUNCTIONS
71 #include <OpenGL/gl.h>
72 #include <OpenGL/glext.h>
77 #elif CAIRO_HAS_GLESV2_SURFACE
78 #include <GLES2/gl2.h>
79 #include <GLES2/gl2ext.h>
80 #elif CAIRO_HAS_GLESV3_SURFACE
81 #include <GLES3/gl3.h>
82 #include <GLES3/gl3ext.h>
86 #include "cairo-gl-ext-def-private.h"
90 #define CAIRO_GL_ENUM_UNINITIALIZED 0xFFFF
92 #if DEBUG_GL && __GNUC__
93 #define UNSUPPORTED(reason) ({ \
95 "cairo-gl: hit unsupported operation in %s(), line %d: %s\n", \
96 __FUNCTION__, __LINE__, reason); \
97 CAIRO_INT_STATUS_UNSUPPORTED; \
100 #define UNSUPPORTED(reason) CAIRO_INT_STATUS_UNSUPPORTED
103 #define CAIRO_GL_VERSION_ENCODE(major, minor) ( \
107 /* maximal number of shaders we keep in the cache.
108 * Random number that is hopefully big enough to not cause many cache evictions. */
109 #define CAIRO_GL_MAX_SHADERS_PER_CONTEXT 64
111 /* VBO size that we allocate, smaller size means we gotta flush more often,
112 * but larger means hogging more memory and can cause trouble for drivers
113 * (especially on embedded devices). Use the CAIRO_GL_VBO_SIZE environment
114 * variable to set this to a different size. */
115 #define CAIRO_GL_VBO_SIZE_DEFAULT (256*1024)
117 #define MIN_IMAGE_CACHE_WIDTH 512
118 #define MIN_IMAGE_CACHE_HEIGHT 512
119 #define MAX_IMAGE_CACHE_WIDTH 2048
120 #define MAX_IMAGE_CACHE_HEIGHT 2048
121 #define IMAGE_CACHE_MIN_SIZE 1
122 #define IMAGE_CACHE_MAX_SIZE 256
123 #define MIN_SCRATCH_SIZE 32
124 #define MAX_SCRATCH_SIZE 1024
126 typedef struct _cairo_gl_surface cairo_gl_surface_t;
127 typedef struct _cairo_gl_image cairo_gl_image_t;
129 /* Mali or SGX driver */
130 typedef enum _cairo_gl_multisample_ext_type {
131 CAIRO_GL_EXT_MULTISAMPLE_TO_TEXTURE,
132 CAIRO_GL_IMG_MULTISAMPLE_TO_TEXTURE,
133 CAIRO_GL_NONE_MULTISAMPLE_TO_TEXTURE
134 } cairo_gl_multisample_ext_type;
137 typedef enum _cairo_blur_stage {
138 CAIRO_GL_BLUR_STAGE_NONE,
139 CAIRO_GL_BLUR_STAGE_0, /* shrink stage */
140 CAIRO_GL_BLUR_STAGE_1, /* x/y pass */
141 CAIRO_GL_BLUR_STAGE_2 /* enlarge stage */
142 } cairo_blur_stage_t;
145 typedef enum cairo_gl_flavor {
146 CAIRO_GL_FLAVOR_NONE = 0,
147 CAIRO_GL_FLAVOR_DESKTOP = 1,
148 CAIRO_GL_FLAVOR_ES2 = 2,
149 CAIRO_GL_FLAVOR_ES3 = 3
152 /* The order here is sensitive because of the logic of
153 *_cairo_gl_shader_uniform_for_texunit. */
154 typedef enum cairo_gl_uniform_t {
155 CAIRO_GL_UNIFORM_TEXDIMS, /* "source_texdims" */
156 CAIRO_GL_UNIFORM_TEXGEN, /* "source_texgen" */
157 CAIRO_GL_UNIFORM_CONSTANT, /* "source_constant" */
158 CAIRO_GL_UNIFORM_SAMPLER, /* "source_sampler" */
159 CAIRO_GL_UNIFORM_A, /* "source_a" */
160 CAIRO_GL_UNIFORM_CIRCLE_D, /* "source_circle_d" */
161 CAIRO_GL_UNIFORM_RADIUS_0, /* "source_radius_0" */
162 CAIRO_GL_UNIFORM_BLUR_RADIUS,/* "source_blur_radius" */
163 CAIRO_GL_UNIFORM_BLURS, /* "source_blurs" */
164 CAIRO_GL_UNIFORM_BLUR_STEP, /* "source_blurstep" */
165 CAIRO_GL_UNIFORM_BLUR_X_AXIS, /* "source_blur_x_axis" */
166 CAIRO_GL_UNIFORM_BLUR_Y_AXIS, /* "source_blur_y_axis" */
167 CAIRO_GL_UNIFORM_ALPHA, /* "source_alpha */
168 CAIRO_GL_UNIFORM_COLOR_1, /* "source_color_1 */
169 CAIRO_GL_UNIFORM_COLOR_2, /* "source_color_2 */
170 CAIRO_GL_UNIFORM_OFFSET_1, /* "source_offset_1 */
171 CAIRO_GL_UNIFORM_OFFSET_2, /* "source_offset_2 */
173 CAIRO_GL_UNIFORM_MASK_TEXDIMS, /* "mask_texdims" */
174 CAIRO_GL_UNIFORM_MASK_TEXGEN, /* "mask_texgen" */
175 CAIRO_GL_UNIFORM_MASK_CONSTANT, /* "mask_constant" */
176 CAIRO_GL_UNIFORM_MASK_SAMPLER, /* "mask_sampler" */
177 CAIRO_GL_UNIFORM_MASK_A, /* "mask_a" */
178 CAIRO_GL_UNIFORM_MASK_CIRCLE_D, /* "mask_circle_d" */
179 CAIRO_GL_UNIFORM_MASK_RADIUS_0, /* "mask_radius_0" */
180 CAIRO_GL_UNIFORM_MASK_BLUR_RADIUS, /* "mask_blur_radius */
181 CAIRO_GL_UNIFORM_MASK_BLURS, /* "mask_blurs */
182 CAIRO_GL_UNIFORM_MASK_BLUR_STEP, /* "mask_blur_step" */
183 CAIRO_GL_UNIFORM_MASK_BLUR_X_AXIS, /* "mask_blur_x_axis" */
184 CAIRO_GL_UNIFORM_MASK_BLUR_Y_AXIS, /* "mask_blur_y_axis" */
185 CAIRO_GL_UNIFORM_MASK_ALPHA, /* "mask_alpha" */
186 CAIRO_GL_UNIFORM_MASK_COLOR_1, /* "mask_color_1" */
187 CAIRO_GL_UNIFORM_MASK_COLOR_2, /* "mask_color_2" */
188 CAIRO_GL_UNIFORM_MASK_OFFSET_1, /* "mask_offset_1 */
189 CAIRO_GL_UNIFORM_MASK_OFFSET_2, /* "mask_offset_2 */
191 CAIRO_GL_UNIFORM_PROJECTION_MATRIX, /* "ModelViewProjectionMatrix" */
195 } cairo_gl_uniform_t;
197 /* Indices for vertex attributes used by BindAttribLocation etc */
199 CAIRO_GL_VERTEX_ATTRIB_INDEX = 0,
200 CAIRO_GL_COLOR_ATTRIB_INDEX = 1,
201 CAIRO_GL_COVERAGE_ATTRIB_INDEX = 2,
202 CAIRO_GL_TEXCOORD0_ATTRIB_INDEX = 3,
203 CAIRO_GL_TEXCOORD1_ATTRIB_INDEX = 4,
204 CAIRO_GL_START_COORD0_ATTRIB_INDEX = 5,
205 CAIRO_GL_START_COORD1_ATTRIB_INDEX = 6,
206 CAIRO_GL_STOP_COORD0_ATTRIB_INDEX = 7,
207 CAIRO_GL_STOP_COORD1_ATTRIB_INDEX = 8
210 typedef enum cairo_gl_operand_type {
211 CAIRO_GL_OPERAND_NONE,
212 CAIRO_GL_OPERAND_CONSTANT,
213 CAIRO_GL_OPERAND_TEXTURE,
214 CAIRO_GL_OPERAND_LINEAR_GRADIENT,
215 CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0,
216 CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE,
217 CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT,
218 CAIRO_GL_OPERAND_GAUSSIAN,
220 CAIRO_GL_OPERAND_COUNT
221 } cairo_gl_operand_type_t;
223 typedef enum cairo_gl_draw_mode {
227 } cairo_gl_draw_mode_t;
229 /* This union structure describes a potential source or mask operand to the
230 * compositing equation.
232 typedef struct cairo_gl_operand {
233 cairo_gl_operand_type_t type;
234 int pass; /* 0 none, 1, x-axis, 2, y-axis */
238 cairo_gl_surface_t *surface;
239 cairo_gl_surface_t *owns_surface;
240 cairo_surface_attributes_t attributes;
242 cairo_bool_t use_atlas;
243 cairo_extend_t extend;
244 struct { float x, y; } p1, p2;
245 float coef[17]; /* max 1x/x1 kernel size */
251 cairo_bool_t encode_as_attribute;
254 cairo_gl_gradient_t *gradient;
256 cairo_circle_double_t circle_d;
258 cairo_extend_t extend;
262 unsigned int vertex_offset;
263 } cairo_gl_operand_t;
265 typedef struct cairo_gl_source {
266 cairo_surface_t base;
267 cairo_gl_operand_t operand;
270 struct _cairo_gl_surface {
271 cairo_surface_t base;
272 cairo_gl_operand_t operand;
276 GLuint tex; /* GL texture object containing our data. */
277 GLuint fb; /* GL framebuffer object wrapping our data. */
278 GLuint depth_stencil; /* GL renderbuffer object for holding stencil buffer clip. */
280 GLuint msaa_rb; /* The ARB MSAA path uses a renderbuffer. */
282 GLuint msaa_depth_stencil;
284 cairo_bool_t stencil_and_msaa_caps_initialized;
285 cairo_bool_t supports_stencil; /* Stencil support for for non-texture surfaces. */
286 cairo_bool_t supports_msaa;
287 cairo_bool_t num_samples;
288 cairo_bool_t force_no_msaa;
289 cairo_bool_t msaa_active; /* Whether the multisampling
290 framebuffer is active or not. */
291 cairo_bool_t content_synced; /* texture and renderbuffer content
293 cairo_bool_t content_cleared; /* last draw is glClear */
294 cairo_clip_t *clip_on_stencil_buffer;
297 cairo_bool_t needs_update;
298 cairo_bool_t size_changed;
300 cairo_region_t *clip_region;
301 GLuint bounded_tex; /* bounded tex for non-texture surface */
303 /* Indicate whether we need to cache it in image_cache. */
304 cairo_bool_t needs_to_cache;
305 cairo_bool_t force_no_cache;
306 double image_content_scale_x;
307 double image_content_scale_y;
308 cairo_blur_stage_t blur_stage;
309 /* Damage is too expensive to check, we use this flag. */
310 cairo_bool_t content_changed;
311 cairo_gl_image_t *image_node;
314 typedef struct cairo_gl_glyph_cache {
316 cairo_gl_surface_t *surface;
317 } cairo_gl_glyph_cache_t;
319 typedef enum cairo_gl_tex {
320 CAIRO_GL_TEX_SOURCE = 0,
321 CAIRO_GL_TEX_MASK = 1,
322 CAIRO_GL_TEX_TEMP = 2
325 typedef struct cairo_gl_shader {
326 GLuint fragment_shader;
329 GLint constant_location[2];
331 GLint circle_d_location[2];
332 GLint radius_0_location[2];
333 GLint texdims_location[2];
334 GLint texgen_location[2];
335 GLint blur_radius_location[2];
336 GLint blurs_location[2];
337 GLint blur_step_location[2];
338 GLint blur_x_axis_location[2];
339 GLint blur_y_axis_location[2];
340 GLint alpha_location[2];
341 GLint color_1_location[2];
342 GLint color_2_location[2];
343 GLint offset_1_location[2];
344 GLint offset_2_location[2];
347 typedef struct _cairo_gl_image_cache {
349 cairo_gl_surface_t *surface;
350 cairo_bool_t copy_success;
351 } cairo_gl_image_cache_t;
353 struct _cairo_gl_image {
354 cairo_rtree_node_t node;
355 cairo_surface_t *original_surface;
356 struct { float x, y; } p1, p2;
357 cairo_gl_context_t *ctx;
360 typedef enum cairo_gl_shader_in {
361 CAIRO_GL_SHADER_IN_NORMAL,
362 CAIRO_GL_SHADER_IN_CA_SOURCE,
363 CAIRO_GL_SHADER_IN_CA_SOURCE_ALPHA,
365 CAIRO_GL_SHADER_IN_COUNT
366 } cairo_gl_shader_in_t;
369 typedef struct _cairo_gl_hairline_closure
371 cairo_gl_context_t *ctx;
373 cairo_stroker_dash_t dash;
375 cairo_matrix_t *ctm_inverse;
376 cairo_point_t current_point;
378 cairo_point_t stroke_first_point; /* First stroke point at move_to. */
379 double stroke_first_dx;
380 double stroke_first_dy;
381 cairo_bool_t stroke_first_capped;
382 cairo_bool_t moved_to_stroke_first_point;
384 cairo_line_cap_t cap_style;
386 cairo_bool_t line_last_capped;
388 cairo_point_t line_last_point;
392 cairo_bool_t initialized;
393 } cairo_gl_hairline_closure_t;
395 typedef enum cairo_gl_var_type {
397 CAIRO_GL_VAR_TEXCOORDS,
400 } cairo_gl_var_type_t;
402 typedef enum cairo_gl_primitive_type {
403 CAIRO_GL_PRIMITIVE_TYPE_TRIANGLES,
404 CAIRO_GL_PRIMITIVE_TYPE_TRISTRIPS
405 } cairo_gl_primitive_type_t;
407 typedef void (*cairo_gl_emit_rect_t) (cairo_gl_context_t *ctx,
408 GLfloat x1, GLfloat y1,
409 GLfloat x2, GLfloat y2);
411 typedef void (*cairo_gl_emit_span_t) (cairo_gl_context_t *ctx,
412 GLfloat x1, GLfloat y1,
413 GLfloat x2, GLfloat y2,
416 typedef void (*cairo_gl_emit_glyph_t) (cairo_gl_context_t *ctx,
417 GLfloat x1, GLfloat y1,
418 GLfloat x2, GLfloat y2,
419 GLfloat glyph_x1, GLfloat glyph_y1,
420 GLfloat glyph_x2, GLfloat glyph_y2);
422 #define cairo_gl_var_type_hash(src,mask,src_atlas_extend,mask_atlas_extend,src_use_atlas,mask_use_atlas,spans,dest) ((spans) << 13) | ((mask) << 10 | (src << 7) | (mask_atlas_extend << 5) | (src_atlas_extend << 3) | (mask_use_atlas << 2) | (src_use_atlas << 1) | (dest))
423 #define CAIRO_GL_VAR_TYPE_MAX (1 << 14)
425 typedef void (*cairo_gl_generic_func_t)(void);
426 typedef cairo_gl_generic_func_t (*cairo_gl_get_proc_addr_func_t)(void *data, const char *procname);
428 typedef struct _cairo_gl_dispatch {
430 void (*ActiveTexture) (GLenum texture);
431 void (*BindTexture) (GLenum target, GLuint texture);
432 void (*BlendFunc) (GLenum sfactor, GLenum dfactor);
433 void (*BlendFuncSeparate) (GLenum srcRGB, GLenum dstRGB,
434 GLenum srcAlpha, GLenum dstAlpha);
435 void (*Clear) (GLbitfield mask);
436 void (*ClearColor) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
437 void (*ClearStencil) (GLint s);
438 void (*ColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
439 void (*DeleteTextures) (GLsizei n, const GLuint *textures);
440 void (*DepthMask) (GLboolean flag);
441 void (*Disable) (GLenum cap);
442 void (*DrawArrays) (GLenum mode, GLint first, GLsizei count);
443 void (*DrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
444 void (*Enable) (GLenum cap);
445 void (*Flush) (void);
446 void (*GenTextures) (GLsizei n, GLuint *textures);
447 void (*GetBooleanv) (GLenum pname, GLboolean *data);
448 GLenum (*GetError) (void);
449 void (*GetFloatv) (GLenum pname, GLfloat *data);
450 void (*GetIntegerv) (GLenum pname, GLint *data);
451 const GLubyte *(*GetString) (GLenum pname);
452 const GLubyte *(*GetStringi) (GLenum pname, GLuint i);
453 void (*PixelStorei) (GLenum pname, GLint param);
454 void (*ReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height,
455 GLenum format, GLenum type, GLvoid *data);
456 void (*Scissor) (GLint x, GLint y, GLsizei width, GLsizei height);
457 void (*StencilFunc) (GLenum func, GLint ref, GLuint mask);
458 void (*StencilMask) (GLuint mask);
459 void (*StencilOp) (GLenum sfail, GLenum dpfail, GLenum dppass);
460 void (*TexSubImage2D) (GLenum target, GLint level,
461 GLint xoffset, GLint yoffset,
462 GLsizei width, GLsizei height,
463 GLenum format, GLenum type, const GLvoid *data);
464 void (*TexImage2D) (GLenum target, GLint level, GLenum internalformat,
465 GLsizei width, GLsizei height,
466 GLint border, GLenum format,
467 GLenum type, const GLvoid *data);
468 void (*TexParameteri) (GLenum target, GLenum pname, GLint param);
469 #if defined(CAIRO_HAS_GL_SURFACE) || defined(CAIRO_HAS_EVASGL_SURFACE)
470 void (*DrawBuffer) (GLenum buf);
471 void (*ReadBuffer) (GLenum buf);
473 void (*Viewport) (GLint x, GLint y, GLsizei width, GLsizei height);
476 void (*GenBuffers) (GLsizei n, GLuint *buffers);
477 void (*DeleteBuffers) (GLsizei n, const GLuint *buffers);
478 void (*BindBuffer) (GLenum target, GLuint buffer);
479 void (*BufferData) (GLenum target, GLsizeiptr size,
480 const GLvoid* data, GLenum usage);
481 void (*BufferSubData) (GLenum target, GLintptr offset,
482 GLsizeiptr size, const GLvoid *data);
483 GLvoid *(*MapBuffer) (GLenum target, GLenum access);
484 GLboolean (*UnmapBuffer) (GLenum target);
485 void (*GenVertexArrays) (GLsizei n, GLuint *arrays);
486 void (*BindVertexArray) (GLuint array);
487 void (*DeleteVertexArrays) (GLsizei n, const GLuint *arrays);
490 GLuint (*CreateShader) (GLenum type);
491 void (*ShaderSource) (GLuint shader, GLsizei count,
492 const GLchar** string, const GLint* length);
493 void (*CompileShader) (GLuint shader);
494 void (*GetShaderiv) (GLuint shader, GLenum pname, GLint *params);
495 void (*GetShaderInfoLog) (GLuint shader, GLsizei bufSize,
496 GLsizei *length, GLchar *infoLog);
497 void (*DeleteShader) (GLuint shader);
500 GLuint (*CreateProgram) (void);
501 void (*AttachShader) (GLuint program, GLuint shader);
502 void (*DeleteProgram) (GLuint program);
503 void (*LinkProgram) (GLuint program);
504 void (*UseProgram) (GLuint program);
505 void (*GetProgramiv) (GLuint program, GLenum pname, GLint *params);
506 void (*GetProgramInfoLog) (GLuint program, GLsizei bufSize,
507 GLsizei *length, GLchar *infoLog);
510 GLint (*GetUniformLocation) (GLuint program, const GLchar* name);
511 void (*Uniform1f) (GLint location, GLfloat x);
512 void (*Uniform2f) (GLint location, GLfloat x, GLfloat y);
513 void (*Uniform3f) (GLint location, GLfloat x, GLfloat y, GLfloat z);
514 void (*Uniform4f) (GLint location, GLfloat x, GLfloat y, GLfloat z,
516 void (*Uniform1fv) (GLint location, GLsizei count, const GLfloat *v);
518 void (*UniformMatrix3fv) (GLint location, GLsizei count,
519 GLboolean transpose, const GLfloat *value);
520 void (*UniformMatrix4fv) (GLint location, GLsizei count,
521 GLboolean transpose, const GLfloat *value);
522 void (*Uniform1i) (GLint location, GLint x);
525 void (*BindAttribLocation) (GLuint program, GLuint index,
527 void (*VertexAttribPointer) (GLuint index, GLint size, GLenum type,
528 GLboolean normalized, GLsizei stride,
529 const GLvoid *pointer);
530 void (*EnableVertexAttribArray) (GLuint index);
531 void (*DisableVertexAttribArray) (GLuint index);
533 /* Framebuffer objects */
534 void (*GenFramebuffers) (GLsizei n, GLuint* framebuffers);
535 void (*BindFramebuffer) (GLenum target, GLuint framebuffer);
536 void (*FramebufferTexture2D) (GLenum target, GLenum attachment,
537 GLenum textarget, GLuint texture,
539 GLenum (*CheckFramebufferStatus) (GLenum target);
540 void (*DeleteFramebuffers) (GLsizei n, const GLuint* framebuffers);
541 void (*GenRenderbuffers) (GLsizei n, GLuint *renderbuffers);
542 void (*BindRenderbuffer) (GLenum target, GLuint renderbuffer);
543 void (*RenderbufferStorage) (GLenum target, GLenum internal_format,
544 GLsizei width, GLsizei height);
545 void (*FramebufferRenderbuffer) (GLenum target, GLenum attachment,
546 GLenum renderbuffer_ttarget, GLuint renderbuffer);
547 void (*DeleteRenderbuffers) (GLsizei n, GLuint *renderbuffers);
548 void (*BlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
549 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
550 GLbitfield mask, GLenum filter);
551 void (*RenderbufferStorageMultisample) (GLenum target, GLsizei samples,
552 GLenum internalformat,
553 GLsizei width, GLsizei height);
554 void (*FramebufferTexture2DMultisample) (GLenum target, GLenum attachment,
555 GLenum textarget, GLuint texture,
556 GLint level, GLsizei samples);
557 } cairo_gl_dispatch_t;
559 typedef struct _cairo_gl_states {
560 cairo_rectangle_int_t viewport_box;
563 GLclampf clear_green;
565 GLclampf clear_alpha;
567 cairo_bool_t blend_enabled;
569 GLenum src_color_factor;
570 GLenum dst_color_factor;
571 GLenum src_alpha_factor;
572 GLenum dst_alpha_factor;
574 GLenum active_texture;
576 cairo_bool_t depth_mask;
578 cairo_bool_t scissor_test_enabled;
579 cairo_bool_t stencil_test_enabled;
586 struct _cairo_gl_context {
589 const cairo_compositor_t *compositor;
591 GLint max_framebuffer_size;
592 GLint max_texture_size;
597 cairo_bool_t supports_msaa;
603 cairo_bool_t has_shader_support;
605 GLuint vertex_shaders[CAIRO_GL_VAR_TYPE_MAX];
606 cairo_gl_shader_t fill_rectangles_shader;
607 cairo_cache_t shaders;
609 cairo_cache_t gradients;
611 /* cache[0] for gray font, cache[1] for rgba component alpha
612 * cache[2] for color glyph */
613 cairo_gl_glyph_cache_t glyph_cache[3];
616 cairo_gl_surface_t *current_target;
617 cairo_operator_t current_operator;
618 cairo_gl_shader_t *pre_shader; /* for component alpha */
619 cairo_gl_shader_t *current_shader;
621 cairo_gl_operand_t operands[2];
624 unsigned int vbo_size;
625 unsigned int vb_offset;
626 unsigned int vertex_size;
627 cairo_region_t *clip_region;
629 cairo_gl_primitive_type_t primitive_type;
630 cairo_array_t tristrip_indices;
632 cairo_bool_t has_mesa_pack_invert;
633 cairo_gl_dispatch_t dispatch;
634 GLfloat modelviewprojection_matrix[16];
635 cairo_gl_flavor_t gl_flavor;
636 cairo_bool_t has_map_buffer;
637 cairo_bool_t has_packed_depth_stencil;
638 cairo_bool_t has_npot_repeat;
639 cairo_bool_t can_read_bgra;
640 cairo_bool_t is_gl33;
642 cairo_bool_t thread_aware;
644 cairo_gl_image_cache_t *image_cache;
645 cairo_gl_draw_mode_t draw_mode;
646 cairo_gl_states_t states_cache;
648 /* Intermediate mask surface for glyph rendering. Created on first access, enlarged on demand. */
649 cairo_gl_surface_t *glyph_mask;
650 /* Intermediate blur surface for gaussian blur. Created on first access, enlarged on demand. */
651 cairo_gl_surface_t *source_scratch_surfaces[2];
652 cairo_gl_surface_t *mask_scratch_surfaces[2];
653 cairo_gl_surface_t *shadow_scratch_surfaces[3];
654 cairo_gl_surface_t *shadow_masks[4];
655 cairo_bool_t source_scratch_in_use;
656 cairo_bool_t has_angle_multisampling;
657 cairo_gl_multisample_ext_type msaa_type;
659 void (*acquire) (void *ctx);
660 void (*release) (void *ctx);
662 void (*make_current) (void *ctx, cairo_gl_surface_t *surface);
663 void (*swap_buffers)(void *ctx, cairo_gl_surface_t *surface);
664 void (*destroy) (void *ctx);
667 typedef struct _cairo_gl_composite {
668 cairo_gl_surface_t *dst;
670 cairo_region_t *clip_region;
672 cairo_gl_operand_t src;
673 cairo_gl_operand_t mask;
677 cairo_bool_t multisample;
678 } cairo_gl_composite_t;
680 typedef struct _cairo_gl_font {
681 cairo_scaled_font_private_t base;
682 cairo_device_t *device;
686 static cairo_always_inline GLenum
687 _cairo_gl_get_error (cairo_gl_context_t *ctx)
689 GLenum err = ctx->dispatch.GetError();
692 while (ctx->dispatch.GetError ());
697 static inline cairo_device_t *
698 _cairo_gl_context_create_in_error (cairo_status_t status)
700 return (cairo_device_t *) _cairo_device_create_in_error (status);
703 cairo_private cairo_status_t
704 _cairo_gl_context_init (cairo_gl_context_t *ctx);
707 _cairo_gl_context_reset (cairo_gl_context_t *ctx);
710 _cairo_gl_surface_init (cairo_device_t *device,
711 cairo_gl_surface_t *surface,
712 cairo_content_t content,
713 int width, int height);
715 static cairo_always_inline cairo_bool_t cairo_warn
716 _cairo_gl_surface_is_texture (cairo_gl_surface_t *surface)
718 return surface->tex != 0;
721 cairo_private cairo_status_t
722 _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
723 cairo_image_surface_t *src,
724 int src_x, int src_y,
725 int width, int height,
726 int dst_x, int dst_y,
727 cairo_bool_t force_flush);
729 cairo_private cairo_int_status_t
730 _cairo_gl_surface_resolve_multisampling (cairo_gl_surface_t *surface);
732 static cairo_always_inline cairo_bool_t
733 _cairo_gl_device_has_glsl (cairo_device_t *device)
735 return ((cairo_gl_context_t *) device)->has_shader_support;
738 static cairo_always_inline cairo_bool_t
739 _cairo_gl_device_requires_power_of_two_textures (cairo_device_t *device)
741 return ((cairo_gl_context_t *) device)->tex_target == GL_TEXTURE_RECTANGLE;
744 static cairo_always_inline cairo_status_t cairo_warn
745 _cairo_gl_context_acquire (cairo_device_t *device,
746 cairo_gl_context_t **ctx)
748 cairo_status_t status;
750 status = cairo_device_acquire (device);
751 if (unlikely (status))
754 /* clear potential previous GL errors */
755 _cairo_gl_get_error ((cairo_gl_context_t *) device);
757 *ctx = (cairo_gl_context_t *) device;
758 return CAIRO_STATUS_SUCCESS;
761 static cairo_always_inline cairo_warn cairo_status_t
762 _cairo_gl_context_release (cairo_gl_context_t *ctx, cairo_status_t status)
766 err = _cairo_gl_get_error (ctx);
768 if (unlikely (err)) {
769 cairo_status_t new_status;
770 new_status = _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
771 if (status == CAIRO_STATUS_SUCCESS)
775 cairo_device_release (&(ctx)->base);
781 _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
782 cairo_gl_surface_t *surface,
783 cairo_bool_t multisampling);
786 _cairo_gl_context_bind_framebuffer (cairo_gl_context_t *ctx,
787 cairo_gl_surface_t *surface,
788 cairo_bool_t multisampling);
790 cairo_private cairo_gl_emit_rect_t
791 _cairo_gl_context_choose_emit_rect (cairo_gl_context_t *ctx);
794 _cairo_gl_context_emit_rect (cairo_gl_context_t *ctx,
795 GLfloat x1, GLfloat y1,
796 GLfloat x2, GLfloat y2);
798 cairo_private cairo_gl_emit_span_t
799 _cairo_gl_context_choose_emit_span (cairo_gl_context_t *ctx);
801 cairo_private cairo_gl_emit_glyph_t
802 _cairo_gl_context_choose_emit_glyph (cairo_gl_context_t *ctx,
803 const cairo_bool_t is_color_glyph);
806 _cairo_gl_context_activate (cairo_gl_context_t *ctx,
807 cairo_gl_tex_t tex_unit);
809 cairo_private cairo_bool_t
810 _cairo_gl_operator_is_supported (cairo_operator_t op);
812 cairo_private cairo_bool_t
813 _cairo_gl_ensure_stencil (cairo_gl_context_t *ctx,
814 cairo_gl_surface_t *surface);
816 static cairo_always_inline void
817 _disable_stencil_buffer (cairo_gl_context_t *ctx)
819 if (ctx->states_cache.stencil_test_enabled == TRUE) {
820 ctx->dispatch.Disable (GL_STENCIL_TEST);
821 ctx->states_cache.stencil_test_enabled = FALSE;
825 static cairo_always_inline void
826 _disable_scissor_buffer (cairo_gl_context_t *ctx)
828 if (ctx->states_cache.scissor_test_enabled == TRUE) {
829 ctx->dispatch.Disable (GL_SCISSOR_TEST);
830 ctx->states_cache.scissor_test_enabled = FALSE;
834 static cairo_always_inline void
835 _enable_stencil_buffer (cairo_gl_context_t *ctx)
837 if (ctx->states_cache.stencil_test_enabled == FALSE) {
838 ctx->dispatch.Enable (GL_STENCIL_TEST);
839 ctx->states_cache.stencil_test_enabled = TRUE;
843 static cairo_always_inline void
844 _enable_scissor_buffer (cairo_gl_context_t *ctx)
846 if (ctx->states_cache.scissor_test_enabled == FALSE) {
847 ctx->dispatch.Enable (GL_SCISSOR_TEST);
848 ctx->states_cache.scissor_test_enabled = TRUE;
852 static cairo_always_inline void
853 _cairo_gl_ensure_drawbuffers (cairo_gl_context_t *ctx)
857 if ((ctx->vao != 0 &&
858 (ctx->vao != ctx->states_cache.bound_vao))) {
859 ctx->dispatch.GetIntegerv (GL_VERTEX_ARRAY_BINDING, &vao);
860 if (vao != (GLint)ctx->states_cache.bound_vao) {
861 ctx->dispatch.BindVertexArray (ctx->vao);
862 ctx->states_cache.bound_vao = ctx->vao;
864 ctx->dispatch.BindBuffer (GL_ARRAY_BUFFER, ctx->vbo);
865 ctx->states_cache.bound_vbo = ctx->vbo;
867 ctx->dispatch.BindBuffer (GL_ELEMENT_ARRAY_BUFFER, ctx->ibo);
868 ctx->states_cache.bound_ibo = ctx->ibo;
872 if ((ctx->vbo != 0 &&
873 (ctx->vbo != ctx->states_cache.bound_vbo))) {
874 ctx->dispatch.GetIntegerv (GL_ARRAY_BUFFER_BINDING, &vbo);
875 if (vbo != (GLint)ctx->states_cache.bound_vbo) {
876 ctx->dispatch.BindBuffer (GL_ARRAY_BUFFER, ctx->vbo);
878 ctx->states_cache.bound_vbo = ctx->vbo;
881 if ((ctx->ibo != 0 &&
882 (ctx->ibo != ctx->states_cache.bound_ibo))) {
883 ctx->dispatch.GetIntegerv (GL_ELEMENT_ARRAY_BUFFER_BINDING, &ibo);
884 if (ibo != (GLint)ctx->states_cache.bound_ibo) {
885 ctx->dispatch.BindBuffer (GL_ELEMENT_ARRAY_BUFFER, ctx->ibo);
887 ctx->states_cache.bound_ibo = ctx->ibo;
891 cairo_private cairo_status_t
892 _cairo_gl_composite_init (cairo_gl_composite_t *setup,
894 cairo_gl_surface_t *dst,
895 cairo_bool_t has_component_alpha);
898 _cairo_gl_composite_fini (cairo_gl_composite_t *setup);
900 cairo_private cairo_status_t
901 _cairo_gl_composite_set_operator (cairo_gl_composite_t *setup,
903 cairo_bool_t assume_component_alpha);
906 _cairo_gl_composite_set_clip_region (cairo_gl_composite_t *setup,
907 cairo_region_t *clip_region);
910 _cairo_gl_composite_set_clip(cairo_gl_composite_t *setup,
913 cairo_private cairo_int_status_t
914 _cairo_gl_composite_set_source (cairo_gl_composite_t *setup,
915 const cairo_pattern_t *pattern,
916 const cairo_rectangle_int_t *sample,
917 const cairo_rectangle_int_t *extents,
918 cairo_bool_t use_texgen,
919 cairo_bool_t encode_color_as_attribute);
922 _cairo_gl_composite_set_solid_source (cairo_gl_composite_t *setup,
923 const cairo_color_t *color);
926 _cairo_gl_composite_set_source_operand (cairo_gl_composite_t *setup,
927 const cairo_gl_operand_t *source);
929 cairo_private cairo_int_status_t
930 _cairo_gl_composite_set_mask (cairo_gl_composite_t *setup,
931 const cairo_pattern_t *pattern,
932 const cairo_rectangle_int_t *sample,
933 const cairo_rectangle_int_t *extents,
934 cairo_bool_t use_texgen);
937 _cairo_gl_composite_set_mask_operand (cairo_gl_composite_t *setup,
938 const cairo_gl_operand_t *mask);
941 _cairo_gl_composite_set_spans (cairo_gl_composite_t *setup);
944 _cairo_gl_composite_set_multisample (cairo_gl_composite_t *setup);
946 cairo_private cairo_status_t
947 _cairo_gl_composite_begin (cairo_gl_composite_t *setup,
948 cairo_gl_context_t **ctx);
950 cairo_private cairo_status_t
951 _cairo_gl_set_operands_and_operator (cairo_gl_composite_t *setup,
952 cairo_gl_context_t *ctx);
955 _cairo_gl_composite_flush (cairo_gl_context_t *ctx);
957 cairo_private cairo_int_status_t
958 _cairo_gl_composite_emit_quad_as_tristrip (cairo_gl_context_t *ctx,
959 cairo_gl_composite_t *setup,
960 const cairo_point_t quad[4]);
962 cairo_private cairo_int_status_t
963 _cairo_gl_composite_emit_int_quad_as_tristrip (cairo_gl_context_t *ctx,
964 cairo_gl_composite_t *setup,
967 cairo_private cairo_int_status_t
968 _cairo_gl_composite_emit_triangle_as_tristrip (cairo_gl_context_t *ctx,
969 cairo_gl_composite_t *setup,
970 const cairo_point_t triangle[3]);
972 cairo_private cairo_int_status_t
973 _cairo_gl_composite_emit_triangle_fan (cairo_gl_context_t *ctx,
974 cairo_gl_composite_t *setup,
975 const cairo_point_t *fan,
978 cairo_private cairo_int_status_t
979 _cairo_gl_composite_emit_point_as_tristrip_line (cairo_gl_context_t *ctx,
980 const cairo_point_t point[2],
981 cairo_bool_t start_point);
983 cairo_private cairo_int_status_t
984 _cairo_gl_composite_emit_point_as_single_line (cairo_gl_context_t *ctx,
985 const cairo_point_t point[2]);
988 _cairo_gl_context_destroy_operand (cairo_gl_context_t *ctx,
989 cairo_gl_tex_t tex_unit);
991 cairo_private cairo_bool_t
992 _cairo_gl_get_image_format_and_type (cairo_gl_flavor_t flavor,
993 pixman_format_code_t pixman_format,
994 GLenum *internal_format, GLenum *format,
995 GLenum *type, cairo_bool_t *has_alpha,
996 cairo_bool_t *needs_swap);
999 _cairo_gl_glyph_cache_init (cairo_gl_glyph_cache_t *cache);
1002 _cairo_gl_glyph_cache_fini (cairo_gl_context_t *ctx,
1003 cairo_gl_glyph_cache_t *cache);
1005 cairo_private cairo_int_status_t
1006 _cairo_gl_surface_show_glyphs (void *abstract_dst,
1007 cairo_operator_t op,
1008 const cairo_pattern_t *source,
1009 cairo_glyph_t *glyphs,
1011 cairo_scaled_font_t *scaled_font,
1012 const cairo_clip_t *clip,
1013 int *remaining_glyphs);
1015 cairo_private cairo_status_t
1016 _cairo_gl_context_init_shaders (cairo_gl_context_t *ctx);
1019 _cairo_gl_context_fini_shaders (cairo_gl_context_t *ctx);
1021 static cairo_always_inline cairo_bool_t
1022 _cairo_gl_context_is_flushed (cairo_gl_context_t *ctx)
1024 return ctx->vb_offset == 0;
1027 cairo_private cairo_status_t
1028 _cairo_gl_get_shader_by_type (cairo_gl_context_t *ctx,
1029 cairo_gl_operand_t *source,
1030 cairo_gl_operand_t *mask,
1031 cairo_bool_t use_coverage,
1032 cairo_gl_shader_in_t in,
1033 cairo_gl_shader_t **shader);
1035 cairo_private cairo_gl_uniform_t
1036 _cairo_gl_shader_uniform_for_texunit (cairo_gl_uniform_t uniform,
1037 cairo_gl_tex_t tex_unit);
1040 _cairo_gl_shader_bind_float (cairo_gl_context_t *ctx,
1045 _cairo_gl_shader_bind_float_array (cairo_gl_context_t *ctx,
1047 int num, float *values);
1050 _cairo_gl_shader_bind_int (cairo_gl_context_t *ctx,
1055 _cairo_gl_shader_bind_vec2 (cairo_gl_context_t *ctx,
1057 float value0, float value1);
1060 _cairo_gl_shader_bind_vec3 (cairo_gl_context_t *ctx,
1067 _cairo_gl_shader_bind_vec4 (cairo_gl_context_t *ctx,
1069 float value0, float value1,
1070 float value2, float value3);
1073 _cairo_gl_shader_bind_matrix (cairo_gl_context_t *ctx,
1075 const cairo_matrix_t* m);
1078 _cairo_gl_shader_bind_matrix4f (cairo_gl_context_t *ctx,
1083 _cairo_gl_set_shader (cairo_gl_context_t *ctx,
1084 cairo_gl_shader_t *shader);
1087 _cairo_gl_shader_fini (cairo_gl_context_t *ctx, cairo_gl_shader_t *shader);
1090 _cairo_gl_get_version (cairo_gl_dispatch_t *dispatch);
1093 _cairo_glsl_get_version (cairo_gl_dispatch_t *dispatch);
1095 cairo_private cairo_gl_flavor_t
1096 _cairo_gl_get_flavor (cairo_gl_dispatch_t *dispatch);
1098 cairo_private unsigned long
1099 _cairo_gl_get_vbo_size (void);
1101 cairo_private cairo_bool_t
1102 _cairo_gl_has_extension (cairo_gl_dispatch_t *dispatch, const char *ext);
1104 cairo_private cairo_status_t
1105 _cairo_gl_dispatch_init(cairo_gl_dispatch_t *dispatch,
1106 cairo_gl_get_proc_addr_func_t get_proc_addr,
1109 cairo_private cairo_int_status_t
1110 _cairo_gl_operand_init (cairo_gl_operand_t *operand,
1111 const cairo_pattern_t *pattern,
1112 cairo_gl_surface_t *dst,
1113 const cairo_rectangle_int_t *sample,
1114 const cairo_rectangle_int_t *extents,
1115 cairo_bool_t use_texgen,
1116 cairo_bool_t encode_color_as_attribute);
1119 _cairo_gl_solid_operand_init (cairo_gl_operand_t *operand,
1120 const cairo_color_t *color);
1122 cairo_private cairo_filter_t
1123 _cairo_gl_operand_get_filter (cairo_gl_operand_t *operand);
1126 _cairo_gl_operand_get_gl_filter (cairo_gl_operand_t *operand);
1128 cairo_private cairo_extend_t
1129 _cairo_gl_operand_get_extend (cairo_gl_operand_t *operand);
1131 cairo_private cairo_extend_t
1132 _cairo_gl_operand_get_atlas_extend (cairo_gl_operand_t *operand);
1134 cairo_private unsigned int
1135 _cairo_gl_operand_get_vertex_size (const cairo_gl_operand_t *operand);
1137 cairo_private cairo_bool_t
1138 _cairo_gl_operand_get_use_atlas (cairo_gl_operand_t *operand);
1140 cairo_private cairo_bool_t
1141 _cairo_gl_operand_needs_setup (cairo_gl_operand_t *dest,
1142 cairo_gl_operand_t *source,
1143 unsigned int vertex_offset);
1146 _cairo_gl_operand_bind_to_shader (cairo_gl_context_t *ctx,
1147 cairo_gl_operand_t *operand,
1148 cairo_gl_tex_t tex_unit);
1151 _cairo_gl_operand_emit (cairo_gl_operand_t *operand,
1157 _cairo_gl_operand_copy (cairo_gl_operand_t *dst,
1158 const cairo_gl_operand_t *src);
1161 _cairo_gl_operand_translate (cairo_gl_operand_t *operand,
1162 double tx, double ty);
1165 _cairo_gl_operand_destroy (cairo_gl_operand_t *operand);
1167 cairo_private const cairo_compositor_t *
1168 _cairo_gl_msaa_compositor_get (void);
1170 cairo_private const cairo_compositor_t *
1171 _cairo_gl_span_compositor_get (void);
1173 cairo_private const cairo_compositor_t *
1174 _cairo_gl_traps_compositor_get (void);
1176 cairo_private cairo_int_status_t
1177 _cairo_gl_check_composite_glyphs (const cairo_composite_rectangles_t *extents,
1178 cairo_scaled_font_t *scaled_font,
1179 cairo_glyph_t *glyphs,
1182 cairo_private cairo_int_status_t
1183 _cairo_gl_composite_glyphs (void *_dst,
1184 cairo_operator_t op,
1185 cairo_surface_t *_src,
1190 cairo_composite_glyphs_info_t *info);
1192 cairo_private cairo_int_status_t
1193 _cairo_gl_composite_glyphs_with_clip (void *_dst,
1194 cairo_operator_t op,
1195 cairo_surface_t *_src,
1200 cairo_composite_glyphs_info_t *info,
1201 cairo_clip_t *clip);
1204 _cairo_gl_image_node_destroy (cairo_rtree_node_t *node);
1207 _cairo_gl_image_node_fini (void *data);
1210 _cairo_gl_image_cache_unlock (cairo_gl_context_t *ctx);
1212 cairo_private cairo_int_status_t
1213 _cairo_gl_image_cache_init (cairo_gl_context_t *ctx, int width, int height,
1214 cairo_gl_image_cache_t **image_cache);
1216 _cairo_gl_image_cache_fini (cairo_gl_context_t *ctx);
1219 _cairo_gl_ensure_framebuffer (cairo_gl_context_t *ctx,
1220 cairo_gl_surface_t *surface);
1222 cairo_private cairo_surface_t *
1223 _cairo_gl_surface_create_scratch (cairo_gl_context_t *ctx,
1224 cairo_content_t content,
1228 cairo_private cairo_surface_t *
1229 _cairo_gl_surface_create_scratch_for_caching (cairo_gl_context_t *ctx,
1230 cairo_content_t content,
1234 cairo_private cairo_surface_t *
1235 _cairo_gl_pattern_to_source (cairo_surface_t *dst,
1236 const cairo_pattern_t *pattern,
1237 cairo_bool_t is_mask,
1238 const cairo_rectangle_int_t *extents,
1239 const cairo_rectangle_int_t *sample,
1240 int *src_x, int *src_y);
1242 cairo_private cairo_int_status_t
1243 _cairo_gl_msaa_compositor_draw_clip (cairo_gl_context_t *ctx,
1244 cairo_gl_composite_t *setup,
1245 cairo_clip_t *clip);
1247 cairo_private cairo_surface_t *
1248 _cairo_gl_white_source (void);
1251 _cairo_gl_scissor_to_rectangle (cairo_gl_surface_t *surface,
1252 const cairo_rectangle_int_t *r);
1254 static inline cairo_gl_operand_t *
1255 source_to_operand (cairo_surface_t *surface)
1257 cairo_gl_source_t *source = (cairo_gl_source_t *)surface;
1258 return source ? &source->operand : NULL;
1262 _cairo_gl_glyph_cache_unlock (cairo_gl_glyph_cache_t *cache)
1264 _cairo_rtree_unpin (&cache->rtree);
1269 cairo_private cairo_bool_t
1270 _cairo_gl_hairline_style_is_hairline (const cairo_stroke_style_t *style,
1271 const cairo_matrix_t *ctm);
1273 cairo_private cairo_status_t
1274 _cairo_gl_hairline_move_to (void *closure,
1275 const cairo_point_t *point);
1277 cairo_private cairo_status_t
1278 _cairo_gl_hairline_line_to (void *closure,
1279 const cairo_point_t *point);
1281 cairo_private cairo_status_t
1282 _cairo_gl_hairline_line_to_dashed (void *closure,
1283 const cairo_point_t *point);
1285 cairo_private cairo_status_t
1286 _cairo_gl_hairline_curve_to (void *closure,
1287 const cairo_point_t *p0,
1288 const cairo_point_t *p1,
1289 const cairo_point_t *p2);
1291 cairo_private cairo_status_t
1292 _cairo_gl_hairline_close_path (void *closure);
1294 cairo_private cairo_status_t
1295 _cairo_gl_path_fixed_stroke_to_hairline (const cairo_path_fixed_t *path,
1296 cairo_gl_hairline_closure_t *closure,
1297 const cairo_stroke_style_t *style,
1298 const cairo_matrix_t *ctm,
1299 const cairo_matrix_t *ctm_inverse,
1300 cairo_path_fixed_move_to_func_t *move_to,
1301 cairo_path_fixed_line_to_func_t *line_to,
1302 cairo_path_fixed_curve_to_func_t *curve_to,
1303 cairo_path_fixed_close_path_func_t *close_path);
1305 cairo_private cairo_gl_surface_t *
1306 _cairo_gl_gaussian_filter (cairo_gl_surface_t *dst,
1307 const cairo_surface_pattern_t *pattern,
1308 cairo_gl_surface_t *src,
1309 cairo_rectangle_int_t *extents_out);
1311 static inline cairo_bool_t
1312 _cairo_gl_surface_is_scratch (cairo_gl_context_t *ctx,
1313 cairo_gl_surface_t *surface)
1317 for (i = 0; i < 2; i++) {
1318 if (surface == ctx->source_scratch_surfaces[i] ||
1319 surface == ctx->mask_scratch_surfaces[i] ||
1320 surface == ctx->shadow_scratch_surfaces[i])
1324 if (surface == ctx->shadow_scratch_surfaces[2])
1330 slim_hidden_proto (cairo_gl_surface_create);
1331 slim_hidden_proto (cairo_gl_surface_create_for_texture);
1333 #endif /* CAIRO_GL_PRIVATE_H */