Commit graph

7488 commits

Author SHA1 Message Date
Bryce Harrington
150c1e7044 Don't return NULL to clients when getting image
Return an error surface instead.

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=58061
2014-09-22 15:41:24 -07:00
Bryce Harrington
402b456a32 gl: Increase default VBO size on GL to 1M
The default VBO size was reduced from 256k to 16k because embedded
devices had trouble with the larger memory demands of a big VBO.  My
testing[1] indicates this incurred a 5% performance loss on at least one
of Cairo's performance tests.  Further testing showed that with
late-model graphics cards, further performance benefits can be seen with
even larger VBO sizes, up to 8.3% at 1M for Intel.

Now that we can set the vbo size differently for different backends, set
it to the lower value (16k) for EGL, and higher (1M) for GL.

1: http://www.bryceharrington.org/wordpress/2013/08/vbo-size/

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-19 17:23:50 -07:00
Bryce Harrington
aa820c13d7 gl: Track the VBO size as a property of the ctx
Change suggested by Chris Wilson.  This will enable setting different
vbo sizes for GL vs. EGL.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-19 17:23:50 -07:00
Bryce Harrington
036f47c345 cairo-gl: Make VBO size run-time settable
The default VBO size was reduced from 256k to 16k last year in commit
90860241 due to problems with larger VBOs on embedded hardware.
However, that change resulted in a 5% performance impact to the
firefox-fishbowl benchmark when using the spans or traps compositors.

This patch doesn't change the VBO size, but does permit it to be
altered via an environment variable, to facilitate testing.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-19 17:23:50 -07:00
Bryce Harrington
e0c0a673ee Disable font options for xcb.
This patch makes a bunch of tests pass again. The first hunk one fixes a
shameful oversight (whoops), the second one effectively reverts
e691d242.  That change broke 102 xcb and 70 xlib tests, including a
bunch of *twin-antialias-* test cases.  Patch thanks to Uli Schlachter.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-09-17 17:30:04 -07:00
Adrian Johnson
0aa43ed886 win32 printing: fix image scale when GDI scale is not identity 2014-09-14 22:02:12 +09:30
Lukáš Lalinský
e691d242d5 xcb: Initialize font options from Xft resources
There is a similar code in the Xlib backend. The logic here is the same, but
XCB doesn't support X resources directly, so there is some custom code
to get and parse the resources from the root window.

Signed-off-by: Lukáš Lalinský <lukas@oxygene.sk>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-09-12 18:19:44 +02:00
Ravi Nanjundappa
3b9d7e583f qt: Suppress warnings in qt backend build
This patch fixes majorly 2 kinds of warning issues:

(1)
cc1plus: warning: command line option '-Wold-style-definition' is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wdeclaration-after-statement' is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wnested-externs' is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wmissing-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wbad-function-cast' is valid for C/ObjC but not for C++ [enabled by default]

Solution: Enable these warnings only for C compiler and not for C++

(2)
cairo-qt-surface.cpp: In function 'cairo_int_status_t _cairo_qt_surface_fill(void*, cairo_operator_t, const cairo_pattern_t*, const cairo_path_fixed_t*, cairo_fill_rule_t, double, cairo_antialias_t, const cairo_clip_t*)':
cairo-qt-surface.cpp:852:5: warning: inlining failed in call to 'PatternToBrushConverter::PatternToBrushConverter(const cairo_pattern_t*)': --param max-inline-insns-single limit reached [-Winline]
cairo-qt-surface.cpp:1339:38: warning: called from here [-Winline]
cairo-qt-surface.cpp:390:1: warning: inlining failed in call to 'QPainterPath _ZL10path_to_qtPK17_cairo_path_fixedPK13_cairo_matrix.part.13()': call is unlikely and code size would grow [-Winline]
cairo-qt-surface.cpp:1306:1: warning: called from here [-Winline]
cairo-qt-surface.cpp:1051:5: warning: inlining failed in call to 'PatternToBrushConverter::~PatternToBrushConverter()': call is unlikely and code size would grow [-Winline]

Solution: Add __attribute__ ((noinline)) to the function as mentioned in
http://stackoverflow.com/questions/11724235/warning-for-template-with-g-o2-or-os-o-o1 (Edit 3)

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-11 12:53:05 -07:00
Maks Naumov
29a8b4e970 Fix _cairo_mesh_pattern_equal() when cairo_mesh_patch_t structs are different
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-08-28 13:16:47 -07:00
Maks Naumov
e6bf829d89 Fix font x_scale value in _compute_transform()
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-08-27 21:14:26 -07:00
Ravi Nanjundappa
52c4f0f2da src: Fix memory issue reported by cppcheck static analysis tool
cppcheck analysis tool reports the following issues when run on the
latest Cairo source.

$ grep "(error)"  cppcheck_error_log.txt
[src/skia/cairo-skia-surface.cpp:245]: (error) Memory leak: surface
$

The proposed changes fixes the above issues.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-27 20:39:49 -07:00
Chris Wilson
a5f51588af traps,xcb: Set the box count after filtering
After converting, the number of boxes should only count the number of
non-zero boxes and forget about the zero-sized boxes we skipped over.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81699
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-25 08:55:24 +01:00
Chris Wilson
13a09526d2 traps,xcb: Prefilter zero-area boxes when converting traps
The rectangular tesselation routines rely on the presuming that all the
boxes it has to handle are already filtered to remove empty boxes.

<< /width 800 /height 600 >> surface context
0.0848671 0 0 0.0848671 39.907812 5.608896 matrix transform
8 0 m 12.417969 0 16 3.582031 16 8 c 16 12.417969 12.417969 16 8 16 c
3.582031 16 0 12.417969 0 8 c 0 3.582031 3.582031 0 8 0 c h
clip
16 0 m 8 8 l 16 16 l h
clip
0 0 16 16 rectangle
fill

Triggers the error given a traps tesselator like cairo-xlib.

Reported-by: Henrique Lengler <henriqueleng@openmailbox.org>
Analyzed-by: Massimo <sixtysix@inwind.it>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81699
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-23 14:20:43 +01:00
Uli Schlachter
545444ec1f xcb: Correctly check for image surface for inplace upload
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82987
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-23 14:38:36 +02:00
Maks Naumov
183ac1889f Fix width and height args for _cairo_xcb_connection_copy_area()
Found via static analysis.

Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by:  Uli Schlachter <psychon@znc.in>
2014-08-21 12:56:42 -07:00
Rodrigo Rivas Costa
932548ef25 win32 print: fix cache_frozen assertions
Bug 81709
2014-08-19 00:09:50 +09:30
Bill Spitzak
1d9f4ae520 V5: Use NEAREST filter when possible
(changed to use determinant funciton and remove debug printf)

Modifies _cairo_matrix_has_unity_scale to return true for 90 degree rotations
by allowing error caused by inaccuracy in trig functions.

This fails after 14 additions of M_PI_2 to itself as a float argument to
cairo_rotate, but the failure is in the detection of the integer translate,
not in the trig components. I believe this is due to the matrix inversion,
which may need similar rounding.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-08-14 12:59:07 -07:00
Chris Wilson
27c9923e98 xlib: Undo debug hack to force fallbacks
Remove the debug hack from

commit f337342c88
Author: Bill Spitzak <spitzak@gmail.com>
Date:   Fri Jul 18 18:46:26 2014 -0700

    V6 image: Use convolution filters for sample reconstruction when downscaling

as it forces the fallback image surface for xlib causing severe
performance degradation.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82002
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Bill Spitzak <spitzak@gmail.com>
Cc: Bryce Harrington <b.harrington@samsung.com>
2014-08-01 11:30:42 +01:00
Bill Spitzak
f337342c88 V6 image: Use convolution filters for sample reconstruction when downscaling
This version removes testing code and has some changes to match my current
pixman version. My proposed pixman patch (not finished yet) will produce
exactly the same results as this cairo patch.

This code contains an all-new filter generator to replace the one that is
in pixman. Results in 222 pass/298 failed image tests, which is much better
than the previous versions of this patch.

Filter generator (which should probably be in pixman):

- Single filter, no "reconstruction" and "sample" filter
- Filters for derivative < 1 work
- Fixed IMPULSE and BOX
- Added TENT, CATMULL_ROM, NOTCH. Remove LANZCOS2.
- Renamed CUBIC to MITCHELL

Cairo's filter settings:

- CAIRO_FILTER_GOOD: uses BOX filter for scales less than .75 in either
  direction. Uses PIXMAN_FILTER_GOOD (ie BILINEAR) otherwise.

- CAIRO_FILTER_BEST: uses CATMULL filter always. Upscaling more than 2x will
  produce anti-aliased square pixels, similar to OS/X.

- CAIRO_FILTER_GAUSSIAN: this obsolete value is used to test other filters.
  The program must declare and poke the filter into the static varialbe
  ikernel. This should be removed for production code.

NYI: This version uses the fallback for xlib always. The xlib and xcb backends
must be rewritten to use the fallback version if filtering is needed. Or the
filtering code must be moved to XRender.
2014-07-25 12:16:53 -07:00
Bryce Harrington
e71b917bbf xlib: Fix mispelling in a comment 2014-07-24 18:41:37 -07:00
Bryce Harrington
82b4781f18 cairo-wideint: Fix typo in two cairo_uint128 functions
_cairo_int128_negate and _cairo_int128_not are #defines of
_cairo_uint128_negate and _cairo_uint128_not respectively.  The function
implementations should use the actual function name not the aliases.  On
systems without a uint128 type, these could lead to build issues.

Credit for finding this go to Dr. Peter Barnes, LLNL.
2014-07-24 18:41:37 -07:00
Ravi Nanjundappa
e279709bf3 skia : Add Debug support for skia backend
Enable the DEBUG support for skia backend to provide more
descriptive information on the unexpected operational behaviours.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-07-10 12:08:01 -07:00
Jeff Muizelaar
30cb23d3b6 clang-cl: Use size of the pointer explicitly
This works around http://llvm.org/PR20216.
2014-07-09 16:35:30 -04:00
Ravi Nanjundappa
7bd68b5799 skia: update the source to build with the latest skia
This fixes several build related issues for the skia backend
which is introduced due to skia source up-gradation.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-07-08 11:09:04 -07:00
Ravi Nanjundappa
be62b12211 xcb: make use of _cairo_surface_is_xcb to check for surface type
Introduced a new inline function _cairo_surface_is_xcb() as similar to
_cairo_surface_is_image() and used the same to check for xcb surface
type

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-07-07 03:53:13 -07:00
Jeff Muizelaar
550385fb00 Don't use __FUNCTION__ as a string literal
clang-cl doesn't support this and we don't gain much
from using it.
2014-06-30 14:17:18 -04:00
Ravi Nanjundappa
f574fec8d2 src : Fix warn_unused_result warnings from gcc
Fix 'unused-result' warning messages by
- replacing cairo_private to cairo_private_no_warn in the
  declaration of the cairo private apis '_cairo_surface_unmap_image',
  '_cairo_polygon_add_line', '_cairo_polygon_add_external_edge' and
  '_cairo_polygon_add_contour'
- removing cairo_warn for 'render_rows' member function pointer in
  'struct _cairo_span_renderer'

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-06-05 16:12:30 -07:00
Uli Schlachter
3d94269bd4 Revert "image: Use convolution filters for sample reconstruction when downscaling"
This reverts commit fb57ea13e0.

When running cairo-test-suite with the parameter "-a", it also runs each test
with a non-zero device-offset and device-scaling. The above commit influenced
the device-scaling results badly. E.g. some test results ended up with a black
border at the top-most and left-most row that looked like there was an offset of
"0.5" in drawing the image and thus pixels outside of the image were sampled.

This can be seen by the influence that this revert has on the results from
running CAIRO_TEST_TARGET=image ./cairo-test-suite -a:

Before: 31 Passed, 489 Failed [1 crashed, 8 expected], 31 Skipped
After: 225 Passed, 295 Failed [1 crashed, 8 expected], 31 Skipped

Most of the failures that disappeared are from the device-scaling tests.

With such disastrous results on the test suite, this cannot really be usable for
real-world applications.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-06-05 13:16:24 -07:00
jimmyfrasche
2d89cbb30e Add more info to cairo_surface_set_mime_data docs.
Explains how to use cairo_surface_set_mime_data so that the image always
gets used even if the MIME data cannot be.

Signed-off-by: jimmyfrasche <soapboxcicero@gmail.com>
2014-06-05 13:14:11 -07:00
Sylvestre Ledru
247cfaaa25 Fix some memory leaks found by scan-build, the LLVM/Clang static analyzer
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-05-16 11:11:34 -07:00
Sylvestre Ledru
5e7b724dd3 Remove some potential double free
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-05-16 11:11:30 -07:00
jimmyfrasche
85b05e84ac Pattern document clarification
Replaces documentation of the form "range 0 to 1 less than the number"
with "ranges from 0 to n-1 where n is the number", which is idiomatic
mathematical writing and less ambiguous.

Signed-off-by: jimmyfrasche <soapboxcicero@gmail.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-12 10:19:33 -07:00
Bryce Harrington
18b3cce2f5 Fix segfault in firefox when scrolling on certain pages
Bug discovered by thorsten <fly_a320@gmx.de>

Patch from Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 10:18:19 -07:00
Sylvestre Ledru
da9ef97372 Remove some useless declarations found by scan-build, the LLVM/clang static analyzer
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-06 10:14:53 -07:00
Uli Schlachter
bb17403622 mesh-rasterize: Fix number of iterations
Commit 44a09f462c fixed a compiler warning, but changed the result of this code.
This is because the old 'for' loop did one more iteration than the new 'while'
loop. Fix this by incrementing the loop counter once before the loop.

Fixes: mesh-pattern mesh-pattern-accuracy mesh-pattern-conical
mesh-pattern-control-points mesh-pattern-fold mesh-pattern-overlap
mesh-pattern-transformed record-mesh

Signed-off-by: Uli Schlachter <psychon@znc.in>
Tested-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-21 14:10:19 +01:00
Uli Schlachter
372c8c314a mask compositor: Set a check_composite method
Commit 503b6b9e2e added a check_composite method to the mask compositor, but
only added it to one of the existing implementations. This commit fixes that.

In cairo-image-compositor.c, there is already a check_composite method which
just returns success for the traps compositor. This commit makes the mask
compositor use that one.

I don't want to say much about cairo-image-mask-compositor.c except that I
wondered why this file and the file above both define a non-static function
called _cairo_image_mask_compositor_get(). In my opinion, that file should just
be deleted, since it confuses e.g. ctags, but I'll let someone else clean this
up.

Fixes 493 crashes in the test suite for the test-mask target.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Tested-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-21 14:09:37 +01:00
Uli Schlachter
bc05dbccd7 Fix warnings from check-doc-syntax.sh
$ ./check-doc-syntax.sh
Checking documentation for incorrect syntax
./cairo-types-private.h (148): WARNING: cairo_hash_entry_t: missing 'Since' field (is it a private type?)
./cairo-types-private.h (161): WARNING: cairo_hash_entry_t: not found
./cairo-types-private.h (175): WARNING: cairo_lcd_filter_t: missing 'Since' field (is it a private type?)
./cairo-cache-private.h (85): WARNING: cairo_cache_entry_t: missing 'Since' field (is it a private type?)
./cairo-region.c (857): WARNING: cairo_region_overlap_t: not found
./cairo-raster-source-pattern.c (62): WARNING: SECTION:cairo-raster-source 'Since' field in non-public element

The warnings about missing 'Since' fields are fixed by changing the
documentation comment so that the script can see that these are private types.

The documentation for cairo_region_overlap_t gets moved to cairo.h, just like
e.g. the documentation for cairo_status_t.

The 'Since' field from the SECTION:cairo-raster-source is removed, because this
kind of field is needed on the individual functions and structs, not on the
section.

Thanks to Bryce Harrington for bringing this up!

Signed-off-by: Uli Schlachter <psychon@znc.in>
Tested-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 17:12:43 -07:00
Bryce Harrington
0c18991053 skia: Add section definitions and code docs for skia backend
This fixes several distcheck errors regarding missing code docs.

The skia backend was added in commit d7faec02, which was included in the
1.10 release.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 17:12:37 -07:00
Bryce Harrington
8d0abb4a94 surface: Make parameter naming consistent between header and impl
This fixes this set of distcheck errors generating docs:

  src/cairo-surface.c:1668: warning: Parameter described in source code
  comment block but does not exist. FUNCTION:
  cairo_surface_set_device_scale Parameter: sx.

  src/cairo-surface.c:1668: warning: Parameter described in source code
  comment block but does not exist. FUNCTION:
  cairo_surface_set_device_scale Parameter: sy.

  src/cairo-surface.c:1668: warning: Parameter description for
  cairo_surface_set_device_scale::x_scale is missing in source code
  comment block.

  src/cairo-surface.c:1668: warning: Parameter description for
  cairo_surface_set_device_scale::y_scale is missing in source code
  comment block.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 15:13:34 -07:00
Bryce Harrington
4450af4f03 Mark recently added _cairo_output_stream_print_matrix private symbol
This fixes a distcheck error about a local PLT entry.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 15:13:04 -07:00
Bryce Harrington
f4a1a75078 doc: Add missing sections and symbols for public docs
This adds a number of items to the documentation for which code docs
exist, and also adds sections for cairo-skia and cairo-surface-observer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48784

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 15:12:50 -07:00
Uli Schlachter
ed175b2a2b clip: Fix handling of special all-clipped cairo_clip_t
_cairo_clip_intersect_box() wasn't checking if it was called with the special,
read-only all-clipped clip and thus could have ended up writing to read-only
memory.

References: https://bugs.freedesktop.org/show_bug.cgi?id=75819
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-06 09:51:56 +01:00
Chris Wilson
3b261bea7d clip: Do not modify the special all-clipped cairo_clip_t
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75819
2014-03-06 08:35:20 +00:00
Behdad Esfahbod
f88bd92e8b Revert "[ft] Fix memory bug in copying bitmaps"
This reverts commit a0f556f37f.

The change was clearly wrong now that I read.  I was probably
tricked by what was fixed in the follow-up commit
e738079302.
2014-03-05 01:13:59 -08:00
Koji Egashira
5c9fdcb4aa image: Add NULL checks for return value of _pixman_image_for_color()
This fixes crash in pixman_image_composite32().

Originally fixed by Yoshitaro Makise.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-03 17:21:37 -08:00
Benjamin Otte
6a03ae5859 xlib: Fix typo in documentation 2014-03-03 01:16:25 +01:00
Bryce Harrington
f1709c298c Correct spelling of "tessellator" throughout code
Based on patch suggested by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50411
2014-02-26 18:55:25 -08:00
Bryce Harrington
273210683f Add comment to explain _cairo_edge_compute_intersection_*
Patch by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50412
2014-02-26 18:44:46 -08:00
Bryce Harrington
e555dfc717 Add explanation to _cairo_surface_create_in_error
Patch by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50413
2014-02-26 18:42:41 -08:00
Bryce Harrington
be206ddf20 Add explanation to enum _cairo_int_status
Patch based on suggestion by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50416
2014-02-26 18:40:12 -08:00