summaryrefslogtreecommitdiff
path: root/src/test-paginated-surface.c
Commit message (Collapse)AuthorAgeFilesLines
* Introduce a new compositor architectureChris Wilson2011-09-121-18/+6
| | | | | | | | | | | | | | | | | | 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. :)
* API: map-to-image and create-similar-imageChris Wilson2011-07-261-1/+5
| | | | | | | | | | | | | | | | A common requirement is the fast upload of pixel data. In order to allocate the most appropriate image buffer, we need knowledge of the destination. The most obvious example is that we could use a shared-memory region for the image to avoid the transfer cost of uploading the pixels to the X server. Similarly, gl, win32, quartz... The other side of the equation is that for manual modification of a remote surface, it would be more efficient if we can create a similar image to reduce the transfer costs. This strategy is already followed for the destination fallbacks and this merely exposes the same capability for the application fallbacks. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* clip: Rudimentary support for clip-polygon extractionChris Wilson2011-07-191-7/+7
| | | | | | | Step 1, fix the failings sighted recently by tracking clip-boxes as an explicit property of the clipping and of composition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Implement cairo_backend_tChris Wilson2011-07-151-0/+2
| | | | | | | | | | Allow a backend to completely reimplement the Cairo API as it wants. The goal is to pass operations to the native backends such as Quartz, Direct2D, Qt, Skia, OpenVG with no overhead. And to permit complete logging contexts, and whatever else the imagination holds. Perhaps to experiment with double-paths? Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* Add cairo_device_tChris Wilson2010-01-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device is a generic method for accessing the underlying interface with the native graphics subsystem, typically the X connection or perhaps the GL context. By exposing a cairo_device_t on a surface and its various methods we enable finer control over interoperability with external interactions of the device by applications. The use case in mind is, for example, a multi-threaded gstreamer which needs to serialise its own direct access to the device along with Cairo's across many threads. Secondly, the cairo_device_t is a unifying API for the mismash of backend specific methods for controlling creation of surfaces with explicit devices and a convenient hook for debugging and introspection. The principal components of the API are the memory management of: cairo_device_reference(), cairo_device_finish() and cairo_device_destroy(); along with a pair of routines for serialising interaction: cairo_device_acquire() and cairo_device_release() and a method to flush any outstanding accesses: cairo_device_flush(). The device for a particular surface may be retrieved using: cairo_surface_get_device(). The device returned is owned by the surface.
* Constify stroke style and matrices.Chris Wilson2010-01-221-3/+3
| | | | | | As a simple step to ensure that we do not inadvertently modify (or at least generate compiler warns if we try) user data, mark the incoming style and matrices as constant.
* Move _cairo_error() to a standalone headerChris Wilson2010-01-221-0/+1
| | | | | A pending commit will want to include some utility code from cairo and so we need to extricate the error handling from the PLT symbol hiding.
* Remove clip handling from generic surface layer.Chris Wilson2009-07-231-75/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ▏
* Query the backend to see if we can repaint the solid pattern.Chris Wilson2008-12-181-0/+1
| | | | | | | If we are dithering on the Xlib backend we can not simply repaint the surface used for a solid pattern and must recreate it from scratch. However, for ordinary XRender usage we do not want to have to pay that price - so query the backend to see if we can reuse the surface.
* [cairo-spans] Add a check/create_span_renderer backend methods.M Joonas Pihlaja2008-12-061-0/+2
| | | | | | | | | | | A surface will have the chance to use span rendering at cairo_fill() time by creating a renderer for a specific combination of pattern/dst/op before the path is scan converted. The protocol is to first call check_span_renderer() to see if the surface wants to render with spans and then later call create_span_renderer() to create the renderer for real once the extents of the path are known. No backends have an implementation yet.
* Mark allocation failures as unlikely.Chris Wilson2008-11-291-1/+1
| | | | | Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
* Add an extents argument to the high level surface backend functionsAdrian Johnson2008-11-021-10/+15
| | | | | | | | | | | | | | | Add a "cairo_rectangle_int_t *extents" argument to to the following backend functions: paint mask, stroke fill show_glyphs show_text_glyphs This will be used to pass the extents of each operation computed by the analysis surface to the backend. This is required for implementing EXTEND_PAD.
* [pattern] Avoid needless copying of patterns.Chris Wilson2008-10-301-20/+20
| | | | | | | Only copy the pattern if we need to modify it, e.g. preserve a copy in a snapshot or a soft-mask, or to modify the matrix. Otherwise we can continue to use the original pattern and mark it as const in order to generate compiler warnings if we do attempt to write to it.
* Ensure that the scaled font is frozen for the lifetime of the scaled glyph.Chris Wilson2008-10-221-20/+5
| | | | | | | | | | | | | | | | After discussing the scaled font locking with Behdad, it transpired that it is not sufficient for a font to be locked for the lifetime of a scaled glyph, but that the scaled font's glyph cache must be frozen for the glyph' lifetime. If the cache is not frozen, then there is a possibility that the glyph may be evicted before the reference goes out of scope i.e. the glyph becomes invalid whilst we are trying to use it. Since the freezing of the cache is the stronger barrier, we remove the locking/unlocking of the mutex from the backends and instead move the mutex acquisition into the freeze/thaw routines. Then update the rule on acquiring glyphs to enforce that the cache is frozen and review the usage of freeze/thaw by all the backends to ensure that the cache is frozen for the lifetime of the glyph.
* [test-paginated] Fix double free of surface along error path.Chris Wilson2008-10-191-7/+9
| | | | | The ownership of the surface is transferred to the paginated surface, so we do not need to destroy it ourselves along the error path.
* [show_text_glyphs] Replace the bool backward with cairo_text_cluster_flagsBehdad Esfahbod2008-09-181-3/+2
| | | | | | | | | | Chris rightfully complained that having a boolean function argument is new in cairo_show_text_glyphs, and indeed avoiding them has been one of the API design criteria for cairo. Trying to come up with alternatives, Owen suggested using a flag type which nicely solves the problem AND future-proofs such a complex API. Please welcome _flags_t APIs to cairo.h
* Add new public API cairo_surface_has_show_text_glyphs()Behdad Esfahbod2008-08-181-1/+1
| | | | | | We added cairo_has_show_text_glyphs() before. Since this is really a surface property, should have the surface method too. Like we added cairo_surface_show_page()...
* Remove _cairo_surface_show_glyphs() in favor of ↵Behdad Esfahbod2008-06-301-13/+38
| | | | _cairo_surface_show_text_glyphs()
* [cairo-xlib] Fix show_glyphs when failing to upload a glyphBehdad Esfahbod2008-05-231-1/+2
| | | | | | | | | | | | | | | | | | Originally reported here: http://lists.cairographics.org/archives/cairo/2008-May/014032.html and analyized later in the thread. Change (font and surface) backend show_glyphs() API to take a int *remaining_glyphs argument. It's used to communicate to the caller, by way of setting remaining_glyphs and returning INT_STATUS_UNSUPPORTED, that some of the glyphs were shown but not the others. The xlib backend now correctly uses this to handle failure to upload a glyph to the server. So the large-font test passes now. An alternative approach could be to add some public value for glyphs indices that are not shown. -1 perhaps (the xlib backend already uses that value internally). Then instead of remaining_glyphs, a backend could simply set glyph indices of glyphs shown to that -1 value.
* [cairo-paginated-surface] Clean up reference counting messBehdad Esfahbod2008-05-091-1/+4
| | | | | | | | | | Previously the paginated constructor didn't reference the target surface, but simply assume ownership of the reference, and then unref it when shutting down. The callers to paginated constructor then, where just give away their reference to paginated and not unref the reference they were holding. While this works correctly, it's against the usual idioms that everyone is responsible for the reference they are holding, and should get their own reference if they need to keep an object alive. Fix it all.
* [cairo-surface] Introduce _cairo_surface_create_in_error().Chris Wilson2008-01-161-3/+2
| | | | | Unexport all the static error surfaces and use a function to select the appropriate error surface for the status.
* [test-paginated] Free resources if fail to create the test surface.Chris Wilson2007-10-051-2/+10
| | | | | Ensure that all the locally allocated resources are freed if we fail to allocate the paginated test surface.
* [cairo-error] Clean up all the warnings and missing _cairo_error() calls.Chris Wilson2007-10-041-4/+2
| | | | | | | | | | | Every time we assign or return a hard-coded error status wrap that value with a call to _cairo_error(). So the idiom becomes: status = _cairo_error (CAIRO_STATUS_NO_MEMORY); or return _cairo_error (CAIRO_STATUS_INVALID_DASH); This ensures that a breakpoint placed on _cairo_error() will trigger immediately cairo detects the error.
* Revert "[cairo-gstate] Avoid copying untransformed glyphs."Chris Wilson2007-08-311-1/+1
| | | | | | | | This reverts commit 919bea6dbb32746f11781cd3a94eb44f5c4a32e6. Sadly as Behdad points out some backends do modify the glyph array and, for example cairo-xlib-surface, hide this from the compiler with some evil casts.
* [cairo-gstate] Avoid copying untransformed glyphs.Chris Wilson2007-08-311-1/+1
| | | | | | | | Skip the memory duplication of the incoming glyphs if we do not need to transform them into the backend coordinate system. As a consequence we need to constify the glyphs passed to the backend functions.
* [fixpt] Create cairo_region wrapper around pixman_region16_tVladimir Vukicevic2007-07-181-1/+1
| | | | | Insulate region-using code from implementation details; at some point we'll want to switch to using 32-bit regions.
* [fixpt] Replace cairo_rectangle_int16_t with cairo_rectangle_int_tVladimir Vukicevic2007-07-181-1/+1
| | | | | Mostly s/cairo_rectangle_int16_t/cairo_rectangle_int_t/, as well as definitions to pick cairo_rectangle_int_t.
* [paginated] Move cairo_paginated_surface_t to cairo-paginated-surface-private.hBehdad Esfahbod2007-04-211-1/+1
| | | | The old cairo-paginated-surface-private.h is cairo-paginated-private.h now.
* [src] Make sure all source files #include "cairoint.h" as their first includeBehdad Esfahbod2007-04-031-2/+2
| | | | | | | | | | | | | | | | | | This is necessary to avoid many portability problems as cairoint.h includes config.h. Without a test, we will regress again, hence add it. The inclusion idiom for cairo now is: #include "cairoint.h" #include "cairo-something.h" #include "cairo-anotherthing-private.h" #include <some-library.h> #include <other-library/other-file.h> Moreover, some standard headers files are included from cairoint.h and need not be included again.
* Oops. Remove cairo-mutex-private.h include from test surfacesBehdad Esfahbod2007-03-201-1/+0
| | | | as that file is included from cairoint.h now.
* Include cairo-mutex-private.h in test backendsBehdad Esfahbod2007-03-201-0/+1
|
* [test-surfaces] Prefix public symbols with _cairoBehdad Esfahbod2007-03-131-1/+1
|
* Add scaled_font->mutex to allow locking for all subordinate objectsCarl Worth2007-02-061-2/+17
| | | | | | | | | | | | | | | | | | | | | A cairo_scaled_font_t can be implicitly shared among multiple threads as the same cairo_scaled_font_t can be returned from different calls to cairo_scaled_font_create. To retain the illusion that these different calls produce distinct objects, cairo must internally lock access when modifying them. Each glyph in the scaled font is represented by a cairo_surface_t which is used when rendering the glyph. Instead of attempting to push fine-grained locking of these surfaces down to the backend rendering functions, a simple per-cairo_scaled_font_t lock has been introduced which protects the entire rendering path against re-entrancy. Some care was required to ensure that existing re-entrancy was handled appropriately; these cases are in the wrapping surfaces (cairo-paginated, test-meta and test-paginated). Thanks to Vladimir Vukicev and Peter Weilbacher for testing/providing the mutex definitions for win32 and os2 (respectively).
* Add/remove const to cairo_glyph_t* arguments consistentlyBehdad Esfahbod2006-12-111-1/+1
| | | | | | | | | | | | | | The rule is: cairo_glyph_t* is always passed as const for measurement purposes. This was not reflected in our public api previously. Fixed Showing glyphs used to have cairo_glyph_t* always as const. With this changed, it is only const on cairo_t and cairo_gstate_t operations. cairo_surface_t, cairo_scaled_font_t, and individual backends receive cairo_glyph_t* as non-const. The desired semantics is that they may modify the contents of the array as long as they do not return CAIRO_STATUS_UNSUPPORTED. This makes it possible to avoid copying the glyph array again and again, and edit it in-place. Backends are in fact free to use the array as a generic buffer as they see fit.
* test-paginated: Fix memory leak within _test_paginated_surface_create_for_dataCarl Worth2006-08-081-1/+11
|
* Fix bogus cairo_rectangle_fixed_t to be cairo_rectangle_int16_t.Carl Worth2006-06-061-1/+1
| | | | | | 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).
* New API: Add new function cairo_surface_get_contentCarl Worth2006-05-241-1/+2
| | | | | | This assumes that the directfb, glitz, and quartz backends always create surfaces with content of COLOR_ALPHA which might be totally wrong.
* Rename cairo_rectangle_t to cairo_rectangle_fixed_t.Robert O'Callahan2006-05-041-2/+2
| | | | | | This is in preparation for a later function addition for extracting clip rectangles from a cairo_t, (which will add a public cairo_rectangle_t).
* Add a start_page function to the paginated_surface_backend.Carl Worth2006-04-141-0/+1
| | | | | | | | | | This allows for any surface using the paginated_surface backend to easily do stuff at the beginning of each page, (such as writing out any per-page header necessary). This replaces some of the per-page state tracking that the PS surface was doing, (though it still has some left for its optimization of CLEAR on a blank page).
* Add a new cairo_paginated_surface_backend_t rather than just a single ↵Carl Worth2006-04-141-10/+15
| | | | function pointer.
* Flesh test-paginated-surface out into a complete surface.Carl Worth2006-04-141-13/+206
| | | | | | | | This adds an aactual test_paginated_surface_backend rather than just having this test surface create a paginated surface around an image surface. This is a more realistic test of what a paginated surface is and should be more useful as an example of how to use the paginated surface, (and in particular the analysis portions).
* Merge in upstream 'ps-surface' changesCarl Worth2006-02-281-1/+18
|
* Big change to the test infrastructure and supporting internals. The goal now ↵Carl Worth2006-01-171-8/+9
| | | | | | | | | | | | | | | | | | | | is to test both a COLOR_ALPHA and a COLOR content for each surface backend, (since the semantics are different and we probably need to support both in each backend. The PS/PDF backends don't allow a content to be passed in right now, so they fail against the rgb24 tests, but the trivial addition to the constructors will allow them to pass all tests with both content values. And new constructors (currently internal only) to create an image surface with a cairo_content_t rather than a cairo_format_t. Add a cairo_content_t argument to the constructor. Add a cairo_content_t to the constructor and use this content value when constructing intermediate image surfaces in acquire_source, show_page, copy_page, and snapshot. Add image flattening by compositing over white, as is done in cairo-ps-surface.c. Track changes to cairo-paginates-surface which now requires a cairo_content_t value (no change to public PS/PDF constructors yet). Track change in meta-surface and paginated-surface interfaces by now accepting a cairo_content_t rather than a cairo_format_t. Ignore new output files (argb32 from pdf and ps as well as rgb24 from test-fallback, test-meta, and test-paginated). Add new utility for flattening PNG images in order to generate the -argbf-ref.png images. Add image_diff_flattened for comparing flattened output from PS and PDF backend with ARGB reference images by first blending the reference images over white. Get rid of conditional, format-specific background-color initialization before running tests. Now uses ARGB(0,0,0,0) in all cases. Switch from specifying tests with a format value to specifying tests with a content value. Add support for a 'fake' COLOR_ALPHA_FLATTENED content for testing the PS and PDF output against a flattened version of the argb32 reference images (first blended over white). Track change in cairo_ps_surface_create (now requires cairo_content_t value). Adjust tests that draw in default (black) to first paint white so that the results are visible. Adjust ARGB32 reference images for new white background for changed tests. Adjust RGB24 reference images for new black background due to changed initialization (and the tests themselves being unchanged).
* Add a private cairo_paginated_surface_t which builds on top of the meta ↵Carl Worth2005-12-211-0/+67
surface and is intended to provide an easy interface with common functionality for the various paginated surface types (ps, pdf, etc.). Add test_paginated_surface_t which is another test surface enabled with --enable-test-surfaces. The test_meta_surface code served as the basis for cairo_paginated_surface_t so that test surface may be entirely superfluous now.