summaryrefslogtreecommitdiff
path: root/src/cairo-type3-glyph-surface.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-12Introduce a new compositor architectureChris Wilson1-21/+14
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-13image: move surface definition to new header for subclassingChris Wilson1-0/+1
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26API: map-to-image and create-similar-imageChris Wilson1-1/+6
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-19clip: Rudimentary support for clip-polygon extractionChris Wilson1-20/+20
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-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>
2010-05-04type3: Minor tweaks to remove a redundant check.Chris Wilson1-6/+2
2010-04-27Update FSF addressAndrea Canciani1-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
2010-02-23image: split cairo_image_surface_coerce()Benjamin Otte1-1/+1
Split into a general cairo_image_surface_coerce() that coerces to one of the 3 supported formats (ARGB32, RGB24, A8) based on content and the more general cairo_image_surface_coerce_to_format() that coerces to a specified format.
2010-01-25Fix printing of rotated user fontsAdrian Johnson1-4/+5
b7550bf0 introduced a regression when user fonts are rendered to a rotated context.
2010-01-24Fix incorrect font scale and glyph position in Type 3 fontsAdrian Johnson1-16/+5
The PDF file referenced by bug 26186 contains a Type 3 font with non identity font matrix and a "1/2" glyph created by drawing the "1" and "2" from a Type 1 font. This combination exposed a bug in the font scale and glyph position in _cairo_type3_glyph_surface_show_glyphs when printing user font glyphs.
2010-01-22Add cairo_device_tChris Wilson1-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.
2010-01-22Constify stroke style and matrices.Chris Wilson1-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.
2010-01-22Move _cairo_error() to a standalone headerChris Wilson1-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.
2009-10-22[meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.M Joonas Pihlaja1-7/+7
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
2009-09-30[API] Make _cairo_meta_surface_replay() private againBenjamin Otte1-2/+2
Replaying a meta surface can be achieved by using it as a source for a cairo_paint() so exporting a separate API is unnecesary and confusing. So after consulting Chris and Carl, we decided to remove the function again.
2009-07-23Remove clip handling from generic surface layer.Chris Wilson1-35/+59
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 ▏
2009-07-03Export meta-surfaceChris Wilson1-4/+4
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.
2009-04-16[type3] Propagate error from font creation.Chris Wilson1-0/+2
Perform an error check after creating a scaled-font to prevent operations on a nil-object.
2009-04-16[type3] Add status checks.Chris Wilson1-3/+23
Propagate error from the stream when creating the surface and add status guards before writing to the potential nil object.
2009-04-16[type3] Check error status before emit_image().Chris Wilson1-2/+6
Be careful not to pass an error object down to emit_image() hook, propagate the error instead. This relieves the burden of the error check from the callee -- which was causing an assertion failure in the ps backend.
2008-12-18[image] Eliminate the short-lived context used for coercing.Chris Wilson1-16/+4
When coercing from one image format to another we performed a paint operation using a temporary context - this is overkill as we can just call _cairo_surface_paint() directly.
2008-12-06[cairo-spans] Add a check/create_span_renderer backend methods.M Joonas Pihlaja1-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.
2008-11-29Mark allocation failures as unlikely.Chris Wilson1-1/+1
Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
2008-11-29Mark if(status) as being unlikely.Chris Wilson1-5/+5
The error paths should be hit very rarely during normal operation, so mark them as being unlikely so gcc may emit better code.
2008-11-02Add an extents argument to the high level surface backend functionsAdrian Johnson1-6/+11
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.
2008-10-31[type3] Whitespace.Chris Wilson1-1/+2
Tightly scope the output stream.
2008-10-30[pattern] Avoid needless copying of patterns.Chris Wilson1-9/+9
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.
2008-10-22Don't add a notdef glyph to Type 3 font subsetsAdrian Johnson1-16/+0
This allows user-fonts to use glyph 0 when embedding in PS/PDF. According to ISO32000 Type 3 fonts do not require a notdef glyph.
2008-10-22Ensure that the scaled font is frozen for the lifetime of the scaled glyph.Chris Wilson1-9/+9
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.
2008-10-19[type3] Acquire scaled_font mutex whilst looking up glyphs.Chris Wilson1-20/+30
When looking up the glyph in the shared scaled_font glyph cache, the caller is required to have taken the scaled_font->mutex.
2008-09-26Fix bitmap-font XFAILAdrian Johnson1-7/+3
Images in PDF are scaled to a unit square. In PS we set the ImageMatrix to do the same. When the image is painted we scale the graphics state to paint the image at the right size. In the case of Type 3 fonts consisting of bitmap images we want to paint the images at their original size so we scale the graphics state by the image width and height. The bug was that we were scaling by the width/height in the glyph metrics. For non rotated fonts this worked. However for rotated fonts the width/height of the glyph images may be larger than the width/height in the glyph metrics. This resulted in a Type 3 font where the glyph images were scaled slightly smaller than they should have been.
2008-09-16Fix scaling of glyphs in type3 subset glyphsAdrian Johnson1-3/+9
2008-09-11Enable show_glyphs inside of in user-font glyphsAdrian Johnson1-5/+48
2008-09-11Add _cairo_type3_glyph_surface_analyze_glyph()Adrian Johnson1-0/+39
This function emits the glyph to a null stream with the side effect that other glyphs referenced by this user-font glyph will be added to the font subsets.
2008-09-02Revamp the build system.Behdad Esfahbod1-0/+5
Quick summary of changes: - Move list of cairo source files out of src/Makefile.am and into src/Sources.mk, - Generate files src/Config.mk and src/Config.mk.win32 that choose the right set of source files and headers based on configured backends and features. This drastically simplifies building using other build systems. The src/Makefile.win32 file needs to be updated to reflect these changes. - Add README files to various directories, - Add toplevel HACKING file.
2008-08-17[type3-glyph] Propagate error from image emission.Chris Wilson1-1/+1
Return the error status from ->emit_image().
2008-06-08Implement PS Type 3 font image supportAdrian Johnson1-26/+6
There does not appear to be any way of emulating PDF inline images in PostScript so we call back to the PS or PDF surface to emit the image.
2008-06-08Implement PDF Type 3 font subsetting of user fontsAdrian Johnson1-0/+465
show_glyphs inside a Type 3 font currently results in a fallback image. Some refactoring is required before font subsets can be created while emitting all the font subsets.