Commit graph

8400 commits

Author SHA1 Message Date
Benjamin Otte
8adbf3aa19 gl: Use _cairo_gl_surface_draw_image() when caching glyphs 2010-05-20 11:02:46 +02:00
Benjamin Otte
915aa64ef0 gl: Actually check errors for _cairo_gl_composite_begin() 2010-05-20 11:01:21 +02:00
Benjamin Otte
0222cc7d76 gl: Get rid of _cairo_gl_composite_set_mask_texture()
Now that the glyph cache contains real surfaces, there's no longer a
need to have a special function for it.
2010-05-20 11:01:19 +02:00
Benjamin Otte
208d9f2a7e gl: Make glyph cache a real surface
This has the huge advantage that we can use real surface functions on
it.
2010-05-20 11:00:50 +02:00
Benjamin Otte
0501179963 surface: Add _cairo_surface_release_device_reference() API
See the API documentation for that function about its intended purpose.
2010-05-18 13:43:27 +02:00
Benjamin Otte
c489f67d1d gl: Make a bunch of functions static
They are no longer used outside of cairo_gl_composite_t.
2010-05-18 13:43:27 +02:00
Benjamin Otte
c8008e118a gl: Don't name the union in cairo_gl_operand_t
Gets rid of ultra-long variable names.
2010-05-18 13:43:27 +02:00
Andrea Canciani
53260148ea quartz: fix repeating radial gradients on 64 bits
Quartz API uses the type CGFloat, which is double on 64 bits,
float on 32 bits architectures
2010-05-17 22:12:36 +02:00
Andrea Canciani
0104976dc8 quartz: silence compiler warnings
All the possible enum values have to be explicitly handled in switch statements.
2010-05-17 22:12:36 +02:00
Andrea Canciani
ac94a00a4d quartz: fallback for A1 images on little endian archs
Quartz uses a bit ordering that is consistent with cairo on big
endian architectures, but isn't on little endian architectures.

Fixes a1-mask and large-source-roi (on little endian)
2010-05-17 22:09:06 +02:00
Andrea Canciani
f40e3b09a1 quartz-font: Silence 0x0 CGContext warning
Silence Quartz complaints about operations on empty contexts:
<Error>: CGContextSetFont: invalid context 0x0
<Error>: CGContextSetFontSize: invalid context 0x0
<Error>: CGContextSetTextMatrix: invalid context 0x0
<Error>: CGContextSetAlpha: invalid context 0x0
<Error>: CGContextShowGlyphsAtPoint: invalid context 0x0
2010-05-17 22:01:50 +02:00
Andrea Canciani
1687e61694 quartz-font: Conform context and antialias handling to quartz-surface
A8 surfaces are now kAlphaOnly surfaces in quartz-font too.
Subpixel font smoothing can be enabled.
2010-05-17 21:34:38 +02:00
Benjamin Otte
d68bbc0fe5 gl: Add missing NULL-check in non-shader code 2010-05-17 20:57:08 +02:00
Benjamin Otte
7f22372edf gl: Get rid of src and mask argument to composite_init()
This was thought of as a way to detect self-painting, but it's better to
check that later in _begin() - when we check it.
2010-05-17 18:54:31 +02:00
Benjamin Otte
75f15babed gl: Implement fill_rectangles with composite
Tiny performance improvement, but a lot less code.
2010-05-17 18:54:31 +02:00
Benjamin Otte
e7c5b4f79f gl: make _set_mask() accept NULL
That way, it can be used to unset the mask.
2010-05-17 18:53:22 +02:00
Chris Wilson
145db7a427 gl: Check status after composite_begin
Skip the unnecessary work in _cairo_gl_surface_composite() if we fail
to setup the GL composite operation.
2010-05-17 12:38:16 +01:00
Chris Wilson
8695c41e80 gl: Throw a _cairo_error when detecting a GLerror
This allows us to easily set an breakpoint and inspect cairo's state
when we do something illegal.
2010-05-17 12:36:54 +01:00
Chris Wilson
1c18ab02c8 gl: Rename cairo_gl_shader_program_t to cairo_gl_shader_t
And complete the move of the shaders into the cairo_gl_shader namespace.
Of particular note, the bind_*_to_shader become
_cairo_gl_shader_bind_*() and have proper types.
2010-05-17 11:54:28 +01:00
Chris Wilson
2325d755b0 gl: Pretty print the error GLenum. 2010-05-17 10:33:46 +01:00
Benjamin Otte
7ef1bd22de gl: Update copyright statements
- add 2010 Red Hat copyright for my code
- include myself as author
- update contributors list
2010-05-17 01:16:16 +02:00
Benjamin Otte
0b69e51b52 gl: Assert that binding values to shaders never fails
As that would  be a programming error, we can use an assert and get rid
of return values that we weren't checking anyway.
2010-05-17 01:16:16 +02:00
Benjamin Otte
0bb11e8f5b gl: Use GL_TRIANGLES instead of GL_QUADS
It seems to increase performance by 1-2% on average and up to 30% in
some cases (on i965).
2010-05-17 01:16:16 +02:00
Benjamin Otte
2b771da47a xlib: ensure variable isn't uninitialized 2010-05-17 01:16:16 +02:00
Benjamin Otte
b768a33a60 gl: Set composite->has_component_alpha based on mask
Previously it was set when initing the composite structure, but that
doesn't allow resetting it when a new mask is used.
2010-05-17 01:16:14 +02:00
Benjamin Otte
1cde4601df gl: Replace _cairo_gl_operand_init() with setters for src/mask
Now cairo_gl_operand_t is no longer exposed outside of
cairo-gl-composite.c
2010-05-17 01:15:47 +02:00
Benjamin Otte
6575cb7a95 gl: Convert glyphs path to use cairo_gl_composite_t 2010-05-17 01:15:47 +02:00
Benjamin Otte
8937f2b4b5 gl: Require ARB_vertex_buffer_object extension unconditionally
<anholt> we shouldn't bother with non-vbo support. there's no
justification for a driver not supporting it.
2010-05-17 01:15:34 +02:00
Benjamin Otte
29dfd5b488 gl: Remove unused variables 2010-05-17 01:13:46 +02:00
Benjamin Otte
4144488f51 gl: Convert span renderer to use cairo_gl_composite_begin/end()
Adds two new APIs to the composite API:
- _cairo_gl_composite_set_mask_spans()
  Tells the composite renderer to use the color values for spans.
- _cairo_gl_composite_set_clip_region()
  Tells the composite renderer to use GL_SCISSORS_TEST to clip when
  drawing. This function is very unperformant, so if it can be avoided,
  it probably shouldn't be used.
2010-05-17 01:13:46 +02:00
Benjamin Otte
6e81d85e36 gl: Change _cairo_gl_composite_emit_rect()
Two changes:
- The function now takes x1/y1,x2/y2 instead of x,y,width,height
- The function takes a color uint32_t. This will be used by spans.
2010-05-17 01:13:46 +02:00
Benjamin Otte
f8398cc2d8 gl: remove unused variables from span renderer 2010-05-17 01:13:46 +02:00
Benjamin Otte
f5c5077def gl: Support component alpha in gl_composite_t
Use that to get rid of cairo_gl_surface_composite_component_alpha()
2010-05-17 01:13:46 +02:00
Benjamin Otte
88c118f891 gl: Implement _composite_emit_rect() and _composite_end()
And use it in cairo_gl_surface_composite()
2010-05-17 01:13:46 +02:00
Benjamin Otte
b96735f7b4 gl: Add _cairo_gl_composite_begin() function
This is the first step at adding the following function set:
_cairo_gl_composite_begin()
_cairo_gl_composite_emit_*()
_cairo_gl_composite_end()
which will take care of proiding a unified model for emitting vertexes
using vbos instead of the 5 different methods we currently have.
2010-05-17 01:13:46 +02:00
Benjamin Otte
211a8b8234 gl: make _cairo_operand_destroy private 2010-05-17 01:13:46 +02:00
Benjamin Otte
bf1060252a gl: make show_glyphs use the cairo_composite_t API 2010-05-17 01:13:46 +02:00
Benjamin Otte
948290de12 gl: Make the span renderer use the new composite APIs 2010-05-17 01:13:46 +02:00
Benjamin Otte
7ad8c3b456 gl: Move composite code into own file
This allows designing a cleaner interface for cairo_composite_t as there
will not be static functions that get called outside of the "published"
interfaces.
2010-05-17 01:13:46 +02:00
Benjamin Otte
3ff32b00f0 gl: cairo_gl_compsite_setup_t => cairo_gl_composite_t 2010-05-17 01:13:46 +02:00
Benjamin Otte
c16edee26f gl: use glBlendFuncSeparate()
This way we can treat alpha-only textures correctly and don't have to
emit different shaders for it. Also gets rid of
GL_OPERAND_TEXTURE_ALPHA.
2010-05-17 01:13:46 +02:00
Benjamin Otte
4f5221a834 gl: acquire device manually in finish, as the default way will error
We'll get CAIRO_STATUS_DEVICE_FINISHED, d'oh
2010-05-17 01:13:46 +02:00
Benjamin Otte
3f63004449 gl: Put shaders into a cache
This allows to grow the complexity of the shaders without enlarging the
static array to unreasonable sizes.

The cache size of 64 is essentially random.
2010-05-17 01:13:46 +02:00
Benjamin Otte
08b04caf52 gl: Add cairo_gl_composite_setup_init/fini() functions
Simplifies the main code paths, and can be extended to do dest copies.
2010-05-17 01:13:46 +02:00
Benjamin Otte
aa14df0db5 gl: move operator check
component alpha compositing checks the operator itself
2010-05-17 01:13:46 +02:00
Benjamin Otte
a3ee0a7f11 gl: Programmatically generate fragment shaders 2010-05-17 01:13:46 +02:00
Benjamin Otte
fe43b13052 gl: Automatically generate the vertex shader source
The idea is being able to generate shaders from the given input
on-demand. This allows creating more advanced shaders, such as those
that include the destination (for self-painting and
unsupported-by-blending operator) or painting images in weird formats
(extra translation step in shader, think YUV).
2010-05-17 01:13:46 +02:00
Benjamin Otte
405eee07ad gl: Get rid of cairo_gl_shader_source/mask_t
Use the cairo_gl_operand_type_t instead. Those enums are pretty much
identical.
2010-05-17 01:13:46 +02:00
Benjamin Otte
5149bb87d7 gl: s/_cairo_gl_set_destination/_cairo_gl_context_set_destination/
It's an operation on the context, so name it accordingly
2010-05-17 01:13:46 +02:00
Benjamin Otte
9f34e403f3 gl: Share vertex shaders
Previously, we created a new vertex shader for every shader program we
used. Now the code shares identical vertex shaders between programs.
2010-05-17 01:13:46 +02:00