summaryrefslogtreecommitdiff
path: root/boilerplate/cairo-boilerplate.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace use of ctype functions with internal version where only ASCII chars ↵Adrian Johnson2022-04-091-2/+2
| | | | | | | | | are used In !309 Taylor R Campbell found a number of instances of ctype incorrectly passed a signed char. In many cases, where only ASCII characters are used, the code should have been using the cairo version of the ctype function to avoid locale issues.
* boilerplate: Use _cairo_malloc instead of mallocBryce Harrington2021-07-231-3/+4
| | | | | | | | | This changes most instances of malloc() calls to use Cairo's safer _cairo_malloc(). The malloc() call in the implementation of boilerplate's xmalloc() is not changed since it already includes a size=0 check. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* Introduce CAIRO_BOILERPLATE_OPEN_NO_DAEMON and ↵Anton Danilkin2021-05-031-2/+10
| | | | CAIRO_BOILERPLATE_DO_NOT_CRASH_ON_ANY2PPM_ERROR
* Retire dummy cairo-version.h header to fix meson subproject buildTim-Philipp Müller2020-09-291-6/+0
| | | | | | | | | | | | | | It was originally added to make bisecting easier, but has outlived its usefuleness now. Going forward we'll have just a single cairo-version.h header file, the one with the real version numbers. This is needed to fix the case where cairo is being built as a Meson subproject, but also simplifies things in general. Fixes #421
* image: prevent invalid ptr access for > 4GB imagesAdrian Johnson2017-11-071-1/+3
| | | | | | | | | | | | Image data is often accessed using: image->data + y * image->stride On 64-bit achitectures if the image data is > 4GB, this computation will overflow since both y and stride are 32-bit types. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98165 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* test: improve selective execution of Cairo tests based on FORMAT optionRavi Nanjundappa2014-08-141-13/+55
| | | | | | | | | | | | | | | | | | This patch improves the patch "test: Selective execution of Cairo tests based on FORMAT option" by extending the usage of FORMAT option even in the case of user not providing TARGETS= option For ex: (1). CAIRO_TESTS="zero-alpha" make test FORMAT=rgba This command runs the zero-alpha test for all the backends with argb32 content format and so on. (2). CAIRO_TESTS="zero-alpha" make test FORMAT=rgba,rgb This command runs the zero-alpha test for all the backends with argb32 and rgb24 content formats. Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
* test: Selective execution of Cairo tests based on FORMAT optionRavi Nanjundappa2014-08-141-7/+54
| | | | | | | | | | | | | | | | Added a new command line option FORMAT which can take rgb and/or rgba values which enables the execution of tests only for the given FORMAT For ex: (1). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba,rgb This command runs the zero-alpha test for both ps2 and image backends with argb32 and rgb24 content formats. (2). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba This command runs the zero-alpha test for both ps2 and image backends with argb32 content format and so on. Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
* More binary mode for WindowsBehdad Esfahbod2014-07-231-2/+2
| | | | | Based on: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-cairo/0012-more-binary-mode.mingw.patch
* boilerplate: Maintain consistency in the usage of switch casesRavi Nanjundappa2014-05-061-16/+37
| | | | | | | | | Some of the switch cases used in boilerplate are not consistent across other source files in the same module. This patch fixes the consistency issues of switch case usage in the boilerplate module. Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com> Reviewed-by: Uli Schlachter <psychon@znc.in>
* test: Fix handling of dots in CAIRO_TEST_TARGETUli Schlachter2013-03-221-0/+2
| | | | | | | | | | | | | | | | | | Before this, the following happened: $ CAIRO_TEST_TARGET=image,xcb-render-0.0 make test Cannot find target 'image'. Known targets: image, [...] The reason for this is that _cairo_boilerplate_target_matches_name() doesn't get a null-terminated string, but instead has a pointer to the end of the string. However, strpbrk() expects a null-terminated argument and thus could return a result which points past the end of the input. This commit fixes exactly this. Reported-by: Darxus <darxus@chaosreigns.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
* boilerplate: Use any2ppm from ANY2PPM env variableAndrea Canciani2012-02-231-2/+9
| | | | | | | | | If the environment variable ANY2PPM is set, use it as the path to the any2ppm program. Otherwise, default to "./any2ppm" as before. This makes it possible to set the ANY2PPM variable in the Makefile.win32 build system, which makes it possible to use the "test" target on the script backend.
* boilerplate: Remove unused thread id parameterAndrea Canciani2011-11-121-3/+0
| | | | | The thread id is not used anymore (it is always == 0), so it can be removed.
* boilerplate: Provide close callback after opening any2ppm outputAndrea Canciani2011-11-111-3/+8
| | | | | | | | cairo_boilerplate_open_any2ppm() returns a FILE* obtined from popen() or fdopen(). It should hence be closed using pclose() or fclose() respectively. Fixes the crash on every script test on MacOS X.
* Silence some 'unused var' warningsAndrea Canciani2011-11-091-2/+0
|
* Introduce a new compositor architectureChris Wilson2011-09-121-9/+5
| | | | | | | | | | | | | | | | | | Having spent the last dev cycle looking at how we could specialize the compositors for various backends, we once again look for the commonalities in order to reduce the duplication. In part this is motivated by the idea that spans is a good interface for both the existent GL backend and pixman, and so they deserve a dedicated compositor. xcb/xlib target an identical rendering system and so they should be using the same compositor, and it should be possible to run that same compositor locally against pixman to generate reference tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> P.S. This brings massive upheaval (read breakage) I've tried delaying in order to fix as many things as possible but now this one patch does far, far, far too much. Apologies in advance for breaking your favourite backend, but trust me in that the end result will be much better. :)
* boilerplate: improve fidelity of surface extractionChris Wilson2011-08-131-3/+15
| | | | | | Create an image surface of equivalent content to the original. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* perfChris Wilson2011-06-021-4/+68
|
* boilerplate: Add describe stringBenjamin Otte2010-07-031-3/+18
| | | | Print the pixman version we're using
* boilerplate: Add a describe vfuncBenjamin Otte2010-07-031-5/+5
| | | | | | | | | This function is supposed to describe the backend in use. The describe function is optional - and therefore initialized as NULL everywhere. Note: It is well known that the xlib backend uses X. What is not known is what version the server supports or what graphics card it is running on. That is the information the describe vfunc is supposed to provide.
* whitespace: Fixup formal arguments and tabs in boilerplate/ and perf/.M Joonas Pihlaja2010-06-241-49/+53
| | | | | Ran a script to align the formal parameters of functions and collapse spaces to tabs in code.
* boilerplate: Fix use after free from 3ae5723Chris Wilson2010-04-301-3/+10
| | | | | | If we want to access the surface during the cleanup, we must hold our own reference to it. Make it so for the forced finish of the recording surface.
* boilerplate: Ensure that the recording surfaces are finished.Chris Wilson2010-04-301-5/+5
| | | | | Be paranoid and explicitly call finish to cleanup self-referential leaks when using paginated/recording surfaces.
* boilerplate: Destroy the redundant image referenceChris Wilson2010-04-301-0/+2
| | | | | When using a script surface to record the recording surface, we replace the local reference to the image surface.
* boilerplate: Create an image16 targetChris Wilson2010-03-271-4/+35
| | | | | | In order to exercise the newly restored r5g6g5 support, we need to create an appropriate surface and feed it through the test and performance suites.
* boilerplate: Cleanup the list of backends upon shutdown.Chris Wilson2010-03-231-0/+13
|
* api: Introduce CAIRO_FORMAT_INVALID formally in the API.M Joonas Pihlaja2010-03-011-1/+1
| | | | | | We were exposing the actual value of CAIRO_FORMAT_INVALID through API functions already, so it makes sense to just go ahead and put it in the cairo_format_t enum.
* script: Port cairo_script_context_t to cairo_device_tChris Wilson2010-01-221-3/+3
| | | | Use the unifying cairo_device_t for cairo_script_context_t and replace.
* [dirty] Add more missing surface dirtying notifications.M Joonas Pihlaja2009-11-291-0/+1
| | | | | | Now that the image surface actually cares about cairo_surface_mark_dirty() we're hitting cases where we've forgotten to mark surfaces dirty.
* [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.M Joonas Pihlaja2009-10-221-23/+23
| | | | | | | The new name is more descriptive than the rather opaque meta surface. Discussed with vigour on the mailing list and #cairo: http://lists.cairographics.org/archives/cairo/2009-July/017571.html
* [build] Check for dlsym in both libdl and libc.M Joonas Pihlaja2009-09-141-2/+2
| | | | The BSDs have dlsym() in libc rather than libdl.
* [boilerplate] Support wildcard ? in CAIRO_TEST_TARGET{,_EXCLUDE}.M Joonas Pihlaja2009-09-051-4/+6
| | | | Useful for running tests only for a given content type.
* [boilerplate] Support giving content in CAIRO_TEST_TARGET{,_EXCLUDE}.M Joonas Pihlaja2009-09-051-4/+57
| | | | | | | Sometimes it's convenient to run the regression or performance tests against a given target with a given content. Now we accept an optional content specifier as a suffix .<content> on a target name, where <content> is rgb or rgba.
* [boilerplate] Runtime library checkChris Wilson2009-08-291-3/+26
| | | | | | | For the purposes of benchmarking it is useful to run cairo-perf against a different library from the one it was compiled against. In order to do so, we need to check that the runtime library contains the required entry points for our targets - which we can check by using dlsym.
* [script] Introduce cairo_script_context_tChris Wilson2009-08-291-22/+4
| | | | | | cairo_script_context_t is an encapsulation object for interfacing with the output - multiple surfaces can share the same context, meaning that they write to the same destination file/stream.
* [boilerplate] Fix compilation against old revisions (as old as 1.9.2!)Chris Wilson2009-07-241-3/+7
|
* Remove clip handling from generic surface layer.Chris Wilson2009-07-231-32/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling clip as part of the surface state, as opposed to being part of the operation state, is cumbersome and a hindrance to providing true proxy surface support. For example, the clip must be copied from the surface onto the fallback image, but this was forgotten causing undue hassle in each backend. Another example is the contortion the meta surface endures to ensure the clip is correctly recorded. By contrast passing the clip along with the operation is quite simple and enables us to write generic handlers for providing surface wrappers. (And in the future, we should be able to write more esoteric wrappers, e.g. automatic 2x FSAA, trivially.) In brief, instead of the surface automatically applying the clip before calling the backend, the backend can call into a generic helper to apply clipping. For raster surfaces, clip regions are handled automatically as part of the composite interface. For vector surfaces, a clip helper is introduced to replay and callback into an intersect_clip_path() function as necessary. Whilst this is not primarily a performance related change (the change should just move the computation of the clip from the moment it is applied by the user to the moment it is required by the backend), it is important to track any potential regression: ppc: Speedups ======== image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup ▌ image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup ▎ image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup ▏ image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup ▏ Slowdowns ========= image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown ▏
* Remove the defunct test-meta surfaceChris Wilson2009-07-041-0/+35
| | | | | Replace the internal test-meta surface will the freshly exported, real meta-surface.
* [boilerpate] Move target definition to backends.Chris Wilson2009-07-041-561/+78
| | | | | | | | | | | By moving the backend target definition out of the massive amlagamated block in cairo-boilerplate.c and into each of the cairo-boilerplate-backend.c, we make it much easier to add new targets as the information need only be entered in a single file and not scattered across three. However, updating the target interface means trawling across all the files -- except given that I found it difficult maintaining the single massive array I do not see this as an increase in the maintenance burden.
* [boilerplate] Read whole RGB lines at a timeChris Wilson2009-07-041-6/+7
| | | | | Rather than read+unpack each pixel, read in a whole RGB packed line and unpack the whole line in a single pass.
* Export meta-surfaceChris Wilson2009-07-031-6/+6
| | | | | | | | | | The meta-surface is a vital tool to record a trace of drawing commands in-memory. As such it is used throughout cairo. The value of such a surface is immediately obvious and should be applicable for many applications. The first such case is by cairo-test-trace which wants to record the entire graph of drawing commands that affect a surface in the event of a failure.
* [boilerplate] Propagate original error from create_from_png()Chris Wilson2009-06-281-0/+2
| | | | | | | | During cairo_boilerplate_get_image_surface_from_png() the original status returned by cairo_image_surface_create_from_png() could have been masked by inappropriate context construction when flattening or extracting. Simply check after creating the surface from the png file, and return immediately if in error.
* [test] Disable fallback16 testingChris Wilson2009-06-281-2/+2
| | | | | | | Only use the RGB16_565 surface as a source during testing. We presume that pixman is itself rigorously tested and the output is equivalent to the image surface. Enabling this test surface would require too large of a burden to maintain the reference images for the 16-bit backend.
* [test] Add group-unalignedChris Wilson2009-06-271-5/+5
| | | | | | | | | | | Test case for: Bug 22441 -- Unexpected shift with push_group and pop_group https://bugs.freedesktop.org/show_bug.cgi?id=22441 This is a test that demonstrates the error in the pdf backend when using groups on surfaces with non-integer sizes. In order to create such a surface, we need to update the boilerplate to use doubles instead of integers when specifying the surface size.
* [boilerplate] Implement a reference xlib surfaceChris Wilson2009-06-211-2/+12
| | | | | | | | | | | Create an xlib target that uses a separate display, specified by CAIRO_REFERENCE_DISPLAY, that can be used as a reference implementation for the normal display. So this can be used by cairo-trace-test to create a reference surface that mimics exactly the true surface, but if it targets an Xvfb display will be entirely rendered in software. If CAIRO_REFERENCE_DISPLAY is not set, the reference surface degrades into an xlib-fallback surface which is a close approximation (but still has behavioural differences).
* [test] Experiment with reference targetsChris Wilson2009-06-191-113/+141
| | | | | | Specify another boilerplate target to use as the reference for this target. We then use this in cairo-test-trace in preference to using the image surface. Still not perfect, though the framework is improving.
* Revert "[test] Make the xlib-fallback use the image refs."M Joonas Pihlaja2009-06-191-1/+1
| | | | | | | This reverts commit 903b39c30448d62e2cbf9d075c5256a333bd5d8f. The xlib-fallback actually renders mostly via traps at the moment, so staying with xlib refs is the right thing to do.
* Import Qt backend by MozillaVladimir Vukicevic2009-06-161-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Written by Vladimir Vukicevic to enable integration with Qt embedded devices, this backend allows cairo code to target QPainter, and use it as a source for other cairo backends. This imports the sources from mozilla-central: http://mxr.mozilla.org/mozilla-central/find?text=&kind=text&string=cairo-qpainter renames them from cairo-qpainter to cairo-qt, and integrates the patch by Oleg Romashin: https://bugs.freedesktop.org/attachment.cgi?id=18953 And then attempts to restore 'make check' to full functionality. However: - C++ does not play well with the PLT symbol hiding, and leaks into the global namespace. 'make check' fails at check-plt.sh - Qt embeds a GUI into QApplication which it requires to construct any QPainter drawable, i.e. used by the boilerplate to create a cairo-qt surface, and this leaks fonts (cairo-ft-fonts no less) causing assertion failures that all cairo objects are accounted for upon destruction. [Updated by Chris Wilson] Acked-by: Jeff Muizelaar <jeff@infidigm.net> Acked-by: Carl Worth <cworth@cworth.org>
* Expose _cairo_null_surface_create() via a test surfaceChris Wilson2009-06-151-0/+9
| | | | | | | Using a null surface is a convenient method to measure the overhead of the performance testing framework, so export it although as a test-surface so that it will only be available in development builds and not pollute distributed libraries.
* [boilerplate] Make array of targets const.Chris Wilson2009-06-121-4/+4
| | | | Protect the boilerplate targets from unexpected modifications.
* [boilerplate] Export cairo_boilerplate_get_image_target()Chris Wilson2009-06-121-0/+17
| | | | | A routine to scan the compiled list of targets and return the entry corresponding to the image backend.