mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-07 20:40:25 +01:00
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.
This commit is contained in:
parent
0cb7aad2a3
commit
d4355ecee2
1 changed files with 2 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue