Commit graph

8378 commits

Author SHA1 Message Date
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
Adrian Johnson
562c323ae8 cff: Use correct glyph advance when subsetting cff fonts
Previously the glyph advance in font units was used for the widths in
the PDF font dictionary. This only works for cff fonts that use a
[0.001 0 0 0.001 0 0] font matrix.
2010-05-16 20:52:31 +09:30
Adrian Johnson
edcefa87ed type1: Use correct glyph advance when subsetting type 1 fonts
Previously the glyph advance in font units was used for the widths in
the PDF font dictionary. This only works for Type 1 fonts that use a
[0.001 0 0 0.001 0 0] font matrix.

https://bugs.freedesktop.org/show_bug.cgi?id=28061
2010-05-16 20:52:31 +09:30
Chris Wilson
34fd094b3b rtree: Actually pin the node when pinning.
How embarrassing.
2010-05-16 10:23:30 +01:00
Chris Wilson
63062511f6 boilerplate: Exercise manual double-buffering to a window
Shouldn't possibly go wrong, but the mix of fbo and Window might prove
interesting.
2010-05-16 10:15:42 +01:00
Chris Wilson
605be31823 cairo: Missing private markup for _cairo_format_to_pixman_format 2010-05-16 10:11:02 +01:00
Chris Wilson
14d6c3e054 configure: Include PTHREAD_CFLAGS in CAIRO_LDFLAGS
Required for successful linking of our programs. I am not sure what the
impact this has upon other users of Cairo yet, I think we need to export
the PTHREAD_CFLAGS via cairo.pc as well.
2010-05-16 10:07:07 +01:00
Chris Wilson
c3df7e6d58 rtree: Replace undeclared TRUE/FALSE with 1/0 2010-05-16 09:54:04 +01:00
Andrea Canciani
465ceb330e test: improve copyright notices
Conform copyright notices to a1-image-sample.c
2010-05-16 09:41:12 +02:00
Andrea Canciani
e8bc25fdb2 test: add linear-gradient-extend and radial-gradient-extend
Check that constant gradient to solid color optimization are only
applied if the extents permit it.
2010-05-14 22:26:40 +02:00
Benjamin Otte
a9d821b7a0 gl: gl surfaces are only similar when they share the same device
Fixes gl-surface-source test for gl target
2010-05-14 21:07:03 +02:00
Richard Procter
435329a70f Bug 28100 - Font option CAIRO_HINT_METRICS_OFF unhonoured on win32
Fix typo.  Ouch!
2010-05-14 14:48:46 -04:00
Benjamin Otte
3a550eb225 gl: Remove gradient optimizations
These optimizations are done in cairo-gstate.c these days.
2010-05-14 15:57:58 +02:00
Benjamin Otte
3b1c0a4bd6 fallback: Remove span renderer paths
Those paths were broken, as they didn't properly translate the polygon
to the destination size. And rather than adding lots of code that allows
translation, it's easier to just delete this code.

Note that the only user of the code was the GL backend anyway.
2010-05-14 15:56:17 +02:00
Benjamin Otte
e3b2212bc5 build: Fix pthread detection
Incorporate the pthread detection code from the autoconf archive. Should
fix build on obscure archs that pretend to be UNIXy - like Mac OS X
Tiger.

http://www.gnu.org/software/autoconf-archive/
http://www.gnu.org/software/autoconf-archive/ax_pthread.html
2010-05-13 15:17:27 +02:00
Benjamin Otte
acfbf95a0c test: Make global variables in new test static
It seems there's no gcc flag that warns about this.
2010-05-13 15:17:24 +02:00
Benjamin Otte
c69143e3f9 gl: Don't keep a temporary surface in the device
We get circular references that way.
If it turns out later such a cache is critical, we'll need to invent a
way to avoid circling references. For now, just pretend it's not
important.
2010-05-13 12:11:09 +02:00
Benjamin Otte
ec1ca17b71 gl: Don't create 0x0 surfaces
We get a very annoyed libGL if we try to create 0x0 textures, so we
return an image surface instead.

Tested by the zero-mask test.
2010-05-13 12:11:09 +02:00
Benjamin Otte
108e3f5031 Use a solid color for 0xN and Nx0 surfaces
This gets around the need to check for 0-sized surfaces in the backends.
2010-05-13 12:11:09 +02:00
Benjamin Otte
18c963824e Make _cairo_color_equal() work for unmultiplied colors, too
Color stop colors are unmultiplied, and we use it there.
2010-05-13 12:11:09 +02:00
Benjamin Otte
7bd8d0db1f image: Fix wholly unbounded fixup
Tested by zero-mask test.
2010-05-13 12:11:09 +02:00
Benjamin Otte
8aa50b5a78 cairo_paint_with_alpha(cr, 0.0) is only a noop when bounded by mask 2010-05-13 12:11:09 +02:00
Benjamin Otte
ee32dfb3de test: Add a test for various zero mask operations 2010-05-13 12:11:05 +02:00