try to avoid scaling bitmaps twice in Skia when drawing
commita0a4709eb4226ae15931999fc17afe5b5b9f8081
authorLuboš Luňák <l.lunak@collabora.com>
Tue, 16 Nov 2021 12:34:37 +0000 (16 13:34 +0100)
committerLuboš Luňák <l.lunak@collabora.com>
Tue, 16 Nov 2021 17:37:21 +0000 (16 18:37 +0100)
tree3fcbd0cd908ff498ff68c918a880c271e48dcb58
parentf33b76b4e675818deae244427cef84c576a1a1f8
try to avoid scaling bitmaps twice in Skia when drawing

The scenario is that something scales a bitmap and then asks for it
to be drawn (possibly drawn scaled again). One example is
OutputDevice::DrawBitmap() subsampling the bitmap that according
to c0ce7ca4884f7f6d1 is supposed to improve quality with headless(?)
backend, but with Skia it's pointless and it breaks things like
caching during repeated drawing, because then GetSkImage() will need
to generate a new SkImage each time.
Since Skia backend uses delayed scaling, these cases can be sorted
out by checking the stored SkImage and using it if suitable, as
the original image is as good as the rescaled one, but often
it's better - it may be cached, sometimes the scaling operations
cancel each other out (often the case in HiDPI mode).

Change-Id: I0af32f7abdf057a3bdda75247d2dc374eaf1bc4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125311
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
vcl/inc/skia/gdiimpl.hxx
vcl/inc/skia/salbmp.hxx
vcl/inc/skia/utils.hxx
vcl/qa/cppunit/skia/skia.cxx
vcl/skia/gdiimpl.cxx
vcl/skia/salbmp.cxx