summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVasily Galkin <galkin-vv@yandex.ru>2018-04-28 22:27:01 +0300
committerBryce Harrington <bryce@bryceharrington.org>2018-05-31 17:34:17 -0700
commitd4355ecee26f6ca7db26874ce4dbfec599f6040e (patch)
tree189709633255778de72f207b0e838eeb831dda9a /src
parent0cb7aad2a375f957803c5f34fb6088e330f17f85 (diff)
win32: Allow GDI operations for argb32 surfaces (allowed by surface flags)
This finishes a patch series to speed up CAIRO_OPERATOR_SOURCE when used to copy data to a argb32 cairo surface corresponding to a win32 dc from a "backbuffer" - DibSection-based cairo surface created with cairo_surface_create_similar(). This final patch allows the GDI compositor to be used on argb32 surfaces. For display surfaces, only copying is allowed with gdi (by BitBlt), since other operations are filtered by flags in implementations. But since copying pixels is the only operation used in the most common scenario (prepare an offscreen image and send it to the screen) - this is important for presenting argb32 windows with Cairo directly or with gtk+gdk (which nowadays always creates argb32 windows). Before this patch pixel copy worked by: 1. mapping image to memory (by copying data from window dc to system memory which is very slow on windows maybe due to gpu or interprocess access) 2. copying new data over that image. 3. copying updated image from system memory back to window dc. After this patch there is only one step: 2+3. Copying new data over window dc. Completely eliminating step 1 gives a very huge speedup and allows argb32 cairo drawing be as fast as typical dibsection-buffered gdi drawing. There is quick & dirty cairo-vs-gdi perf test made for this patch set: https://gitlab.gnome.org/galkinvv/cairo/snippets/109 See the Cairo mailing list for April 2018 for data and discussion of performance improvements. End-user visible speedup does present too - it relates to the following bug https://gitlab.gnome.org/GNOME/meld/issues/133 This Cairo speedup allows more simultaneous meld windows without eating 100% of cpu core time on spinner rendering.
Diffstat (limited to 'src')
-rw-r--r--src/win32/cairo-win32-gdi-compositor.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/win32/cairo-win32-gdi-compositor.c b/src/win32/cairo-win32-gdi-compositor.c
index 0873391eb..4a09a70a9 100644
--- a/src/win32/cairo-win32-gdi-compositor.c
+++ b/src/win32/cairo-win32-gdi-compositor.c
@@ -488,7 +488,8 @@ static cairo_bool_t check_blit (cairo_composite_rectangles_t *composite)
if (dst->fallback)
return FALSE;
- if (dst->win32.format != CAIRO_FORMAT_RGB24)
+ if (dst->win32.format != CAIRO_FORMAT_RGB24
+ && dst->win32.format != CAIRO_FORMAT_ARGB32)
return FALSE;
if (dst->win32.flags & CAIRO_WIN32_SURFACE_CAN_BITBLT)