summaryrefslogtreecommitdiff
path: root/vcl/skia/gdiimpl.cxx
AgeCommit message (Collapse)Author
2020-04-01add Skia zone protection also to text rendering callLuboš Luňák
Change-Id: I311b4c9619b350e0b1d91189d547ef1bc300c3c2
2020-04-01handle weird semantics of SkRect::intersect() (tdf#131721)Luboš Luňák
If the two rectangles do not intersect, it only returns false and does nothing, which is stupid and confusing. Change-Id: I24de6059807c208c39db4e942ab5624dde788723 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91471 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-01fix incorrect tools::Rectangle ctor usageLuboš Luňák
Change-Id: I3633a5d6f3d15b8ec32a831cc0566cb66a208892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91470 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-01add SAL_LOG area vcl.skia.traceLuboš Luňák
So that Skia tracing debug output can be disabled selectively (e.g. SAL_LOG=+INFO.vcl.skia-INFO.vcl.skia.trace). Change-Id: Id90c77d90ce871b958429d0fe3e59c9da97b0307 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91469 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-04-01SalInvert::N50 has 1x1 pixel checker size, not 2x2 (tdf#131580)Luboš Luňák
This can be seen with widget styles that use invert() to draw focus rectangle, such as with VCL gen or win backends. Change-Id: I7fb36d1be5333e917f871f8504585e32abe82b5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91380 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-03-18check in Skia's preDraw() that SolarMutex is lockedLuboš Luňák
Just in case. Change-Id: Ie1e3f7b8436ed60c59a5e967ca9158e0aa916086 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90694 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-03-18fix glyph rotation for Skia text rendering on WindowsLuboš Luňák
The makes the chart descriptions in tdf#114209 and e.g. Japanese from the document from tdf#126169 be rotated correctly, Change-Id: I09a739fea7629000f3f49e417531bc47ba99c68f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90610 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-03-18implement text rendering using directly Skia (X11)Luboš Luňák
The Cairo-based way reuses code that is used for OpenGL, but it's needlessly complicated, given that Skia itself is capable of text rendering as well. This requires a small patch for Skia so that it uses the FcPattern* we use for selecting a font. The rendering with this commit is usable, but visually the result is noticeably different, so this will need tweaks to the font rendering (TBD). Change-Id: I058c282307106c929ccc9faa7b2bddfabf0f0a2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90580 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-03-06tdf#124848 partial refactor hairline logicArmin Le Grand
With the handover of transformations to line draw calls it is no longer feasible to detect and prepare LineWidth stuff when the old office definition for hairlnes is used, a line width of zero. It was managed in the system-independent part, but now may have to be prepared in logic and not discrete (pixel) coordinates. To do so, find and cleanup all places where 1/1.0 was used as hairline line width. Adapt all seven graphic subsystems to handle the line width == 0/0.0 cases accordingly. Test as good as possible. Change-Id: I2badc045474dcd51612e50597b8406a55d9dc863 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90057 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2020-02-19work around a driver/card(?) problem with Skia and AA-ed polygonsLuboš Luňák
See description in SkiaSalGraphicsImpl::drawPolyPolygon(). Change-Id: I4b2626e26cac6d145b417426fc2575845386db57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88941 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-02-10cid#1458168 silence bogus Dereference after null checkCaolán McNamara
and cid#1458166 Dereference after null check cid#1458167 Dereference after null check Change-Id: I68dc7dc1bc78ed64795d353d5d0ffc15cc46b0c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88347 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-02-10add (Vulkan) blacklisting to SkiaLuboš Luňák
Currently there's nothing blacklisted, but this is the code. And there's not much point in blacklisting CPU-based raster Skia, so check only for Vulkan. Since this requires accessing Vulkan to get the driver info, this commit also reorganizes a bit getting a GrContext when there's no actual window, so that it's usable for the test. Change-Id: I042af0470fb635d8ea471a40837bfcd102d7016f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88205 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-02-08Fix typoAndrea Gelmini
Change-Id: I45c764cfbc436ee62370047f1bd65f5b1de53ab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88247 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-02-07Removed executable permission on filesAndrea Gelmini
Change-Id: I33964ea73b905e9ad4cc22f662b01be07cc96eca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88250 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2020-02-07tdf#130478 Enhance Dashed line drawing on all systemsArmin Le Grand (Collabora)
For more info and explanation including state of process information and discussion(s) see task please. Adding corrections for gerrit build Change-Id: Ie10fb8093a86459dee80db5ab4355b47e46c1f8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88130 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2020-02-07add Skia crash zone checkingLuboš Luňák
Just like with OpenGL, mark zones where Skia code may call into graphics drivers in order to be able to detect cases where the driver has caused a crash or a lockup. Change-Id: I0fdbcc2260e3ab7821a595e9960145ae1fc1adfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88011 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-31fix uninitialized memory in SkiaLuboš Luňák
SkRect is actually a struct without a ctor, so it's not initialized. Change-Id: Icd8fe46230502a1f7aaf7c766a251b3d27070f66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87764 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-20workaround for Skia+Cairo text drawing exhausting GPU memoryLuboš Luňák
See the description in SkiaSalGraphicsImpl::postDraw(). Change-Id: Ia6b38741fcfe3f6b5f0a21051886c55ed5324c61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87062 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-20remove outdated Skia TODO commentsLuboš Luňák
Change-Id: Ia9925a703a4adca41e056916d285c21e5de4898f
2020-01-20fix Skia bitmap blendingLuboš Luňák
SkBlendMode::kSrc does not clear actual colors if the source is just an alpha channel. Change-Id: I3e012cac78d95bf6a7407f192c11194af5e72355 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87061 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-20tweak Skia raster line drawingLuboš Luňák
At least according to visualbackendtest it works best with 0.25 offset, although it's still not perfect, but the test at least passes this way. Change-Id: I15fdc39c91399efaae41ce7c10635028faf0486d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87060 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-16limit the area where we manually do xor drawing in SkiaLuboš Luňák
Just in case. Without this vcldemo starts rather slowly, because it does xor drawing extensively (although I expect vcldemo is a rather unrealistic use case). Change-Id: Id6b0893d93f82d63863a3bbc520804e03b31cc0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86834 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-16implement xor drawing for SkiaLuboš Luňák
Fortunately it seems this is largely unused (I can see 5 invocations when running all LO tests), so I went for the crude approach of redirecting all drawing to a temporary bitmap and then manually xor-ing all the data after each draw operation. This could be optimized if needed. Change-Id: I6fc91362dd93188775b371d5548a68a58645f85c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86776 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-15avoid needless copy by SkSurface::makeImageSnapshot(rect)Luboš Luňák
It seems to make data copy if the given rectangle is a subset of the size, so rather use the whole rectangle and specify the subset in drawImageRect(). Change-Id: I42f1da533dbf4334ec538e478131901b2d7ed7b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86775 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-09fix Skia virtual device alpha blending (tdf#129865)Luboš Luňák
The blendBitmap()/blendAlphaBitmap() stuff coming from the OpenGL code is some undocumented crazy stuff (probably because the VirtualDevice alpha handling itself is rather crazy). Hopefully I've finally figured it out to work properly for Skia too. This separate alpha handling all over the place in VCL should be just nuked. Change-Id: I82615a9be7064e9ade00ec4970a131a80a543c14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86488 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-13use SkCanvas::clipPath() as the real solutionLuboš Luňák
SkCanvas::clipRegion() is buggy and may be removed in future (https://bugs.chromium.org/p/skia/issues/detail?id=9580). Change-Id: I7070d3616e579ec8ce795f6a4bdef66b1ca1c493 Reviewed-on: https://gerrit.libreoffice.org/85102 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-13fix off-by-one with rectangle->polygon Skia clipping (tdf#129211)Luboš Luňák
This appears to be yet another case of https://lists.freedesktop.org/archives/libreoffice/2019-November/083709.html, where converting rectangles to polygons for areas has unexpected results for the right and bottom edge pixels. Change-Id: I819f3eb1a739ac8fd18d792b7031b82fe52e4b4c Reviewed-on: https://gerrit.libreoffice.org/85061 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-12update Skia to chrome/m80Luboš Luňák
Change-Id: I26782c8bd3d8ce34cbf7ce5a00b884436d37cb85 Reviewed-on: https://gerrit.libreoffice.org/84617 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-06use SkBitmap::setImmutable() where suitableLuboš Luňák
This is a little correctness check, and it may also possibly slightly improve performance. Change-Id: I6e4a013aedcafd9a7d1e0e86a5c036d511078f79 Reviewed-on: https://gerrit.libreoffice.org/84568 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-06make all Skia drawing GPU-backed, if possibleLuboš Luňák
This primarily means using SkiaHelper::createSkSurface(), which will create a GPU-backed SkSurface if Vulkan is used, and it is used in place of temporary SkBitmap instances, which are always raster-based. Change-Id: I3fe35866f962030f464d5c1d1c4bf518c20ee9af Reviewed-on: https://gerrit.libreoffice.org/84562 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-06keep just one shared reference to Skia shared GrContextLuboš Luňák
This should make it easier to keep the reference without having to keep references all over the place, especially when the shared GrContext starts to be used also for GPU-backed surfaces elsewhere. Change-Id: Icf3f6eb849ebc5eb63b1836f9caeb6f5e5e58ca6 Reviewed-on: https://gerrit.libreoffice.org/84560 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-12-06make Skia Windows text rendering use SkImage instead of SkBitmapLuboš Luňák
This will allow making it GPU-backed, as SkImage can be GPU-backed, SkBitmap cannot. Change-Id: I047eefe83741a036d372d39e5fc6a4fa400e6504 Reviewed-on: https://gerrit.libreoffice.org/84559 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-11-27Fix typoAndrea Gelmini
Change-Id: I738ff9206c46559cf634ed072652e7cdc73bf806 Reviewed-on: https://gerrit.libreoffice.org/83911 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-27Fix typoAndrea Gelmini
Change-Id: I865ea94f905583221458e093858a34d0ed9d0d17 Reviewed-on: https://gerrit.libreoffice.org/83909 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-27fix SkiaSalGraphicsImpl::drawPolyLine()Luboš Luňák
Code pretty much copy&pasted from the vcl/quartz version. Fixes e.g. Writer marks showing paper corners. Change-Id: I3c9d2ed00efe409abd0a730a6f7dc0ea2a31c90a
2019-11-27don't fall back to raster if Skia is first asked for offscreen surfaceLuboš Luňák
This is rare, but it may happen. Since now the code shared just one GrContext properly, this is not really a problem anymore (and the extra WindowContext creation shouldn't be hopefully noticeable either). Change-Id: I50887b7512e778b70870690a3f672b27cc7f2d21
2019-11-27avoid some compiler warnings in Skia VCL codeLuboš Luňák
Mostly warnings from the 'casttovoid' Clang plugin, which is rather annoying here. Change-Id: I3d69697143f690211cdd26d1b9a4c0efe9397197
2019-11-27make sure Skia invert with TrackFrame doesn't paint outsideLuboš Luňák
According to Tomaž that's a requirement and that is what the test for it tests. This is easy to implement with additional clipping. Change-Id: Ia54489e20ce58ae0624183f2989036e6938cd44f
2019-11-27make Skia GPU offscreen surfaces work with unittestsLuboš Luňák
Skia is now patched to be able to create also invalid sk_app::WindowContext that will just initialize the shared GrContext. And always use that GrContext, even for tests, because some tests first create a offscreen surfaces and only later create windows, which before this patch led to mixing GrContext instances. Change-Id: Ic79c0719f98f6ac48527c2ea2a9a9a69412adeff
2019-11-27remove no-longer-needed Skia workaround for GPU offscreen drawingLuboš Luňák
Change-Id: I044a9a31af71c4c624f08a0813bc59472f4c728a
2019-11-27make Skia VCL backend fall back to raster if vulkan doesn't workLuboš Luňák
Change-Id: Ic446f6f85e5ebc2e50cb51a3ed1e732b8976a193
2019-11-27fix Skia offscreen GPU-backed drawingLuboš Luňák
The previous approach of using multiple GrContext instances apparently does not work, it's not possible to do drawing operations that involve objects using two different GrContext's. So patch Skia to use just one GrContext for our needs. See vcl/skia/README for details. Change-Id: I2bd3d3c618bf7f8ff45b2f37cbd086d2289940aa
2019-11-27avoid repeated SkSurface recreating because of X11 being asynchronousLuboš Luňák
Sometimes VCL and X11 (and thus Skia) will have a different idea about what the size of a window is. Check for the mismatch and avoid recreating if it wouldn't do anything. Change-Id: Icf3ebba9589cc6f12612e5f280840346cb0edaeb
2019-11-27make Skia copyArea() and copyBits() actually copy, not drawLuboš Luňák
Change-Id: Ifcf8d4d7814daf3631b159cc979f3b8a80052196
2019-11-27use center of pixels when doing GPU drawing using SkiaLuboš Luňák
According to https://bugs.chromium.org/p/skia/issues/detail?id=9611 rounding errors may cause off-by-one errors, so compensate when converting int->SkScalar in relevant cases. Change-Id: I72a579064206c216c9f99adc7d7c2c57bbe567d6
2019-11-27make SkiaSalGraphicsImpl use GPU-backed SkSurface also for offscreenLuboš Luňák
Skia's sk_app::WindowContext can create GPU-backed SkSurface only for windows, but we also use virtual devices that are not windows. Fortunately, SkSurface can be created GPU-backed from GrContext* and sk_gpu_test::GrContextFactory seems to provide it easily. It is not completely clear to me what the rules are on mixing SkSurface's with different GrContext* (see the comment in SkiaSalGraphicsImpl::copyBits()), but it seems to work fine. Change-Id: I8110b67c41ab092e0c4b6a0973d6bed8a408c4c1
2019-11-27add SAL log group vcl.skia for tracing Skia usageLuboš Luňák
Change-Id: Ife21bbe0b86c3edd20e657da09c6e218fa4fced3
2019-11-27handle properly Skia color endianessLuboš Luňák
Change-Id: I59af62fa92903823eb7105d82157017e485ba0df
2019-11-27pre-fill Skia bitmaps/surfaces with garbage in dbgutil modeLuboš Luňák
In order to be able to detect incorrect/missing drawing. Change-Id: I18b3f05c1fdff69b461f22e984e0aef3c4ce3364
2019-11-27implement SalROPColor in SkiaLuboš Luňák
Pretty much copy&pasted from other VCL plugins ... whatever is actually is. Change-Id: Ibdd5d6d2106f303127afbbde45d400d02a5de93b