summaryrefslogtreecommitdiff
path: root/vcl/skia
AgeCommit message (Collapse)Author
2020-07-02Revert "implement Skia workaround for ... (tdf#133016)" (tdf#134346)Luboš Luňák
The workaround breaks a valid use in tdf#134346, so the original problem will need to be handled differently. Change-Id: I1560ef5714a90f1d170341c1b716010a0eb5aafc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97723 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-07-02do not convert straight lines in polygons to cubic for SkPathLuboš Luňák
Change-Id: If8a088daa7971509cf12b508f956bed28a6c053b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97724 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-07-01update Skia to chrome/m85 snapshotLuboš Luňák
Change-Id: I3af3517c9c213e0db8365aecd0a008d817ca4dcf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97592 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-07-01optimize Bitmap::Erase() for Skia by delaying the erase (tdf#134363)Luboš Luňák
Tdf#134363 causes OutputDevice::DrawTransformBitmapExDirect() to create a huge 1bpp bitmap as mask, and Skia code then tries to convert all the bits to a format Skia would understand. Which is wasteful, as SkShader with the color given will do the same task much more efficiently. Change-Id: If0bba16f56fed9c3720be801b25a1e703054ed8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97488 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-07-01call InvalidateChecksum() in SkiaSalBitmap()Luboš Luňák
Change-Id: I52b6d9985639a6a81bf9c53bd35487b5c4992988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97485 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-30actually call Skia init functionLuboš Luňák
The SkGraphics::Init() docs say it's called by global variable initialization, but that doesn't seem to exist. Call it manually, as it decides e.g. which CPU features to use. Change-Id: I7e0e18290240ff2ae3298d5569c22f7dc083dde4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97415 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-30direct 8bit gray -> RGBA conversion in SkiaSalBitmapLuboš Luňák
Change-Id: Ic77f9b8f9244e7fdaca78f91686645eee421d18f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97288 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-30differentiate between 8bit and any-bit grey palette (tdf#121120)Luboš Luňák
Only the grey palette with 256 colors means that pixel values map directly to color values. Tdf#121120 has an image with 2-bit palette where color index 1 is (255,255,255), but that means the pixel value 1 cannot be just treated as color. Change-Id: Ifbd953af7f291e4fb8032ea0f4c33c0514770856 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97283 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-27do not use VCL scaling algorithm from SkiaLuboš Luňák
The only threaded one is "Super" (i.e. the default one), and Skia at a comparable quality seems to perform better. And the code is simpler too. Change-Id: I366197fe1a033c1f7a5f5c7f9fdcc00bff74dc11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97278 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-27properly copy pending scale quality in SkiaSalBitmapLuboš Luňák
EnsureBitmapData() was using Create() to make a copy of the bitmap to scale, but the quality was not copied, so it was usually at the default (and slowest) high quality. Change-Id: I7100304a935db420e2d55c2a9450016be1195965 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97277 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-27cache raster scaling also in Skia's drawAlphaBitmap()Luboš Luňák
Change-Id: I52849097267326cb362b113241179a766d286a6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97273 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-27use boost::make_shared_noinit()Luboš Luňák
The unnecessary initialization of all elements with plain boost::make_shared() actually shows up in the profiler. Change-Id: I054b13ac74362aca7f2dfa7dc746d3a80c7f1042 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97267 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-26use Skia's SkShader for blending bitmapsLuboš Luňák
It turns out it's sometimes more efficient to use SkCanvas::drawPaint() with SkShader::Blend() used to blend bitmaps together, rather than manually creating temporary SkImage for the blending. This way it saves memory and it also performs faster e.g. for tdf#134237, where when zoomed it processes only relevant parts of the images instead of blending a whole enlarged image). Sadly in raster mode it is sometimes still faster to cache the image (e.g. with tdf#134160), so keep the caching there as well, for when useful. Change-Id: I887ae330907100c21a0d152783fcd7e8ef230355 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97238 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-25log properly the compiler used to compile SkiaLuboš Luňák
Using #define's directly from VCL will report the compiler used to compile VCL, which may be different from the one used for Skia. Also truncate the log file on opening. Change-Id: Iddf613613df20505f1abe1dd5468dcc8c7041410 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97090 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-24in Skia raster mode cache even enlarging of images (tdf#134160)Luboš Luňák
Change-Id: I842b55cd922eb0e411fd7450e84224b41ba82a2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96989 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-22add debugging hints to Skia READMELuboš Luňák
Change-Id: I32d9a8bf19cbff709c088c0e0a1d4830e877e88d
2020-06-19fix coordinate typo in Skia drawTransformedBitmap() (tdf#134129)Luboš Luňák
Change-Id: I562aae9f55701477acd6b5d2cc8a556f3449ecb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96688 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-17remove outdated Skia todo commentsLuboš Luňák
Change-Id: Ib2a9e4c25421c20e52ee65b2ec8fb3a190bcb75b
2020-06-16implement Skia workaround for adjacent AA-ed polygons (tdf#133016)Luboš Luňák
Non-antialised adjacent polygons line up perfectly when drawn, and LO code assumes this is the case even when AA is enabled, which seems to work with Cairo, but not with Skia. So add a hack. Ideally LO code should not use such polygons. Change-Id: Ib46139db80f7bda78fde3aac4244da391133b7cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96369 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-15fix skewed drawing in Skia's drawTransformedBitmap() (tdf#133925)Luboš Luňák
In debug builds this led to an assert with the bugdoc, in optimized builds it seems to cause drawing problems. Change-Id: Id52309f2e3d33f8b68952d988b927cea7546d131 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96206 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-06-10blacklist old intel driver 0.16.2 for Vulkan (tdf#132681)Luboš Luňák
Change-Id: I3d2e0f6a1f43fe44a8396b53806e2f2c59c46d6c
2020-05-27properly scale stroke values in Skia drawPolyLine()Luboš Luňák
Related to the previous commit where I forgot to do this. Makes a difference e.g. for https://bugs.documentfoundation.org/show_bug.cgi?id=130478#c37 Change-Id: Id52f8db1580a78aec7c1e4764a5872f027c85a96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94874 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-26make disabling of Skia override forcing it (tdf#133399)Luboš Luňák
Makes more sense if it's disabled because the VCL backend doesn't actually support Skia. Change-Id: I3f14c6ae1172c0a2cba3bf19c4cb5288e214eb2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94861 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-26use Skia to do dashed lines, no need to do it manually (tdf#130431)Luboš Luňák
Change-Id: Id5efe7227f3c2bcb5ef6f1b990327e72014e8c47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94857 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-25high quality scale when drawing scaled Skia image (tdf#133339)Luboš Luňák
Apparently even drawBitmap() may lead to image scaling. Change-Id: I8665dfc4d12768c3824bbc45aaa72277168acc8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94781 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-22always use region band in Skia's setClipRegion (tdf#133208)Luboš Luňák
Do like other VCL backends do. Change-Id: I64b5d5a2fb131b41c70aa63eaf84022e9aa9fab5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94702 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-22Related: tdf#132536 drop FreetypeManager FreetypeFont cachingCaolán McNamara
the FreetypeFont only makes sense in the context of the FreetypeFontInstance it belongs to so remove the faux "garbage collection" and just have FreetypeFontInstance own the FreetypeFont and keep it simple. Setting a value low enough to make the garbage collection kick in just crasheed libreoffice by pulling FreetypeFont out from under living FreetypeFontInstance seeing as the Cache/Uncache was by the FreeTypeTextRenderImpl not the FreetypeFontInstance which had HarfBuff faces which continued to point to the removed FreetypeFont There is still a cache at the LogicalFontInstance level, so this aligns the libfreetype platforms with windows, mac etc. Change-Id: Iac669fae8dc1df81a5bc10d2943d84a2ff623180 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94546 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-05-21fix image caching in Skia (tdf#133215)Luboš Luňák
The image size should be part of the key. Change-Id: I615e5d99ec347941fa06655b89902f3db84aef22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94634 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-15do not cache SkBitmap in SkiaSalBitmapLuboš Luňák
It doesn't make much sense anymore to keep it around, it's now used only by GetAsSkImage(), which is only called from GetSkImage() and GetSkAlphaImage(), and it's unlikely one SkiaSalBitmap would be used both as a bitmap and an alpha mask. In Vulkan mode this should save the memory (in raster mode the memory is shared by the SkImage). Change-Id: I5818a462aca85906f2e82cd951b6241d954723c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94228 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-14Fix typoAndrea Gelmini
Change-Id: Ia8cdd792feae51a9089badb55b8622e6b58b19a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94025 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-05-14cache Skia' drawAlphaBitmap() in raster mode (tdf#104878)Luboš Luňák
Moving the mouse with the bug document triggers repeated calls to drawAlphaBitmap(), which is somewhat costly if not GPU-accelerated. Now the main cost in that bugreport is generating the frames all over again. Change-Id: Ic44811c713a745459f0af811c3d55038c944d89e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94152 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-14cache results of Skia's drawTransformedBitmap() (tdf#132438)Luboš Luňák
E.g. scrolling in Writer with a huge image inserted requires scaling down on every paint, so cache the result if it's expensive. Change-Id: I9db040eab47e0e9d7fd416ad064caf0301d346fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94118 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-13Avoid -Werror=unused-variable with --disable-assert-always-abortStephan Bergmann
...as reported by e.g. <https://ci.libreoffice.org/job/lo_tb_random_config_linux/2228/> Change-Id: If6bc1105fd723f78dbcb36616371a823ee665611 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94132 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-11avoid deep copies of pixels with Skia raster surfaces (tdf#132856)Luboš Luňák
SkCanvas::draw() leads to deep copies of the source bitmap, moreover RasterWindowContext_win allocates the pixels in a way that SkSurface_Raster has to do a deep copy because of not owning the pixels. Change-Id: I22f6a2c0f96faf99f94140eff26ec0c22fae96d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93958 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-06batch polyline drawing for basegfx::B2DLineJoin::NONE if small widthLuboš Luňák
For pixel-wide lines it should not make a difference. Change-Id: I28a9034eef9a81c6899c5fae679af5e413ee981c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93435 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-05fix line width in DrawPolyLine() with matrix (tdf#132498)Luboš Luňák
For backends that do the object-to-device coordinates transformation directly, it's necessary to also convert the size of line width. But simply multiplying it with the matrix can also rotate the line width "vector", making it e.g. negative. So don't use just the X coordinate, use vector length for the transformation, which is ok. In fact it doesn't even make sense to treat width as a vector, because a width simply is not a vector (and for this reason it's also not actually used). Change-Id: I1241c9cb29155df105170d568a879ebc32b11a5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93203 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Jenkins
2020-05-05avoid Skia CPU-based scaling if an image is wanted in the endLuboš Luňák
Change-Id: Ia08bc3824c9040e9601f4e4c3296e02b53ad5221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93433 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-04remove old Skia text render methods that do not use Skia directlyLuboš Luňák
The cairo-based method on Unix and manual glyph handling way taken from GL on Windows should be longer be needed, now that using Skia itself for text rendering seems to work fine. This reverts more or less reverts the following commits: b1d3ef798a89d11b853c467fa9ce0fe6ed235735 5ac9a62f3a354db80837bdd1c95b763989b303bb 619959827003814053a5e9ec81acfd07b3aa270a 6f5c85daa0e5073d87d1d7699bfa59af159686ca ad3580df085b3a3d66eb73cae997ea5ca178ccc1 f109a1ac6fdf0c878d53dfea6fceffd93248608f 59205c742c43b4c456b69c3fd94e7fa35ff3eec0 Change-Id: Ib28b2469c7d6471c227bb2aa08d5485bb24c2fe1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93428 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-30implement basegfx::B2DLineJoin::NONE for Skia drawPolyLine()Luboš Luňák
Change-Id: I186622aec3e944b89536bdcd44ff0be6b1d9cd8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93213 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-24debug info for Skia Windows widget drawingLuboš Luňák
Change-Id: Icbf4c9e2a0fd37eaeb900e1074eabbe7949f3de9
2020-04-24make SkiaSalBitmap discard cached data of incorrect size (tdf#132367)Luboš Luňák
Performing the delayed scaling for the bitmap data could keep around cached mImage with a different size. Which theoretically could be kept around and resized later, but the bitmap data scaling finishes the delayed scaling by discarding all the data about it (scaling quality), so the later resizing wouldn't know how. Change-Id: I6a817d87becd44214f0f4db0755731b6e4ae1409 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92846 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-24fix tick marks in Draw with Skia (tdf#132334)Luboš Luňák
Change-Id: I815fba5ae637a64fe381eb9e47632117bebfd81b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92790 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-24high quality scaling in skia drawTransformedBitmap (tdf#132297)Luboš Luňák
Change-Id: Iba7219be1b0d95fdfdc708f31e2626b006a5e615 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92641 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-23use rectangle rather than point+size for debug outputLuboš Luňák
And use SkIRect rather than tools::Rectangle because the latter messes up the size. Change-Id: Iaba609635b63bd65092a9a66f2df5426e40e9d2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92794 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-23avoid Skia xor crash with not-yet-drawn surface (tdf#132335)Luboš Luňák
No content yet, nothing to xor with. Change-Id: I68b44d6051859a61d50c5fbf8e3c63e719a87ca3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92753 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-21work around copy-to-self SkSurface::draw() being buggy (tdf#132051)Luboš Luňák
This may become the actual fix or may be removed later depending on the outcome of https://groups.google.com/d/msgid/skia-discuss/202004151937.05051.l.lunak%40collabora.com . Change-Id: I709f3e7bffbe86ddb2f6d75724bf30e4b0f0116e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92587 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-20batch Skia xor drawing (tdf#132241)Luboš Luňák
The code previously applied the xor operation after each drawing, but the bugdoc draws a large number of polygons in xor mode, so the xor drawing was done repeatedly. Do the xor drawing just once when leaving the xor mode. Change-Id: I6c8d1c2f01688dc957a0af75232ee9fb69fe5d1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92558 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-17loplugin:external (clang-cl)Stephan Bergmann
Change-Id: I409509d434f5536c6f131c1330974d442e6eba57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92404 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-16workaround for intel Skia invert() problem (tdf#130430)Luboš Luňák
Change-Id: I02c8cd7af2c35e8631932e3928d63c96dc0db255 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92368 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-15add an IsEmpty method to tools::Size and use itNoel Grandin
Change-Id: I7f5201e2ea6c74329336e16bf219630e38ff92cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92264 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>