Commit graph

320 commits

Author SHA1 Message Date
Carl Worth
e324bbcbc6 Add a status field to cairo_traps_t to enable less error checking 2006-11-13 14:44:21 -08:00
Vladimir Vukicevic
6db219c3a1 [win32] clean up win32_surface_composite
Make sure that all operations are correct (the operations chosen
are listed in cairo-win32-surface.c); in particular, deal with the extra
byte present in FORMAT_RGB24 surfaces correctly.

Also adds support for calling StretchDIBits to draw RGB24
cairo_image_surfaces directly.
2006-11-07 13:12:09 -08:00
Carl Worth
fc584e1fbb Rewrite _cairo_matrix_transform_bounding_box to actually accept a box not a rectangle
It turns out that all of the callers want a box anyway, so this
simplfies the code in addition to being more honest to the name.

(For those new to the convention, a "box" is an (x1,y2),(x2,y2)
pair while a "rectangle" is an (x,y),(width,height) pair.)
2006-11-07 01:42:21 -08:00
Carl Worth
7e9aad2289 Fix repeating source surface patterns with xlib backend.
This broke with the clone_similar optimization in
8d7a02ed58 The optimization added an
interest rectangle to clone_similar, but with a repeating source
pattern, the interest rectangle might not intersect the extents of the
surface at all.

The test suite caught this with the trap-clip case.

The fix here is to clone the entire surface if the pattern has an
extend mode of REPEAT.
2006-10-25 10:32:37 -07:00
Christopher (Monty) Montgomery
8d7a02ed58 Add extents to clone_similar (fixing subimage_copy performance bug)
This fixes a huge performance bug (entire image was being pushed to X
server in order to copy a tiny piece of it). I see up to 50x improvement
from subimage_copy (which was designed to expose this problem) but also
a 5x improvement in some text performance cases.

 xlib-rgba              subimage_copy-512    3.93 2.46% ->   0.07 2.71%: 52.91x faster
███████████████████████████████████████████████████▉
 xlib-rgb               subimage_copy-512    4.03 1.97% ->   0.09 2.61%: 44.74x faster
███████████████████████████████████████████▊
 xlib-rgba              subimage_copy-256    1.02 2.25% ->   0.07 0.56%: 14.42x faster
█████████████▍
 xlib-rgba        text_image_rgb_over-256   63.21 1.53% ->  11.87 2.17%:  5.33x faster
████▍
 xlib-rgba       text_image_rgba_over-256   62.31 0.72% ->  11.87 2.82%:  5.25x faster
████▎
 xlib-rgba     text_image_rgba_source-256   67.97 0.85% ->  16.48 2.23%:  4.13x faster
███▏
 xlib-rgba      text_image_rgb_source-256   68.82 0.55% ->  16.93 2.10%:  4.07x faster
███▏
 xlib-rgba              subimage_copy-128    0.19 1.72% ->   0.06 0.85%:  3.10x faster
██▏
2006-10-18 17:06:23 -07:00
Jamey Sharp
445251cc79 [slim] hide cairo_version_string()
Adrian's recent commits broke PLT hiding by calling cairo_version_string
from inside cairo. Add slim_hidden_def and slim_hidden_proto for it.
2006-10-15 17:24:25 -07:00
Behdad Esfahbod
a13d58ff3a [slim] hide cairo_pattern_status() #8551 2006-10-08 17:06:44 -04:00
Robert O'Callahan
191e108b93 Add clip getters API + tests
Add new public API methods:

void cairo_clip_extents (cairo_t *cr,                                               double *x1, double *y1,
    double *x2, double *y2);
cairo_rectangle_list_t *cairo_copy_clip_rectangles (cairo_t *);
void cairo_rectangle_list_destroy (cairo_rectangle_list_t *);

Also add 'get-clip' and 'get-path-extents' tests.
2006-09-25 23:22:45 -07:00
Robert O'Callahan
a8ca155f83 Fix stroke/fill extents bounding boxes
Correctly return the transformed bounding box for stroke/fill extents,
instead of just transforming the two corners separately.
2006-09-25 23:16:54 -07:00
Robert O'Callahan
37fa632e59 Fix _cairo_matrix_transform_bounding_box to return tightness info
Add return is_tight value to the internal function, indicating whether
the transformed bounds still remain axis-aligned.
2006-09-25 23:14:43 -07:00
Peter Weilbacher
2fd0ad9489 OS/2 build changes 2006-09-15 11:18:47 +02:00
Vladimir Vukicevic
3c5a02c3ed [win32] Misc win32 compilation fixes
Fix win32/MSVC defines for snprintf, inline, and M_PI
2006-09-09 17:06:21 -07:00
Behdad Esfahbod
99360bd35d cairo_show_glphs: Mark glyphs argument as const. 2006-09-08 15:12:07 -04:00
Carl Worth
942cd2e026 Add _cairo_array_size to allow querying the allocated size 2006-09-07 17:33:35 -07:00
Nicholas Miell
203d70a562 Make the SLIM macros robust in the face of macro-renamed symbols
This doesn't actually fix the AMD64 link failure, but it does make the
foo/EXT_foo/INT_foo symbol names generated by the slim_hidden_proto()
and slim_hidden_def() macros consistent in the face of the meddling of
pixman-remap.h.

Signed-off-by: Nicholas Miell <nmiell@gmail.com>
2006-09-07 12:48:23 -07:00
Carl Worth
60c4add26a slim_hidden_proto: Move smeicolon from definition to use for consistency and legibility 2006-09-05 17:22:07 -07:00
Carl Worth
d7f08794ef Add many missing slim_hidden calls to bypass PLT entries for local use of public functions 2006-09-05 17:22:00 -07:00
Carl Worth
06a9628868 Eliminate conditions checking for unsigned or enum values less than 0. 2006-08-28 19:00:48 -07:00
Yevgen Muntyan
6de226be0e Define WINVER if it's not defined. (bug 6456) 2006-08-21 03:52:40 -04:00
Carl Worth
0bfa6d4f33 Fix assertion failures in bitmap-font test by coercing A8 images to A1
There are still some problems in the resulting output:

PDF: Rotated font ends up being blurry in final PNG (not too important)
PS and SVG: There's an incorrect offset being applied somewhere.
2006-08-17 17:50:40 -07:00
Carl Worth
401f0ce3c4 Merge branch 'surface-font-options' into cairo 2006-08-08 00:19:51 -07:00
Carl Worth
959b85e98c Merge branch 'warnings-cleanup' into cairo
Conflicts:

	src/cairo-font-subset.c
2006-08-07 15:06:47 -07:00
Carl Worth
9ae66174e7 Fix bug 7294 by adding pixman BGR formats and internal cairo BGR formats.
This approach to fixing the bug is valid since there is code in pixman
for rendering to BGR images, (which is why cairo 1.0 worked with BGR X
servers for example). But, since we don't want to advertise additional
image formats we implement this through a new cairo_internal_format_t.

This is rather fragile since we don't want to leak any internal formats
nor do we ever want an internal format to be used somewhere a real
format is expected, (and trigger a CAIRO_FORMAT_VALID assertion failure).
More comments than code are added here to help compensate for the
fragility and to give some guidance in fixing this mess in a better way
in the future.
2006-08-07 11:19:19 -07:00
Alfred Peng
04757a3aa8 Add definition of cairo_private for some Sun compilers.
In addition to helping us preserve a sharp line between which symbols are
part of the public API and which are private parts of the implementation,
this can also help mozilla avoid clashes between its modified, internal
copy of cairo and the system version of cairo. See the mozilla bug here:

https://bugzilla.mozilla.org/show_bug.cgi?id=341874
2006-08-07 08:41:13 -07:00
Adrian Johnson
a0989f427b Remove freetype dependency for truetype subsetting code.
Add a load_truetype_table function to cairo_scaled_font_backend_t and
use it to load the truetype sfnt tables.  Implement this with freetype
for the freetype font backend and use GetFontData for win32.  Atsui
remains unimplemented, and still falls back to type3 fonts.
2006-08-02 19:30:55 -04:00
Behdad Esfahbod
bdb4e1edad Implement per-surface font options.
New internal function _cairo_surface_set_font_options is used to set them.
cairo_surface_create_similar propagates the font options of the other
surface into the newly created surface.  Fixes bugs with font options in
fallback images and bug 4106.
2006-07-31 14:44:42 -04:00
Carl Worth
eb9caf0833 Add -Wsign-compare compiler flag and fix all warnings 2006-07-28 22:50:06 -07:00
Behdad Esfahbod
5e0f46cdeb Standardize on unsigned for ref_count type and add CAIRO_REF_COUNT_INVALID
The CAIRO_REF_COUNT_INVALID macro simply hides the ((unsigned int)-1) cast
to avoid warnings about comparison between signed and unsigned values.
2006-07-28 15:41:11 -07:00
Behdad Esfahbod
e5f4b92261 Make "double *dash" argument const in cairo_set_dash 2006-07-27 15:20:14 -04:00
Carl Worth
bd92eb7f3c Move device_transform of path to before floating->fixed conversion.
This is an attempt to fix the following bug:

	http://bugzilla.gnome.org/show_bug.cgi?id=332266

With the recent rewrite of the device-offset code, which pushed things
from the gstate to the surface layer, the 16-bit limitations on coordinates
which previously applied to device space only, have lately been applying to
user space. This commit moves the device_transform back up above the conversion
from floating-point to fixed-point values so that once again the limitation
only applies to device space.
2006-06-29 21:33:34 +02:00
Carl Worth
7e457cb4c1 Bug 6955: Fix by adding freeze/thaw around scaled_font glyph cache in _cairo_xlib_surface_show_glyphs 2006-06-22 22:32:57 -07:00
Carl Worth
b806b50cfe Add new CAIRO_BITSWAP8 macro for swapping the bits within a byte.
This uses a technique devised by Sean Anderson, July 13, 2001 as found
at http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
This technique uses 3 multiplies rather than just shifts and masks, but
performance seems comparable to the old approach, (but more significantly,
the new approach is easier to implement as a macro, and I plan to start
using this bit-swapping elsewhere very soon).
2006-06-20 10:59:22 -07:00
Jinghua Luo
efaf88d409 Add missing prototype for _cairo_lzw_compress. 2006-06-17 15:52:05 +08:00
Carl Worth
9fa24975b4 Drop _cairo_surface_is_opaque now that we have cairo_surface_get_content 2006-06-15 15:33:45 -07:00
Kristian Høgsberg
2cea3a2710 Merge branch 'svg-rewrite' 2006-06-14 15:00:33 -04:00
Behdad Esfahbod
7e0be461b5 Rename cairo-wideint.h to cairo-wideint-private.h. 2006-06-14 05:06:10 -07:00
Carl Worth
d2045c1f74 Change return type of _cairo_scaled_glyph_lookup to allow UNSUPPORTED.
This allows graceful recovery when first requesting a path from a font
that only supports bitmapped glyph. The changed return type is also
pushed down into the scaled_glyph_init function of the
cairo_scaled_font backend.
2006-06-13 12:51:10 -07:00
Kristian Høgsberg
3575c942f8 Make cairo_output_stream_t an embeddable type.
Most internal cairo types are transparent within cairo and have init and fini
functions to intialize and finialize them in place.  This way they can be
easily be embedded in other structs or derived from.  Initially, the
cairo_output_stream_t type was proposed as a publically visible type and
thus kept opaque.  However, now it's only used internally and derived from
in a number of places so let's make it an embeddable type for consistency
and ease of use.

The patch keeps _cairo_output_stream_create() and _cairo_output_stream_close()
around for (internal) backwards compatibility by deriving a
cairo_output_stream_with_closure_t stream type.

The patch also moves all cairo_output_stream_t functions out of cairoint.h
and into new file cairo-output-stream-private.h, thus chipping away at the
monolithic cairoint.h.
2006-06-12 03:07:19 -04:00
Carl Worth
6efeb1e19b Hook up device scaling so fallback_resolution starts working.
Add new, private _cairo_surface_set_device_scale for getting at the
scaling components of device_transform. Use this in paginated surface
when replaying to an image surface. The fallback-resolution test now
clearly shows that image fallback resolution can be controlled by the
user. Hurrah!
2006-06-10 08:19:41 -07:00
Carl Worth
b129f747c5 Change {x,y}_device_offset values to a device_transform matrix.
This is a step toward allowing device scaling in addition to device offsets.
So far, the scale values are still always 1.0 so only the translation is
actually being used. But most of the code is in place for doing scaling as
well and it just needs to be hooked up.

There are some fragile parts in this code, all of which involve using the
translation without the scale, (so grep for device_transform.x0 or
device_transform->x0). Some of these are likely bugs that will hopefully
be obvious once we start using the scale. Others are OK if only because
we 'know' that we aren't ever setting device scaling on a surface that
has a device offset (we only set device scaling on surfaces we create
internally and we don't export device scaling to the user).

All of these fragile parts in the code have been marked with comments of
the form: XXX: FRAGILE.
2006-06-10 00:12:51 -07:00
Carl Worth
999315cc0a Rename device_{x,y}_offset to {x,y}_device_offset for better consitency/grepability 2006-06-09 21:12:44 -07:00
Carl Worth
b2f274b3e8 New API: Replace cairo_{ps,pdf,svg}_set_dpi with new cairo_surface_set_fallback_resolution.
This just provides the mechanics for storing the value and removing the old
function calls. The new value is still not used anywhere (though nor where
the old values), so there should be no functional change (other than forcing
any programs calling the old API to be updated).
2006-06-09 16:52:17 -07:00
Carl Worth
c1855f1762 Remove CAIRO_{MIN,MAX}SHORT which did not distinguish signed vs. unsigned.
Instead, use the standard INT16_{MIN,MAX} and UINT16_{MIN,MAX} as
appropriate.
2006-06-06 16:59:59 -07:00
Carl Worth
746f66c3fc Fix bogus cairo_rectangle_fixed_t to be cairo_rectangle_int16_t.
This rectangle has regular integer values, not fixed-point values.
So the old name was horribly wrong and misleading, (and yes I think
it was even I that had suggested it).
2006-06-06 16:54:03 -07:00
Carl Worth
ef10a0403a Remove initial, final, and duplicate blank lines.
This patch was produced by running git-stripspace on all *.[ch] files
within cairo. Note that this script would have also created all the changes
from the previous commits to remove trailing whitespace.
2006-06-06 15:50:33 -07:00
Carl Worth
5278de0997 Remove all remaining trailing whitespace.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e 's/[ \t]+$//'

run on all *.[ch] files within cairo.

Note that the above script would have also created all the changes
from the previous commits to remove trailing whitespace.
2006-06-06 15:41:31 -07:00
Carl Worth
4670366ede Remove trailing whitespace from lines that look like comments.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e '/^[ \t]*\/?\*/ s/[ \t]+$//'

run on all *.[ch] files within cairo, (though I manually excluded
src/cairo-atsui-font.c which has a code line that appears as a comment
to this script).
2006-06-06 15:35:48 -07:00
Carl Worth
80b8deb1e4 Remove extraneous whitespace from "blank" lines.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e 's/^[ \t]+$//'

run on all *.[ch] files within cairo.
2006-06-06 15:25:49 -07:00
Carl Worth
d0dd3b822e New API: Add new function cairo_surface_get_content
This assumes that the directfb, glitz, and quartz backends
always create surfaces with content of COLOR_ALPHA which might
be totally wrong.
2006-05-24 17:19:00 -07:00
Carl Worth
0a1ec91977 Move prototype of cairo_debug_reset_static_data from uninstalled cairo-debug.h to cairo.h 2006-05-22 09:31:31 -07:00