Skip to content

Commit

Permalink
image: Implement high level interface.
Browse files Browse the repository at this point in the history
Write a dedicated compositor for pixman so that we avoid the
middle-layer syndrome of surface-fallback. The major upshot of this
rewrite is that the image surface is now several times quicker for glyph
compositing, which dramatically improves performance for text rendering
by firefox and friends. It also uses a couple of the new scan
convertors, such as the rectangular scan converter for rectilinear
paths.

Speedups
========
image-rgba          firefox-talos-gfx-0    342050.17 (342155.88 0.02%) -> 69412.44 (69702.90 0.21%):  4.93x speedup
███▉
image-rgba                        vim-0    97518.13 (97696.23 1.21%) -> 30712.63 (31238.65 0.85%):  3.18x speedup
██▏
image-rgba                  evolution-0    69927.77 (110261.08 19.84%) -> 24430.05 (25368.85 1.89%):  2.86x speedup
█▉
image-rgba                    poppler-0    41452.61 (41547.03 2.51%) -> 21195.52 (21656.85 1.08%):  1.96x speedup
█
image-rgba       firefox-planet-gnome-0    217512.61 (217636.80 0.06%) -> 123341.02 (123641.94 0.12%):  1.76x speedup
▊
image-rgba             swfdec-youtube-0    41302.71 (41373.60 0.11%) -> 31343.93 (31488.87 0.23%):  1.32x speedup
▍
image-rgba         swfdec-giant-steps-0    20699.54 (20739.52 0.10%) -> 17360.19 (17375.51 0.04%):  1.19x speedup
▎
image-rgba                       gvim-0    167837.47 (168027.68 0.51%) -> 151105.94 (151635.85 0.18%):  1.11x speedup
▏
image-rgba          firefox-talos-svg-0    375273.43 (388250.94 1.60%) -> 356846.09 (370370.08 1.86%):  1.05x speedup
  • Loading branch information
Chris Wilson committed Jan 22, 2010
1 parent ec7cc9d commit b9407af
Show file tree
Hide file tree
Showing 14 changed files with 3,342 additions and 678 deletions.
3,987 changes: 3,332 additions & 655 deletions src/cairo-image-surface.c

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/cairo-mutex-list-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_surface_cache_lock)

CAIRO_MUTEX_DECLARE (_cairo_image_solid_cache_mutex)

CAIRO_MUTEX_DECLARE (_cairo_toy_font_face_mutex)
CAIRO_MUTEX_DECLARE (_cairo_intern_string_mutex)
CAIRO_MUTEX_DECLARE (_cairo_scaled_font_map_mutex)
Expand Down
10 changes: 2 additions & 8 deletions src/cairo-xcb-surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,8 @@ _get_image_surface (cairo_xcb_surface_t *surface,
* which takes data in an arbitrary format and converts it
* to something supported by that library.
*/
image = (cairo_image_surface_t *)
_cairo_image_surface_create_with_masks (data,
&masks,
extents.width,
extents.height,
bytes_per_line);
if (image->base.status)
goto FAIL;
ASSERT_NOT_REACHED;
goto FAIL;
}

/* Let the surface take ownership of the data */
Expand Down
21 changes: 6 additions & 15 deletions src/cairoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ struct _cairo_image_surface {
int depth;

pixman_image_t *pixman_image;
cairo_region_t *clip_region;

unsigned owns_data : 1;
unsigned transparency : 2;
Expand Down Expand Up @@ -2162,9 +2161,15 @@ _cairo_format_bits_per_pixel (cairo_format_t format) cairo_const;
cairo_private cairo_format_t
_cairo_format_from_content (cairo_content_t content) cairo_const;

cairo_private cairo_format_t
_cairo_format_from_pixman_format (pixman_format_code_t pixman_format);

cairo_private cairo_content_t
_cairo_content_from_format (cairo_format_t format) cairo_const;

cairo_private cairo_content_t
_cairo_content_from_pixman_format (pixman_format_code_t pixman_format);

cairo_private cairo_surface_t *
_cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
pixman_format_code_t pixman_format);
Expand All @@ -2184,25 +2189,11 @@ _cairo_image_surface_create_with_pixman_format (unsigned char *data,
int height,
int stride);

cairo_private cairo_surface_t *
_cairo_image_surface_create_with_masks (unsigned char *data,
cairo_format_masks_t *format,
int width,
int height,
int stride);

cairo_private cairo_surface_t *
_cairo_image_surface_create_with_content (cairo_content_t content,
int width,
int height);

cairo_private cairo_surface_t *
_cairo_image_surface_create_for_data_with_content (unsigned char *data,
cairo_content_t content,
int width,
int height,
int stride);

cairo_private void
_cairo_image_surface_assume_ownership_of_data (cairo_image_surface_t *surface);

Expand Down
Binary file modified test/clip-fill-unbounded.argb32.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/clip-fill-unbounded.rgb24.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/clip-stroke-unbounded.argb32.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/clip-stroke-unbounded.rgb24.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/clip-stroke.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/clipped-group.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/leaky-dashed-rectangle.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/scale-offset-image.xfail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/scale-offset-similar.xfail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/self-intersecting.ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b9407af

Please sign in to comment.