summaryrefslogtreecommitdiff
path: root/src/cairo-image-surface.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-12Introduce a new compositor architectureChris Wilson1-3935/+46
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. :)
2011-08-14image: peek through a snapshot to the recording surface behindChris Wilson1-2/+6
Fixes record-* after the recent overhaul. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14snapshot: Defer acquisitionChris Wilson1-2/+31
Fixes 'xlib-expose-event' but triggers an infinite loop in self-copy. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13image: move surface definition to new header for subclassingChris Wilson1-20/+27
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-05image: check if A8 image is bilevel when analyzing transparencyAdrian Johnson1-2/+13
2011-08-04image: fix bug in analyze_colorAdrian Johnson1-1/+1
2011-08-02pdf: check if images are grayscale or monochrome and encode as suchAdrian Johnson1-0/+59
Printing PDFs with large monochrome or grayscale images would result in the images being blown up to 24-bit color images. Some printers are very slow to print huge color images.
2011-08-01image: the boxes are already pixel-aligned so skip the extra rounding stepChris Wilson1-12/+12
2011-07-31image: Reduce compositing bounded boxes with a clip-mask to a polygonChris Wilson1-0/+42
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29image: Free clip_surface after useChris Wilson1-9/+14
The clip surface is no longer cached on the clip and the caller is responsible for destroying it after use. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29image: extend support of direct replay for paginated surfacesChris Wilson1-12/+60
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26composite: Pass unbounded extents to initialisationChris Wilson1-28/+28
For an unbounded surface we cannot assume (0, 0, surface_width, surface_height) as that is wrong and causes the operation to appear clipped. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26API: map-to-image and create-similar-imageChris Wilson1-1/+36
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>
2011-07-24image: Fix clip-intersectChris Wilson1-7/+12
Explicitly convert the clearing of the unbounded area. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23image: Apply mask-opacity to clip boxesChris Wilson1-146/+299
In the simple condition where the user is applying an opacity mask to a misaligned rectangle, we can treat it as a series of simpler composites by combining the opacity with the coverage of the box. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23image: replay the recording surface directly onto the targetChris Wilson1-1/+63
백현기 reported a use-case where he was recording an entire web-page onto the recording surface, in order to facilitate panning. In this scenario, where there may be lots of similar surfaces within the recording we generate thousands of unused snapshot-images bloating memory usage and impairing performance. Under the right conditions we can replay directly onto the destination which not only bypasses the snapshots but also skips the following resampling. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23image: Fix partial clipping of textChris Wilson1-19/+63
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19clip: Rudimentary support for clip-polygon extractionChris Wilson1-360/+147
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>
2011-07-15pattern: Add observer hooksChris Wilson1-0/+1
In order for custom context to automatically track when a pattern is modify after being set on the context (and before it is used in an operator), we need for there to be a callback when the pattern is modified. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-15Implement cairo_backend_tChris Wilson1-0/+3
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>
2011-07-14image: Only discard the outer boxesChris Wilson1-4/+5
This is necessary as the callers do not propagate the clip extents after finding the singular clip path. *sigh* Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08image: Don't crash on weird pixman formatsBenjamin Otte1-7/+16
_pixel_to_solid() used to assert that it got a known cairo_format_t. However, this might not be the case when backends decide to use a pixman format that is not representable by a cairo format (X and DirectFB are examples for backends that do that). This patch makes _pixel_to_solid() return NULL in that case and fixes the callers to deal with it. https://bugs.freedesktop.org/show_bug.cgi?id=37916
2011-05-04image: Fix pixman format to RGB30 conversionChris Wilson1-2/+2
Søren Sandmann Pedersen spotted that we had reversed the channel order in the conversion back from the pixman format codes to CAIRO_FORMAT_RGB30. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-01Expose 30bpp/10bpc support: CAIRO_FORMAT_RGB30Jesse Barnes1-2/+23
This is a common format used by framebuffers to drive 10bpc displays and is often hardware accelerated by XRender with underlying support from pixman's x2r10g10b10 format (which provides coercion paths for fallbacks). Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-31image: Don't use the fast path if it's wrongUli Schlachter1-0/+5
Fixes the new "operator-source" test and the original report from: http://lists.cairographics.org/archives/cairo/2011-March/021827.html I tested this code path with all operators and "source" is the only one which causes issues with rendering outside of the boxes. Possibly fixes: https://bugs.freedesktop.org/show_bug.cgi?id=35407 Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-18image: Silence gcc warningAndrea Canciani1-1/+1
gcc does not know thta num_glyph is guaranteed to be strictly positive, so it complains that: cairo-image-surface.c:3787: warning: ‘status’ may be used uninitialized in this function
2011-03-18image: Silence missing enum value warningAndrea Canciani1-0/+1
cairo-image-surface.c:101: warning: enumeration value ‘PIXMAN_x14r6g6b6’ not handled in switch
2011-02-19image: Fix surface acquisition if PIXMAN_HAS_ATOMIC_OPSAndrea Canciani1-0/+4
If PIXMAN_HAS_ATOMIC_OPS, ix and iy will be changed if the source surface is of subsurface type. They need to be reset to 0 before being passed to _cairo_matrix_to_pixman_matrix_offset() or the acquired surface will have an incorrect offset .
2011-02-19image: Avoid reusing pixman images for threadsafety.M Joonas Pihlaja1-24/+36
The pixman_image_ref() and pixman_image_unref() functions aren't threadsafe in current pixman, so we can't share pixman images across contexts where they may end up moving between threads. The main use of these functions is in keeping a global cache of pixman_image_ts for solid colours and reusing the same pixman_image_t for patterns pointing to the same image data where possible. This patch removes those uses from cairo by wrapping them in a PIXMAN_HAS_ATOMIC_OPS conditional. There is no automatic test this, so we will have to manually turn this code back on when pixman does gain atomic ops. The only two remaining calls to pixman_image_ref() are done on locally created images so they are safe. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34177
2011-02-06image: Limit span rendering to bounded extentsChris Wilson1-0/+28
We make the presumption that the incoming geometry is appropriately clipped to the bounded extents and can simply memset without being out of bounds. However, this was not always the case as we were removing the clip boxes in order to optimise the common case where the operation is naturally limited to the surface. (This is a candidate for 1.10) Bugzilla: https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/710072 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-16doc: Add links to flush() and mark_dirty() in direct access functionsAndrea Canciani1-0/+5
cairo_image_get_data() and other direct access functions are often misused by applications because they don't call cairo_surface_flush() and/or cairo_surface_mark_dirty() around the code which accesses the surface data directly. Although this information is already available in the description of the cairo_surface_t type, adding a reminder about it in the direct access functions should make it easier to use them correctly.
2011-01-02pattern: Factor out pattern rescalingAndrea Canciani1-52/+12
The same code was duplicated (incorrectly and with some minor differences) in pattern, image, xlib and xcb. _cairo_gradient_pattern_max_val() abstracts that code in a function that can be used whenever a gradients extremes need to be rescaled to fit within a given range. Fixes huge-linear, huge-radial. Fixes part of https://bugs.freedesktop.org/show_bug.cgi?id=32215
2011-01-02matrix: Cairo matrix to pixman transform/offset conversionAndrea Canciani1-120/+44
Xlib, XCB and image use the same code to convert a cairo_matrix_t to a backend-specific transform. The code did not handle correctly some matrices, thus a new function that performs the conversion in a more generic way was added and used in the backends instead of fixing the repeated code. Fixes part of https://bugs.freedesktop.org/show_bug.cgi?id=32215
2011-01-01Add mesh gradient rasterizerAndrea Canciani1-0/+25
Add an implementation of a fast and reasonably accurate non-antialiased mesh gradient rasterizer.
2010-12-10polygon: Merge _cairo_polygon_init and _cairo_polygon_limitAndrea Canciani1-4/+2
_cairo_polygon_limit() had to be called immediately after _cairo_polygon_init() (or never at all). Merging the two calls is a simple way to enforce this rule.
2010-11-28image: Fix _pixel_to_solidAndrea Canciani1-1/+3
An A1 image with full alpha should be opaque black, not opaque white. Use specialized solid black image instead of the generic constructor for an A8 image with full alpha (it is likely to be cached).
2010-11-28image: Fix compositing of unaligned boxesAndrea Canciani1-8/+14
The input of _fill_unaligned_boxes is (supposed to be) composed only of disjoint rectangles, that can safely be passed to the rectilinear span converter, but this function artificially introduces intersecting rectangles when drawing non-aligned boxes. Using non-intersecting rectangles is easy and makes the code correct. Fixes rectilinear-grid. Reviewed-by: Uli Schlachter <psychon@znc.in>
2010-11-28Fix fallback-resolution testAdrian Johnson1-16/+41
The recording surface source image painted onto fallback images always had the resolution 72ppi instead of the fallback resolution of the target surface. Fix this by passing adding a new acquire_source_image_transformed backend function for the recording surface to use and passing the target device transform through to the recording surface when the image is acquired. Based on Carl Worth's experimental acquired_source_image_transformed branch. https://bugs.freedesktop.org/show_bug.cgi?id=24692
2010-11-01image: Use correct size for allocationAndrea Canciani1-2/+2
In 06e9caf86199e8261a07db6d4774628fa147728d the type of the variables was changed, but the type used to compute the allocation size was not. Fixes a crash in user-font-mask (test-fallback backend).
2010-10-29path: Do not access flags directlyAndrea Canciani1-3/+3
Use inline accessors to hide the flags in the code. This ensures that flags that need additional computations (example: is_rectilinear for the fill case) are always used correctly.
2010-10-21raster backends: Set round_glpyh_positions to ONUli Schlachter1-0/+1
This fixes "text-rotate" in the test suite for the image backend and "overlapping-glyphs" for the xcb backend. Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-15xcb,image: Fix a missing clip finiChris Wilson1-1/+3
Spotted by Uli Schlachter when I copied the image glyphs clipping to xcb. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-29image: The a8 in-place span compositing is only valid for SOURCEChris Wilson1-2/+7
Fixes test/a8-clear. Reported-by: Jeremy Moles <jeremy@emperorlinux.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-29image: Silence a compile warningChris Wilson1-1/+1
cairo-image-surface.c: In function ‘_cairo_image_reset_static_data’: cairo-image-surface.c:1006: warning: old-style function definition Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-09image: add _cairo_image_reset_static_dataAndrea Canciani1-8/+34
Image has static caches which needs to be reset to make cairo_debug_reset_static_data behave as expected. Silences a bunch of leak reports by check-valgrind. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-08-26subsurface: Make CAIRO_SURFACE_TYPE_SUBSURFACE publicBenjamin Otte1-1/+1
2010-07-23image: Compensate mask origins for glyph clippingChris Wilson1-1/+1
Fixes the regression in bitmap-font and large-font pointed out by Andrea Canciani since ef067933.
2010-07-12image: Manually clip against bounds when rendering directlyChris Wilson1-4/+19
This is path is slightly peculiar in that it explicitly avoid the intermediate mask and the geometry is not pre-clipped. This in conjunction with the previous commit fixes: Clip doesn't work for text https://bugs.freedesktop.org/show_bug.cgi?id=29008 which is captured in test/partial-clip-text.
2010-07-12Differentiate between reducing clip to composite extents and a rectangleChris Wilson1-5/+5
This is required for handling glyphs when rendering directly to the surface.
2010-07-08doc: Move tmpl/ docs to inline docsBenjamin Otte1-0/+21
I did this manually so I could review the docs at the same time. If anyone finds typos or other mistakes I did, please complain to me (or better: fix them).