Commit graph

8356 commits

Author SHA1 Message Date
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
Owen W. Taylor
986ae42320 language bindings guide: clarify mapping for cairo_pattern_create_rgb[a]
Clarify that cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
should be be overloaded as a single constructor for SolidPattern, but
instead should be static methods.
2010-05-13 10:08:32 +01:00
Chris Wilson
18b48a6ebc Make cairo_color_stop_t a unique type.
Hopefully reduce the occurrence of the confusion between the
premultiplied shorts in cairo_color_t and the non-premultiplied shorts
in cairo_color_stop_t.

The existence of the two separate types is debatable and open for
review.
2010-05-13 10:00:18 +01:00
Chris Wilson
dfa2544f15 color: Special case comparing color stops.
color stops are not premultiplied so we need to handle them carefully
when comparing. The next step will be to make cairo_color_stop_t a
unique type to prevent this mistake again.
2010-05-13 09:52:39 +01:00
Chris Wilson
4741d33cf6 gstate: Don't reduce solid source and mask for SOURCE and CLEAR
Not all operators are created equal, and this optimization breaks for
SOURCE and CLEAR where the mask operates on the clip and not the source.
2010-05-13 09:33:12 +01:00
Andrea Canciani
ee871940ff Revert bd672d080c
on src/cairo-composite-rectangles.c

The extent of the operation can be larger than the source if
the operator is not bounded by the source.

Fixes clip-unbounded, operator-source, surface-pattern-operator
2010-05-13 01:57:24 +02:00
Chris Wilson
0870c6fb5b gcc-4.5 warnings and optimisation flags. 2010-05-12 20:54:49 +01:00
Chris Wilson
cf0933a05a gallium: Refresh.
Catch up with changes in APIs, still no substance and the integration
with winsys handles needs review.
2010-05-12 20:54:49 +01:00
Chris Wilson
bd672d080c drm: code dump, sorry.
Lots upon lots of tiny fixes mixed in with experimental code. :(
2010-05-12 20:54:49 +01:00
Chris Wilson
c8fba49603 rtree: Remove the unused evict hook. 2010-05-12 20:54:49 +01:00
Chris Wilson
2a07263373 rtree: defer propagating pinned nodes until eviction.
Only during infrequent eviction do we require absolute knowledge of
which graph of nodes are in use and thus pinned. So during the common
use of querying the glyph cache, we just mark the leaf as used. Then we
need to make space for a new glyph, we move the parents of the left
nodes from the evictable list to the pinned list.
2010-05-12 20:54:49 +01:00
Chris Wilson
cbe8fd0794 script: Avoid the expensive of the redundant memset.
As we are about to immediately fill the entire image, allocate the
memory ourselves to avoid the redundant memset performed by pixman.
2010-05-12 20:54:49 +01:00
Chris Wilson
b9f7a4b526 script: Don't hash the entire image.
The reuse hit rate is very small, and most images are quickly
distinguished in the first few bytes... Though perhaps not for video as
in the swfdec-youtube case...
2010-05-12 20:54:49 +01:00
Chris Wilson
a85c6c1e36 gstate: reduce a couple more operators 2010-05-12 20:54:48 +01:00
Chris Wilson
a3cb52e403 simplify pattern extents for translation matrices 2010-05-12 20:54:48 +01:00
Chris Wilson
d45c7dc62d xcb: discard glyph mask and use dst directly when possible. 2010-05-12 20:54:48 +01:00
Chris Wilson
a8b611ea8e clip: Fill instead of creating intermediate surfaces. 2010-05-12 20:42:18 +01:00
Chris Wilson
fb53d05a69 test: Remove pthread_yield()
I accidentally pushed this debugging left-over from when I was tracking
down a race in memfault. Remove it so that the test suite compiles on
more minimal pthread setups.
2010-05-12 20:09:44 +01:00
Chris Wilson
cdd98dba6a win32-printing: compile fix.
Missing arg for _cairo_recording_surface_replay_region().
2010-05-12 20:09:44 +01:00
Jonathan Kew
35307fc66f win32: Grow glyph extents to account for ClearType
Add extra pixel on each side of the glyph's black box returned by
GetGlyphOutlineW, to avoid clipping ClearType pixels.

From https://bugzilla.mozilla.org/show_bug.cgi?id=445087
2010-05-11 15:12:01 -04:00
Robert O'Callahan
d65e8064c0 Ensure the quartz backend returns the first stop for negative positions on the gradient line of a nonrepeating linear gradient.
I discovered a small bug in cairo-quartz gradients. If you have multiple stops
at position 0, then cairo-quartz pads with the *last* stop at position 0,
instead of the first stop at position 0. This patch fixes that.

From https://bugzilla.mozilla.org/show_bug.cgi?id=513395
2010-05-11 13:59:58 -04:00
Robert O'Callahan
ce27db9a55 Don't repeat a Quartz gradient more times than necessary, to avoid Quartz quality problems when there are lots of repeated color stops.
-- Add a parameter to _cairo_quartz_setup_source so we can pass down the
extents of the object we're drawing
-- Compute fill/stroke/glyph extents and pass them down in the cases we need to
(repeating/reflecting gradients)
-- Pass those extents on down to where we set up the gradients
-- Make _cairo_quartz_setup_linear_source fall back to pixman for the
degenerate case where the linear gradient vector has no length
-- In CreateRepeatingRadialGradientFunction and
CreateRepeatingLinearGradientFunction, use the object extents (or surface
extents, for the paint() case) instead of the clip box to calculate the
parameters for the gradient
-- I've changed the way CreateRepeatingLinearGradientFunction calculates the
repetition count. The new approach gives much more precise bounds on the number
of repetitions needed (and is very similar to what we do for radial gradients).
This is important because if we specify a much larger input range than we
really need for our gradient color function, Quartz samples it too coarsely
over the range we actually care about, and the gradients look bad.

For example, suppose start = (5,0), end = (6,10), the CTM is identity and the
bounds we want to cover is (0,0)-(10,10). I think the current approach sets up
the gradient to be repeated 10 times. In fact only 3 repetitions are needed.

Also, using 'width' here didn't look right:
-       y_rep_end = (int) ceil((surface->extents.width - MAX(mstart.y, mend.y))
/ dy

From https://bugzilla.mozilla.org/show_bug.cgi?id=508730
2010-05-11 13:59:52 -04:00
Robert O'Callahan
7b4e63d5b8 Clean up Quartz gradient code by moving some local variables to static const globals.
From https://bugzilla.mozilla.org/show_bug.cgi?id=508730
2010-05-11 13:59:43 -04:00