Merge branch 'origin'
245
ROADMAP
|
|
@ -1,51 +1,129 @@
|
|||
cairo 1.0.4? bug fixes (I don't know if this release will be needed
|
||||
or not, but I wanted a place to lodge a bug that slipped from 1.0.2
|
||||
===================================================================
|
||||
For each bug number XXXX below, see:
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=XXXX
|
||||
4630 Fonts too large when drawing to image surface while printing
|
||||
4863 stroking problems with wide dashed lines
|
||||
This is the cairo roadmap.
|
||||
|
||||
cairo 1.2.0 essential features (targeted for 2006-03-08)
|
||||
The release won't happen without these being complete.
|
||||
Everything here is subject to change, but it is hoped that all of it
|
||||
will be useful. If you want to influence, please feel free to get
|
||||
involved with cairo (see http://cairographics.org ).
|
||||
|
||||
The intent is for this to be a living document. We want both the users
|
||||
of cairo, (GTK+, GNOME, Mozilla, Mono, etc. etc.) to let us know
|
||||
features they need and dates by which they are needed so that we can
|
||||
use those to guide our plans.
|
||||
|
||||
Additionally, people who are actively developing cairo itself should
|
||||
regularly update this document to reflect their current plans. If you
|
||||
don't want to see a particular release happen without some essential
|
||||
feature, then put that feature on the list and put your name next to
|
||||
it to indicate you are working on it.
|
||||
|
||||
Targets
|
||||
=======
|
||||
GTK+ 2.10 - http://www.gtk.org/plan/2.10/
|
||||
------------------------------------------
|
||||
The 2.10 release is scheduled for May 2006, (to be in time for GNOME 2.16).
|
||||
|
||||
Satisfying GTK+ 2.10 well requires releasing cairo 1.2 with good
|
||||
printing support, (good PS/PDF output, per-page sizing and layout,
|
||||
etc.) sometime in April 2006.
|
||||
|
||||
|
||||
Firefox 3.0 - http://www.mozilla.org/projects/firefox/roadmap.html
|
||||
------------------------------------------------------------------
|
||||
Firefox 3 (scheduled for early 2007?) is the first release expected to
|
||||
use cairo for all rendering. In the meantime, development builds using
|
||||
cairo are available
|
||||
|
||||
Satisfying firefox 3 well requiring releasing new versions of cairo in
|
||||
2006 that incorporate the patches coming from mozilla, (device offset,
|
||||
push/pop_group), and much-improved performance.
|
||||
|
||||
Themes and Schedules
|
||||
====================
|
||||
cairo-1.2 (April 2006): Better printing
|
||||
- Supported PS/PDF output
|
||||
- New, printing-oriented API
|
||||
- Mozilla patches? (device offset, push/pop_group)
|
||||
|
||||
cairo-1.x (October 2006): Better performance
|
||||
- New tessellator
|
||||
- New rasterization
|
||||
- Mozilla patches
|
||||
|
||||
And there is room for other releases between those as needed. Once the
|
||||
mozilla patches land, we don't really have a lot of new API on the
|
||||
roadmap so it's hard to know whether any other releases would be 1.4
|
||||
vs. 1.2.2, etc.
|
||||
|
||||
cairo 1.2.0 essential features
|
||||
We don't expect to release without these being complete.
|
||||
========================================================
|
||||
A. PS backend
|
||||
----------
|
||||
✓1. Mark PS backend as supported:
|
||||
|
||||
PDF backend
|
||||
✓1. Mark PDF backend as supported
|
||||
✓a. Incorporate into test suite
|
||||
|
||||
✓b. Correct output for the entire test suite
|
||||
|
||||
2. Image fallbacks at finer-than-whole-page granularity
|
||||
|
||||
2. Reasonable, native output for common uses
|
||||
✓a. Switch to using cairo_paginated_surface_t
|
||||
✓b. Opaque text and images are all native
|
||||
✓c. Translucent objects (using OVER) are also native
|
||||
d. Text output uses PDF font features
|
||||
|
||||
b. Add analysis and clever replay to
|
||||
cairo_paginated_surface_t
|
||||
Printing-oriented API
|
||||
1. Per-page settings (paper size, layout, anything else?)
|
||||
2. Document metadata
|
||||
|
||||
B. PDF backend
|
||||
-----------
|
||||
✓1. Mark PDF backend as supported
|
||||
Mozilla needs
|
||||
1. Device-offset rework
|
||||
2. Push/pop_group
|
||||
|
||||
✓a. Incorporate into test suite
|
||||
Bug fixes (For each XXXX, see: https://bugs.freedesktop.org/show_bug.cgi?id=XXXX )
|
||||
4630 Fonts too large when drawing to image surface while printing
|
||||
4863 stroking problems with wide dashed lines
|
||||
FC_GLOBAL_ADVANCE (http://lists.freedesktop.org/archives/cairo/2005-August/004893.html)
|
||||
4705 crash at XRenderAddGlyphs
|
||||
cairo_{ps,pdf}_surface_set_dpi have no effect
|
||||
cairo_set_line_width should immediately use CTM
|
||||
_transform_glyph_bitmap http://lists.freedesktop.org/archives/cairo/2005-October/005564.html
|
||||
6759 fontconfig option AntiAlias doesn't work in cairo 1.1.2
|
||||
|
||||
✓b. Correct output for the entire test suite (use image
|
||||
fallbacks as necessary).
|
||||
|
||||
2. Image fallbacks at finer-than-whole-page granularity
|
||||
|
||||
✓a. Switch to using cairo_paginated_surface_t
|
||||
|
||||
b. Add analysis and clever replay to
|
||||
cairo_paginated_surface_t
|
||||
|
||||
E. Fix memory leaks
|
||||
----------------
|
||||
Fix memory leaks
|
||||
1. Ensure 'make check-valgrind' passes with no leaks
|
||||
|
||||
H. Mozilla patches (at the very least, these need a response)
|
||||
----------------------------------------------------------
|
||||
Performance improvements
|
||||
✓1. Speed up glyph measurement (cache rewrite)
|
||||
2. Speed up gradient computations
|
||||
✓a. Better software gradients
|
||||
b. Use X server gradients when available
|
||||
|
||||
✓PS backend
|
||||
✓1. Mark PS backend as supported:
|
||||
✓a. Incorporate into test suite
|
||||
✓b. Correct output for the entire test suite
|
||||
|
||||
✓2. Reasonable, native output for common uses
|
||||
✓a. Switch to using cairo_paginated_surface_t
|
||||
✓b. Opaque text and images are all native
|
||||
✓c. Text output uses PostScript font features
|
||||
|
||||
✓Pango needs
|
||||
✓5496 Add getters for cairo_scaled_font_t
|
||||
✓5495 Need cairo_scaled_font_text_extents
|
||||
|
||||
✓SVG backend
|
||||
✓1. Add experimental SVG backend
|
||||
✓2. Incorporate into test suite
|
||||
|
||||
cairo 1.2.0 desired features
|
||||
If these aren't ready, they won't be in the release.
|
||||
======================================================
|
||||
Win32 backend
|
||||
✓1. Incorporate into test suite
|
||||
2. Correct output for the entire suite
|
||||
a. self-copy
|
||||
b. trap-clip
|
||||
[There is some mailing-list discussion about possible fixes
|
||||
for these.]
|
||||
|
||||
Mozilla patches
|
||||
1. Misc compilation fixes for pixman (submitted upstream)
|
||||
2. mac compilation fix for cairo-atsui-font.c for 10.2 SDK (maybe should
|
||||
be upstream?)
|
||||
|
|
@ -55,106 +133,45 @@ The release won't happen without these being complete.
|
|||
(submitted upstream)
|
||||
5. Add GdiFlush() calls before each image surface get
|
||||
(Submitted upstream: https://bugs.freedesktop.org/show_bug.cgi?id=5845)
|
||||
6. Move device offset/scale handling into surface layer; large rework
|
||||
of device offset/scale. (submitted upstream)
|
||||
7. push-pop-group.patch (Updated 9 Feb 06)
|
||||
Implementation of push/pop group API; depends on device-offset-scale.
|
||||
(submitted upstream)
|
||||
|
||||
cairo 1.2.0 desired features (targeted for 2006-01-13)
|
||||
If these aren't ready, they won't be in the release.
|
||||
[There are some bugs that need to be added here, and
|
||||
some bugs that should be bumped up into the essential
|
||||
features section.]
|
||||
======================================================
|
||||
|
||||
C. Win32 backend
|
||||
-------------
|
||||
✓1. Incorporate into test suite
|
||||
|
||||
2. Correct output for the entire suite
|
||||
a. self-copy
|
||||
b. trap-clip
|
||||
|
||||
[There is some mailing-list discussion about possible fixes
|
||||
for these.]
|
||||
|
||||
D. Bug fixes
|
||||
---------
|
||||
✓1. Fix dashed splines.
|
||||
|
||||
Bug fixes
|
||||
2. Fix some expected failures (XFAIL) in the test suite
|
||||
|
||||
a. a8-mask
|
||||
|
||||
✓b. clip-all
|
||||
|
||||
c. filter-nearest-offset
|
||||
|
||||
d. pixman-rotate
|
||||
|
||||
e. extend-reflect
|
||||
|
||||
E. API Additions
|
||||
-------------
|
||||
1. cairo_begin/end/get_group
|
||||
Status: cworth has a posted a preliminary patch, and keithp,
|
||||
krh, and otaylor answered all the tough questions it
|
||||
raised. There's not much work left to finish this one.
|
||||
Vladimir Vukicevic has taken up the torch on this and
|
||||
has posted an almost-complete set of patches.
|
||||
New API
|
||||
cairo_arc_to
|
||||
see http://lists.freedesktop.org/archives/cairo/2005-August/004801.html
|
||||
or see arc_to branch in bedhad's repository
|
||||
|
||||
2. The pango developers need one or two additions in order to
|
||||
implement pango's hex-box drawing.
|
||||
|
||||
5496 Add getters for cairo_scaled_font_t
|
||||
- This looks trivial, and is maybe "enough" for an ugly
|
||||
solution in pango.
|
||||
|
||||
5495 Need cairo_scaled_font_text_extents
|
||||
- I think I would actually prefer to add
|
||||
cairo_text_to_glyphs for this fix.
|
||||
|
||||
F. Performance improvements
|
||||
------------------------
|
||||
Performance improvements
|
||||
1. Cull and trim trapezoids outside clip region bounds
|
||||
|
||||
2. Generate more large pixel-aligned, rectangular trapezoids
|
||||
|
||||
✓3. Speed up glyph measurement (cache rewrite)
|
||||
Longer-term desired stuff for cairo (not scheduled for any particular release)
|
||||
==============================================================================
|
||||
PS/PDF improvements
|
||||
1. Make image fallbacks finer-grained than a whole page
|
||||
2. Ensure that PDF text output is "selectable"
|
||||
|
||||
✓4. Speed up gradient computations
|
||||
|
||||
G. SVG backend
|
||||
-----------
|
||||
✓1. Add experimental SVG backend
|
||||
|
||||
cairo 1.4.0 desired features (Schedule unknown)
|
||||
===============================================
|
||||
A. Quartz backend (maintainer needed!)
|
||||
-----------------------------------
|
||||
Quartz backend (maintainer needed!)
|
||||
1. Mark Quartz backend as supported:
|
||||
|
||||
a. Incorporate into test suite
|
||||
|
||||
b. Correct output for the entire suite
|
||||
|
||||
B. SVG backend
|
||||
-----------
|
||||
1. Mark SVG backend as supported
|
||||
SVG backend
|
||||
1. Correct output for the entire test suite
|
||||
|
||||
a. Incorporate into test suite
|
||||
|
||||
b. Correct output for the entire suite
|
||||
|
||||
B. Performance improvements
|
||||
------------------------
|
||||
Performance improvements
|
||||
1. New tessellator (more robust and faster)
|
||||
|
||||
C. Bug fixes
|
||||
---------
|
||||
Bug fixes
|
||||
1. Fix all expected failures (XFAIL) in the test suite
|
||||
|
||||
a. self-intersecting
|
||||
AKA. https://bugs.freedesktop.org/show_bug.cgi?id=3752
|
||||
Fix depends on [A1].
|
||||
b. text-rotate
|
||||
|
|
|
|||
|
|
@ -207,9 +207,6 @@ libcairo_la_LIBADD = $(top_builddir)/pixman/src/libpixman.la $(CAIRO_LIBS) $(noi
|
|||
|
||||
libcairo_la_DEPENDENCIES = $(cairo_def_dependency) $(top_builddir)/pixman/src/libpixman.la $(noinst_LTLIBRARIES)
|
||||
|
||||
EXTRA_DIST = \
|
||||
cairo.def
|
||||
|
||||
cairo.def: $(cairo_win32_api_headers)
|
||||
(echo EXPORTS; \
|
||||
cat $(cairo_win32_api_headers) | \
|
||||
|
|
|
|||
|
|
@ -271,6 +271,9 @@ _cairo_image_surface_create_with_content (cairo_content_t content,
|
|||
* This function always returns a valid pointer, but it will return a
|
||||
* pointer to a "nil" surface if an error such as out of memory
|
||||
* occurs. You can use cairo_surface_status() to check for this.
|
||||
*
|
||||
* See cairo_surface_set_user_data() for a means of attaching a
|
||||
* destroy-notification fallback to the surface if necessary.
|
||||
**/
|
||||
cairo_surface_t *
|
||||
cairo_image_surface_create_for_data (unsigned char *data,
|
||||
|
|
|
|||
|
|
@ -137,6 +137,9 @@ typedef struct _cairo_meta_surface {
|
|||
|
||||
cairo_array_t commands;
|
||||
cairo_surface_t *commands_owner;
|
||||
|
||||
cairo_bool_t is_clipped;
|
||||
int replay_start_idx;
|
||||
} cairo_meta_surface_t;
|
||||
|
||||
cairo_private cairo_surface_t *
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ _cairo_meta_surface_create (cairo_content_t content,
|
|||
_cairo_array_init (&meta->commands, sizeof (cairo_command_t *));
|
||||
meta->commands_owner = NULL;
|
||||
|
||||
meta->is_clipped = FALSE;
|
||||
meta->replay_start_idx = 0;
|
||||
|
||||
return &meta->base;
|
||||
}
|
||||
|
||||
|
|
@ -226,6 +229,12 @@ _cairo_meta_surface_paint (void *abstract_surface,
|
|||
cairo_meta_surface_t *meta = abstract_surface;
|
||||
cairo_command_paint_t *command;
|
||||
|
||||
/* An optimisation that takes care to not replay what was done
|
||||
* before surface is cleared. We don't erase recorded commands
|
||||
* since we may have earlier snapshots of this surface. */
|
||||
if (op == CAIRO_OPERATOR_CLEAR && !meta->is_clipped)
|
||||
meta->replay_start_idx = meta->commands.num_elements;
|
||||
|
||||
command = malloc (sizeof (cairo_command_paint_t));
|
||||
if (command == NULL)
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
|
|
@ -473,6 +482,7 @@ _cairo_meta_surface_snapshot (void *abstract_other)
|
|||
|
||||
meta->width_pixels = other->width_pixels;
|
||||
meta->height_pixels = other->height_pixels;
|
||||
meta->replay_start_idx = other->replay_start_idx;
|
||||
|
||||
_cairo_array_init_snapshot (&meta->commands, &other->commands);
|
||||
meta->commands_owner = cairo_surface_reference (&other->base);
|
||||
|
|
@ -504,8 +514,10 @@ _cairo_meta_surface_intersect_clip_path (void *dst,
|
|||
return status;
|
||||
}
|
||||
command->path_pointer = &command->path;
|
||||
meta->is_clipped = TRUE;
|
||||
} else {
|
||||
command->path_pointer = NULL;
|
||||
meta->is_clipped = FALSE;
|
||||
}
|
||||
command->fill_rule = fill_rule;
|
||||
command->tolerance = tolerance;
|
||||
|
|
@ -610,7 +622,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface,
|
|||
|
||||
num_elements = meta->commands.num_elements;
|
||||
elements = _cairo_array_index (&meta->commands, 0);
|
||||
for (i = 0; i < num_elements; i++) {
|
||||
for (i = meta->replay_start_idx; i < num_elements; i++) {
|
||||
command = elements[i];
|
||||
switch (command->type) {
|
||||
case CAIRO_COMMAND_PAINT:
|
||||
|
|
|
|||
|
|
@ -79,12 +79,6 @@ const cairo_private cairo_surface_backend_t cairo_paginated_surface_backend;
|
|||
static cairo_int_status_t
|
||||
_cairo_paginated_surface_show_page (void *abstract_surface);
|
||||
|
||||
/* XXX: This would seem the natural thing to do here. But currently,
|
||||
* PDF and PS surfaces do not yet work as source surfaces. So instead,
|
||||
* we don't implement create_similar for the paginate_surface which
|
||||
* means that any create_similar() call on a paginated_surfacae will
|
||||
* result in a new image surface. */
|
||||
#if 0
|
||||
static cairo_surface_t *
|
||||
_cairo_paginated_surface_create_similar (void *abstract_surface,
|
||||
cairo_content_t content,
|
||||
|
|
@ -95,7 +89,6 @@ _cairo_paginated_surface_create_similar (void *abstract_surface,
|
|||
return cairo_surface_create_similar (surface->target, content,
|
||||
width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
cairo_surface_t *
|
||||
_cairo_paginated_surface_create (cairo_surface_t *target,
|
||||
|
|
@ -241,6 +234,8 @@ _paint_page (cairo_paginated_surface_t *surface)
|
|||
{
|
||||
_cairo_meta_surface_replay (surface->meta, surface->target);
|
||||
}
|
||||
|
||||
cairo_surface_destroy (analysis);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
@ -469,7 +464,7 @@ _cairo_paginated_surface_snapshot (void *abstract_other)
|
|||
|
||||
const cairo_surface_backend_t cairo_paginated_surface_backend = {
|
||||
CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
|
||||
NULL, /* create_similar --- see note for _cairo_paginated_surface_create_similar */
|
||||
_cairo_paginated_surface_create_similar,
|
||||
_cairo_paginated_surface_finish,
|
||||
_cairo_paginated_surface_acquire_source_image,
|
||||
_cairo_paginated_surface_release_source_image,
|
||||
|
|
|
|||
|
|
@ -456,10 +456,11 @@ _cairo_pdf_surface_create_similar (void *abstract_src,
|
|||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_pdf_surface_t *template = abstract_src;
|
||||
cairo_format_t format = _cairo_format_from_content (content);
|
||||
|
||||
return _cairo_pdf_surface_create_for_document (template->document,
|
||||
width, height);
|
||||
/* Just return an image for now, until PDF surface can be used
|
||||
* as source. */
|
||||
return cairo_image_surface_create (format, width, height);
|
||||
}
|
||||
|
||||
static cairo_pdf_stream_t *
|
||||
|
|
|
|||
|
|
@ -762,6 +762,19 @@ _word_wrap_stream_write (void *closure,
|
|||
return _cairo_output_stream_get_status (stream->output);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_word_wrap_stream_close (void *closure)
|
||||
{
|
||||
cairo_status_t status;
|
||||
word_wrap_stream_t *stream = closure;
|
||||
|
||||
status = _cairo_output_stream_get_status (stream->output);
|
||||
|
||||
free (stream);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static cairo_output_stream_t *
|
||||
_word_wrap_stream_create (cairo_output_stream_t *output, int max_column)
|
||||
{
|
||||
|
|
@ -777,7 +790,20 @@ _word_wrap_stream_create (cairo_output_stream_t *output, int max_column)
|
|||
stream->last_write_was_space = FALSE;
|
||||
|
||||
return _cairo_output_stream_create (_word_wrap_stream_write,
|
||||
NULL, stream);
|
||||
_word_wrap_stream_close, stream);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_ps_surface_create_similar (void *abstract_src,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_format_t format = _cairo_format_from_content (content);
|
||||
|
||||
/* Just return an image for now, until PS surface can be used
|
||||
* as source. */
|
||||
return cairo_image_surface_create (format, width, height);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
@ -1634,7 +1660,7 @@ _cairo_ps_surface_set_paginated_mode (void *abstract_surface,
|
|||
|
||||
static const cairo_surface_backend_t cairo_ps_surface_backend = {
|
||||
CAIRO_SURFACE_TYPE_PS,
|
||||
NULL, /* create_similar */
|
||||
_cairo_ps_surface_create_similar,
|
||||
_cairo_ps_surface_finish,
|
||||
NULL, /* acquire_source_image */
|
||||
NULL, /* release_source_image */
|
||||
|
|
|
|||
|
|
@ -39,6 +39,14 @@
|
|||
#include <cairo-win32.h>
|
||||
#include <cairoint.h>
|
||||
|
||||
#ifndef SHADEBLENDCAPS
|
||||
#define SHADEBLENDCAPS 120
|
||||
#endif
|
||||
#ifndef SB_NONE
|
||||
#define SB_NONE 0
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _cairo_win32_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
10
src/cairo.c
|
|
@ -623,9 +623,9 @@ cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule)
|
|||
*
|
||||
* Sets the current line width within the cairo context. The line
|
||||
* width specifies the diameter of a pen that is circular in
|
||||
* user-space.
|
||||
* user space.
|
||||
*
|
||||
* As with the other stroke parameters, the current line cap style is
|
||||
* As with the other stroke parameters, the current line width is
|
||||
* examined by cairo_stroke(), cairo_stroke_extents(), and
|
||||
* cairo_stroke_to_path(), but does not have any effect during path
|
||||
* construction.
|
||||
|
|
@ -1131,9 +1131,9 @@ cairo_curve_to (cairo_t *cr,
|
|||
* arc.
|
||||
*
|
||||
* Angles are measured in radians. An angle of 0.0 is in the direction
|
||||
* of the positive X axis (in user-space). An angle of %M_PI/2.0 radians
|
||||
* of the positive X axis (in user space). An angle of %M_PI/2.0 radians
|
||||
* (90 degrees) is in the direction of the positive Y axis (in
|
||||
* user-space). Angles increase in the direction from the positive X
|
||||
* user space). Angles increase in the direction from the positive X
|
||||
* axis toward the positive Y axis. So with the default transformation
|
||||
* matrix, angles increase in a clockwise direction.
|
||||
*
|
||||
|
|
@ -1144,7 +1144,7 @@ cairo_curve_to (cairo_t *cr,
|
|||
* see cairo_arc_negative() to get the arc in the direction of
|
||||
* decreasing angles.
|
||||
*
|
||||
* The arc is circular in user-space. To achieve an elliptical arc,
|
||||
* The arc is circular in user space. To achieve an elliptical arc,
|
||||
* you can scale the current transformation matrix by different
|
||||
* amounts in the X and Y directions. For example, to draw an ellipse
|
||||
* in the box given by @x, @y, @width, @height:
|
||||
|
|
|
|||
2
test/.gitignore
vendored
|
|
@ -30,8 +30,10 @@ font-face-get-type
|
|||
get-and-set
|
||||
gradient-alpha
|
||||
imagediff
|
||||
leaky-dash
|
||||
leaky-polygon
|
||||
line-width
|
||||
line-width-scale
|
||||
linear-gradient
|
||||
mask
|
||||
mask-ctm
|
||||
|
|
|
|||
129
test/Makefile.am
|
|
@ -25,8 +25,10 @@ filter-nearest-offset \
|
|||
font-face-get-type \
|
||||
get-and-set \
|
||||
gradient-alpha \
|
||||
leaky-dash \
|
||||
leaky-polygon \
|
||||
line-width \
|
||||
line-width-scale \
|
||||
linear-gradient \
|
||||
mask \
|
||||
mask-ctm \
|
||||
|
|
@ -111,15 +113,10 @@ endif
|
|||
# way to avoid it? Can I use a wildcard here?
|
||||
EXTRA_DIST = \
|
||||
a8-mask-ref.png \
|
||||
a8-mask-rgb24-ref.png \
|
||||
caps-joins-ref.png \
|
||||
caps-joins-rgb24-ref.png \
|
||||
caps-joins-alpha-ref.png \
|
||||
caps-joins-alpha-rgb24-ref.png \
|
||||
caps-sub-paths-ref.png \
|
||||
caps-sub-paths-rgb24-ref.png \
|
||||
clip-all-ref.png \
|
||||
clip-all-rgb24-ref.png \
|
||||
clip-fill-rule-ref.png \
|
||||
clip-fill-rule-pixel-aligned-ref.png \
|
||||
clip-nesting-ref.png \
|
||||
|
|
@ -130,18 +127,11 @@ clip-twice-ref.png \
|
|||
clip-twice-rgb24-ref.png \
|
||||
composite-integer-translate-over-ref.png \
|
||||
composite-integer-translate-over-repeat-ref.png \
|
||||
composite-integer-translate-over-repeat-rgb24-ref.png \
|
||||
composite-integer-translate-over-rgb24-ref.png \
|
||||
composite-integer-translate-source-ref.png \
|
||||
composite-integer-translate-source-rgb24-ref.png \
|
||||
create-from-png-ref.png \
|
||||
create-from-png-rgb24-ref.png \
|
||||
create-from-png-stream-ref.png \
|
||||
create-from-png-stream-rgb24-ref.png \
|
||||
dash-caps-joins-ref.png \
|
||||
dash-caps-joins-rgb24-ref.png \
|
||||
dash-offset-negative-ref.png \
|
||||
dash-offset-negative-rgb24-ref.png \
|
||||
dash-zero-length-ref.png \
|
||||
dash-zero-length-rgb24-ref.png \
|
||||
fill-and-stroke-ref.png \
|
||||
|
|
@ -149,15 +139,13 @@ fill-and-stroke-rgb24-ref.png \
|
|||
fill-rule-ref.png \
|
||||
fill-rule-rgb24-ref.png \
|
||||
filter-nearest-offset-ref.png \
|
||||
filter-nearest-offset-rgb24-ref.png \
|
||||
gradient-alpha-ref.png \
|
||||
gradient-alpha-rgb24-ref.png \
|
||||
leaky-dash-ref.png \
|
||||
leaky-polygon-ref.png \
|
||||
leaky-polygon-rgb24-ref.png \
|
||||
linear-gradient-ref.png \
|
||||
linear-gradient-rgb24-ref.png \
|
||||
line-width-ref.png \
|
||||
line-width-rgb24-ref.png \
|
||||
line-width-scale-ref.png \
|
||||
mask-ctm-ref.png \
|
||||
mask-ctm-rgb24-ref.png \
|
||||
mask-ref.png \
|
||||
|
|
@ -165,7 +153,6 @@ mask-rgb24-ref.png \
|
|||
mask-surface-ctm-ref.png \
|
||||
mask-surface-ctm-rgb24-ref.png \
|
||||
move-to-show-surface-ref.png \
|
||||
move-to-show-surface-rgb24-ref.png \
|
||||
new-sub-path-ref.png \
|
||||
new-sub-path-rgb24-ref.png \
|
||||
nil-surface-ref.png \
|
||||
|
|
@ -175,53 +162,39 @@ operator-clear-rgb24-ref.png \
|
|||
operator-source-ref.png \
|
||||
operator-source-rgb24-ref.png \
|
||||
paint-ref.png \
|
||||
paint-rgb24-ref.png \
|
||||
paint-source-alpha-ref.png \
|
||||
paint-source-alpha-rgb24-ref.png \
|
||||
paint-with-alpha-ref.png \
|
||||
paint-with-alpha-rgb24-ref.png \
|
||||
path-data-ref.png \
|
||||
path-data-rgb24-ref.png \
|
||||
pixman-rotate-ref.png \
|
||||
pixman-rotate-rgb24-ref.png \
|
||||
rectangle-rounding-error-ref.png \
|
||||
rectangle-rounding-error-rgb24-ref.png \
|
||||
rel-path-ref.png \
|
||||
rel-path-rgb24-ref.png \
|
||||
romedalen.png \
|
||||
scale-source-surface-paint-ref.png \
|
||||
scale-source-surface-paint-rgb24-ref.png \
|
||||
self-copy-ref.png \
|
||||
self-copy-rgb24-ref.png \
|
||||
self-intersecting-ref.png \
|
||||
self-intersecting-rgb24-ref.png \
|
||||
set-source-ref.png \
|
||||
set-source-rgb24-ref.png \
|
||||
show-glyphs-many-ref.png \
|
||||
show-text-current-point-ref.png \
|
||||
show-text-current-point-rgb24-ref.png \
|
||||
source-clip-ref.png \
|
||||
source-clip-rgb24-ref.png \
|
||||
source-surface-scale-paint-ref.png \
|
||||
source-surface-scale-paint-rgb24-ref.png \
|
||||
surface-pattern-ref.png \
|
||||
surface-pattern-rgb24-ref.png \
|
||||
text-antialias-gray-ref.png \
|
||||
text-antialias-gray-rgb24-ref.png \
|
||||
text-antialias-none-ref.png \
|
||||
text-antialias-none-rgb24-ref.png \
|
||||
text-antialias-subpixel-ref.png \
|
||||
text-antialias-subpixel-rgb24-ref.png \
|
||||
text-pattern-ref.png \
|
||||
text-pattern-rgb24-ref.png \
|
||||
text-rotate-rgb24-ref.png \
|
||||
transforms-ref.png \
|
||||
transforms-rgb24-ref.png \
|
||||
translate-show-surface-ref.png \
|
||||
translate-show-surface-rgb24-ref.png \
|
||||
trap-clip-ref.png \
|
||||
trap-clip-rgb24-ref.png \
|
||||
unantialiased-shapes-ref.png \
|
||||
unantialiased-shapes-rgb24-ref.png \
|
||||
unbounded-operator-ref.png \
|
||||
unbounded-operator-rgb24-ref.png
|
||||
|
||||
|
|
@ -284,109 +257,31 @@ if CAIRO_HAS_DIRECTFB_SURFACE
|
|||
libcairotest_la_SOURCES += cairo-test-directfb.c cairo-test-directfb.h
|
||||
endif
|
||||
|
||||
LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la
|
||||
LDADD = libcairotest.la $(top_builddir)/src/libcairo.la
|
||||
|
||||
if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
|
||||
LDADDS += $(GLITZ_AGL_LIBS)
|
||||
LDADD += $(GLITZ_AGL_LIBS)
|
||||
endif
|
||||
if CAIRO_CAN_TEST_GLITZ_EGL_SURFACE
|
||||
LDADDS += $(GLITZ_EGL_LIBS)
|
||||
LDADD += $(GLITZ_EGL_LIBS)
|
||||
endif
|
||||
if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
|
||||
LDADDS += $(GLITZ_GLX_LIBS)
|
||||
LDADD += $(GLITZ_GLX_LIBS)
|
||||
endif
|
||||
if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE
|
||||
LDADDS += $(GLITZ_WGL_LIBS)
|
||||
LDADD += $(GLITZ_WGL_LIBS)
|
||||
endif
|
||||
|
||||
if HAVE_PTHREAD
|
||||
LDADDS += -lpthread
|
||||
LDADD += -lpthread
|
||||
endif
|
||||
|
||||
# ARGH! I have to repeat the list of tests a third time. Maybe it's
|
||||
# time to break down and auto-generate the Makefile.am or something
|
||||
# from autogen.sh. My, but this is painful...
|
||||
a8_mask_LDADD = $(LDADDS)
|
||||
caps_joins_LDADD = $(LDADDS)
|
||||
caps_joins_alpha_LDADD = $(LDADDS)
|
||||
caps_sub_paths_LDADD = $(LDADDS)
|
||||
clip_all_LDADD = $(LDADDS)
|
||||
clip_fill_rule_LDADD = $(LDADDS)
|
||||
clip_fill_rule_pixel_aligned_LDADD = $(LDADDS)
|
||||
clip_nesting_LDADD = $(LDADDS)
|
||||
clip_operator_LDADD = $(LDADDS)
|
||||
clip_twice_LDADD = $(LDADDS)
|
||||
composite_integer_translate_source_LDADD = $(LDADDS)
|
||||
composite_integer_translate_over_LDADD = $(LDADDS)
|
||||
composite_integer_translate_over_repeat_LDADD = $(LDADDS)
|
||||
create_from_png_LDADD = $(LDADDS)
|
||||
create_from_png_stream_LDADD = $(LDADDS)
|
||||
dash_caps_joins_LDADD = $(LDADDS)
|
||||
dash_offset_negative_LDADD = $(LDADDS)
|
||||
dash_zero_length_LDADD = $(LDADDS)
|
||||
extend_reflect_LDADD = $(LDADDS)
|
||||
fill_and_stroke_LDADD = $(LDADDS)
|
||||
fill_rule_LDADD = $(LDADDS)
|
||||
font_face_get_type_LDADD = $(LDADDS)
|
||||
filter_nearest_offset_LDADD = $(LDADDS)
|
||||
ft_font_create_for_ft_face_LDADD = $(LDADDS)
|
||||
get_and_set_LDADD = $(LDADDS)
|
||||
gradient_alpha_LDADD = $(LDADDS)
|
||||
leaky_polygon_LDADD = $(LDADDS)
|
||||
line_width_LDADD = $(LDADDS)
|
||||
linear_gradient_LDADD = $(LDADDS)
|
||||
mask_LDADD = $(LDADDS)
|
||||
mask_ctm_LDADD = $(LDADDS)
|
||||
mask_surface_ctm_LDADD = $(LDADDS)
|
||||
multi_page_LDADD = $(LDADDS)
|
||||
move_to_show_surface_LDADD = $(LDADDS)
|
||||
new_sub_path_LDADD = $(LDADDS)
|
||||
nil_surface_LDADD = $(LDADDS)
|
||||
operator_clear_LDADD = $(LDADDS)
|
||||
operator_source_LDADD = $(LDADDS)
|
||||
paint_LDADD = $(LDADDS)
|
||||
paint_source_alpha_LDADD = $(LDADDS)
|
||||
paint_with_alpha_LDADD = $(LDADDS)
|
||||
path_data_LDADD = $(LDADDS)
|
||||
pattern_get_type_LDADD = $(LDADDS)
|
||||
svg_surface_LDADD = $(LDADDS)
|
||||
svg_clip_LDADD = $(LDADDS)
|
||||
pixman_rotate_LDADD = $(LDADDS)
|
||||
pthread_show_text_LDADD = $(LDADDS)
|
||||
rectangle_rounding_error_LDADD = $(LDADDS)
|
||||
scale_source_surface_paint_LDADD = $(LDADDS)
|
||||
select_font_no_show_text_LDADD = $(LDADDS)
|
||||
self_copy_LDADD = $(LDADDS)
|
||||
self_intersecting_LDADD = $(LDADDS)
|
||||
set_source_LDADD = $(LDADDS)
|
||||
show_text_current_point_LDADD = $(LDADDS)
|
||||
source_clip_LDADD = $(LDADDS)
|
||||
source_surface_scale_paint_LDADD = $(LDADDS)
|
||||
surface_finish_twice_LDADD = $(LDADDS)
|
||||
surface_pattern_LDADD = $(LDADDS)
|
||||
text_antialias_gray_LDADD = $(LDADDS)
|
||||
text_antialias_none_LDADD = $(LDADDS)
|
||||
text_antialias_subpixel_LDADD = $(LDADDS)
|
||||
text_cache_crash_LDADD = $(LDADDS)
|
||||
text_pattern_LDADD = $(LDADDS)
|
||||
text_rotate_LDADD = $(LDADDS)
|
||||
transforms_LDADD = $(LDADDS)
|
||||
translate_show_surface_LDADD = $(LDADDS)
|
||||
trap_clip_LDADD = $(LDADDS)
|
||||
unantialiased_shapes_LDADD = $(LDADDS)
|
||||
unbounded_operator_LDADD = $(LDADDS)
|
||||
user_data_LDADD = $(LDADDS)
|
||||
rel_path_LDADD = $(LDADDS)
|
||||
xlib_surface_LDADD = $(LDADDS)
|
||||
|
||||
noinst_PROGRAMS = imagediff png-flatten
|
||||
imagediff_LDADD = $(LDADDS)
|
||||
png_flatten_LDADD = $(LDADDS)
|
||||
|
||||
if CAIRO_CAN_TEST_PDF_SURFACE
|
||||
noinst_PROGRAMS += pdf2png
|
||||
pdf2png_CFLAGS = $(POPPLER_CFLAGS)
|
||||
pdf2png_LDADD = $(LDADDS) $(POPPLER_LIBS)
|
||||
pdf2png_LDADD = $(LDADD) $(POPPLER_LIBS)
|
||||
endif
|
||||
|
||||
if CAIRO_CAN_TEST_SVG_SURFACE
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 128 B |
|
|
@ -85,7 +85,7 @@ static const char *fail_face = "", *normal_face = "";
|
|||
/* Static data is messy, but we're coding for tests here, not a
|
||||
* general-purpose library, and it keeps the tests cleaner to avoid a
|
||||
* context object there, (though not a whole lot). */
|
||||
FILE *cairo_test_log_file;
|
||||
FILE *cairo_test_log_file = NULL;
|
||||
|
||||
void
|
||||
cairo_test_init (const char *test_name)
|
||||
|
|
@ -107,9 +107,10 @@ void
|
|||
cairo_test_log (const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
FILE *file = cairo_test_log_file ? cairo_test_log_file : stderr;
|
||||
|
||||
va_start (va, fmt);
|
||||
vfprintf (cairo_test_log_file, fmt, va);
|
||||
vfprintf (file, fmt, va);
|
||||
va_end (va);
|
||||
}
|
||||
|
||||
|
|
@ -1418,6 +1419,7 @@ cairo_test_for_target (cairo_test_t *test,
|
|||
srcdir = ".";
|
||||
format = _cairo_test_content_name (target->content);
|
||||
|
||||
/* First look for a target/format-specific reference image. */
|
||||
xasprintf (&png_name, "%s-%s-%s%s", test->name,
|
||||
target->name, format, CAIRO_TEST_PNG_SUFFIX);
|
||||
xasprintf (&ref_name, "%s/%s-%s-%s%s", srcdir, test->name,
|
||||
|
|
@ -1425,13 +1427,17 @@ cairo_test_for_target (cairo_test_t *test,
|
|||
if (access (ref_name, F_OK) != 0) {
|
||||
free (ref_name);
|
||||
|
||||
if (target->content == CAIRO_CONTENT_COLOR_ALPHA ||
|
||||
target->content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED)
|
||||
/* Next, look for format-specifc reference image. */
|
||||
xasprintf (&ref_name, "%s/%s-%s%s", srcdir, test->name,
|
||||
format,CAIRO_TEST_REF_SUFFIX);
|
||||
|
||||
if (access (ref_name, F_OK) != 0) {
|
||||
free (ref_name);
|
||||
|
||||
/* Finally, look for the standard reference image. */
|
||||
xasprintf (&ref_name, "%s/%s%s", srcdir, test->name,
|
||||
CAIRO_TEST_REF_SUFFIX);
|
||||
else
|
||||
xasprintf (&ref_name, "%s/%s-%s%s", srcdir, test->name,
|
||||
format,CAIRO_TEST_REF_SUFFIX);
|
||||
}
|
||||
}
|
||||
xasprintf (&diff_name, "%s-%s-%s%s", test->name,
|
||||
target->name, format, CAIRO_TEST_DIFF_SUFFIX);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 114 B |
|
Before Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 254 B |
|
|
@ -34,6 +34,7 @@
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
read_png_status_t status;
|
||||
unsigned char *buffer_a;
|
||||
unsigned int width_a, height_a, stride_a;
|
||||
unsigned char *buffer_b;
|
||||
|
|
@ -51,8 +52,13 @@ main (int argc, char *argv[])
|
|||
exit (1);
|
||||
}
|
||||
|
||||
read_png_argb32 (argv[1], &buffer_a, &width_a, &height_a, &stride_a);
|
||||
read_png_argb32 (argv[2], &buffer_b, &width_b, &height_b, &stride_b);
|
||||
status = read_png_argb32 (argv[1], &buffer_a, &width_a, &height_a, &stride_a);
|
||||
if (status)
|
||||
return 1;
|
||||
|
||||
status = read_png_argb32 (argv[2], &buffer_b, &width_b, &height_b, &stride_b);
|
||||
if (status)
|
||||
return 1;
|
||||
|
||||
if ((width_a == width_b) && (height_a == height_b) && (stride_a == stride_b))
|
||||
{
|
||||
|
|
@ -77,8 +83,5 @@ main (int argc, char *argv[])
|
|||
|
||||
free (buffer);
|
||||
|
||||
return total_pixels_changed;
|
||||
return (total_pixels_changed != 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
BIN
test/leaky-dash-ref.png
Normal file
|
After Width: | Height: | Size: 241 B |
68
test/leaky-dash.c
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright © 2005 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
/* Test case for bug #4863:
|
||||
*
|
||||
* stroking problems with wide dashed lines
|
||||
* https://bugs.freedesktop.org/show_bug.cgi?id=4863
|
||||
*/
|
||||
|
||||
#include "cairo-test.h"
|
||||
|
||||
#define WIDTH 71
|
||||
#define HEIGHT 28
|
||||
|
||||
cairo_test_t test = {
|
||||
"leaky-dash",
|
||||
"Exercises bug #4863 in which a dashed stroke leaks into half the rectangle being filled",
|
||||
WIDTH, HEIGHT
|
||||
};
|
||||
|
||||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
double dash[2];
|
||||
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
||||
cairo_paint (cr);
|
||||
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
|
||||
|
||||
cairo_set_line_width (cr, 2);
|
||||
dash[0] = 8.0;
|
||||
dash[1] = 2.0;
|
||||
|
||||
cairo_rectangle (cr, 2.0, 2.0, 67.0, 24.0);
|
||||
|
||||
cairo_set_dash (cr, dash, 2, 9.0);
|
||||
cairo_stroke (cr);
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return cairo_test (&test, draw);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 199 B |
BIN
test/line-width-scale-ps-argb32-ref.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
test/line-width-scale-ref.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
184
test/line-width-scale.c
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* Copyright © 2006 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#include "cairo-test.h"
|
||||
|
||||
/* This test exercises the various interactions between
|
||||
* cairo_set_line_width and cairo_scale. Specifically it show how
|
||||
* separate transformations can affect the pen for stroking compared
|
||||
* to the path itself.
|
||||
*
|
||||
* This was inspired by an image by Maxim Shemanarev demonstrating the
|
||||
* flexible-pipeline nature of his Antigrain Geometry project:
|
||||
*
|
||||
* http://antigrain.com/tips/line_alignment/conv_order.gif
|
||||
*
|
||||
* It also uncovered a bug in cairo that cairo_set_line_width was not
|
||||
* transforing the width according the the current CTM, but instead
|
||||
* delaying that transformation until the time of cairo_stroke. See:
|
||||
*
|
||||
* http://article.gmane.org/gmane.comp.graphics.agg/2518
|
||||
*/
|
||||
|
||||
#define LINE_WIDTH 13
|
||||
#define SPLINE 50.0
|
||||
#define XSCALE 0.5
|
||||
#define YSCALE 2.0
|
||||
#define WIDTH (XSCALE * SPLINE * 6.0)
|
||||
#define HEIGHT (YSCALE * SPLINE * 2.0)
|
||||
|
||||
cairo_test_t test = {
|
||||
"line-width-scale",
|
||||
"Tests interaction of cairo_set_line_width with cairo_scale",
|
||||
WIDTH, HEIGHT
|
||||
};
|
||||
|
||||
static void
|
||||
spline_path (cairo_t *cr)
|
||||
{
|
||||
cairo_save (cr);
|
||||
{
|
||||
cairo_move_to (cr,
|
||||
- SPLINE, 0);
|
||||
cairo_curve_to (cr,
|
||||
- SPLINE / 4, - SPLINE,
|
||||
SPLINE / 4, SPLINE,
|
||||
SPLINE, 0);
|
||||
}
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/* If we scale before setting the line width or creating the path,
|
||||
* then obviously both will be scaled. */
|
||||
static void
|
||||
scale_then_set_line_width_and_stroke (cairo_t *cr)
|
||||
{
|
||||
cairo_scale (cr, XSCALE, YSCALE);
|
||||
cairo_set_line_width (cr, LINE_WIDTH);
|
||||
spline_path (cr);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
|
||||
/* This is used to verify the results of
|
||||
* scale_then_set_line_width_and_stroke.
|
||||
*
|
||||
* It uses save/restore pairs to isolate the scaling of the path and
|
||||
* line_width and ensures that both are scaled.
|
||||
*/
|
||||
static void
|
||||
scale_path_and_line_width (cairo_t *cr)
|
||||
{
|
||||
cairo_save (cr);
|
||||
{
|
||||
cairo_scale (cr, XSCALE, YSCALE);
|
||||
spline_path (cr);
|
||||
}
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_save (cr);
|
||||
{
|
||||
cairo_scale (cr, XSCALE, YSCALE);
|
||||
cairo_set_line_width (cr, LINE_WIDTH);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/* This one's the bug.
|
||||
*
|
||||
* If we set the line width before scaling, then the path should be
|
||||
* scaled but the line width should not.
|
||||
*
|
||||
* With the bug, the line_width is also being scaled here.
|
||||
*/
|
||||
static void
|
||||
set_line_width_then_scale_and_stroke (cairo_t *cr)
|
||||
{
|
||||
cairo_set_line_width (cr, LINE_WIDTH);
|
||||
cairo_scale (cr, XSCALE, YSCALE);
|
||||
spline_path (cr);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
|
||||
/* This is used to verify what should be the results of
|
||||
* set_line_width_then_scale_and_stroke (once the bug is fixed).
|
||||
*
|
||||
* It uses save/restore pairs to isolate the scaling of the path and
|
||||
* line_width and ensures that the path is scaled while the line width
|
||||
* is not.
|
||||
*/
|
||||
static void
|
||||
scale_path_not_line_width (cairo_t *cr)
|
||||
{
|
||||
cairo_save (cr);
|
||||
{
|
||||
cairo_scale (cr, XSCALE, YSCALE);
|
||||
spline_path (cr);
|
||||
}
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_save (cr);
|
||||
{
|
||||
cairo_set_line_width (cr, LINE_WIDTH);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
|
||||
|
||||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
int i;
|
||||
typedef void (*figure_t) (cairo_t *cr);
|
||||
figure_t figures[4] = {
|
||||
scale_then_set_line_width_and_stroke,
|
||||
scale_path_and_line_width,
|
||||
set_line_width_then_scale_and_stroke,
|
||||
scale_path_not_line_width
|
||||
};
|
||||
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
||||
cairo_paint (cr);
|
||||
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
cairo_save (cr);
|
||||
cairo_translate (cr,
|
||||
WIDTH/4 + (i % 2) * WIDTH/2,
|
||||
HEIGHT/4 + (i / 2) * HEIGHT/2);
|
||||
(figures[i]) (cr);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return cairo_test (&test, draw);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 11 KiB |
|
|
@ -81,8 +81,7 @@ mask_polygon (cairo_t *cr, int x, int y)
|
|||
cr2 = cairo_create (mask_surface);
|
||||
|
||||
cairo_save (cr2);
|
||||
cairo_set_source_rgba (cr2, 0, 0, 0, 0); /* transparent */
|
||||
cairo_set_operator (cr2, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_operator (cr2, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr2);
|
||||
cairo_restore (cr2);
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 995 B |
|
Before Width: | Height: | Size: 284 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 4.3 KiB |