Commit graph

443953 commits

Author SHA1 Message Date
Tomaž Vajngerl
22f88068fa skia: don't loop to first point if the polygon is not closed
This fixes drawing of non-closed polylines. Without this fix the
non-closed polylines an extra step is still drawn from the last
point in the polygon to the first one (as if the polyline would be
closed).

Change-Id: I0171aede3dc03f83b7dd8ae699e6b505b3fd4f7f
2019-11-27 09:55:14 +01:00
Tomaž Vajngerl
cefafdf686 backendtest: test blending of bitmap
This forces a blending of an alpha virtualdevice with a BitmapEx
which has an alpha component. This tries a fast-path with using
blendAlphaBitmap in the backend and does blending manually and
slower if the fast-path is not available.

Change-Id: I7e45dc78ce3e61ede408aa8388802a193cbc577a
2019-11-27 09:55:14 +01:00
Tomaž Vajngerl
014c9f953e backendtest: support creating VirtualDevice with alpha
Change-Id: I74c428b9b31b89536e72d53e418fc11b3f7e4e32
2019-11-27 09:55:14 +01:00
Tomaž Vajngerl
6b38385954 vcl: allow creating a VirtualDevice with alpha sufrace
Change-Id: Ie181eeb984d8531b437c267b410eeb3c552f844f
2019-11-27 09:55:14 +01:00
Luboš Luňák
7bb41da7d0 make Skia use AA when asked for
This improves the quality of e.g. the logo in the about dialog.

Change-Id: Ie42ecc466068f979e5982d91616a8a2f80e26319
2019-11-27 09:55:14 +01:00
Luboš Luňák
de68f7e04d mark a local function static
Change-Id: I3856aa76e0280f4798893e02efd2b458cd95e65f
2019-11-27 09:55:14 +01:00
Luboš Luňák
31b2c10484 implement Skia native controls drawing/caching for Windows
This actually fixes a number of drawing problems (e.g. highlight
in popup menus), it seems the other code path is buggy.

Change-Id: Iea697f577d08d20e338224d5ff5b3bf7b653f8d1
2019-11-27 09:55:13 +01:00
Luboš Luňák
840f55c0f6 remove unwanted debug dump
Change-Id: I1cbda292155e251e2d0900f00f804f01238998ed
2019-11-27 09:55:13 +01:00
Luboš Luňák
45aa014c63 fix SkiaSalGraphicsImpl::drawPixel()
Change-Id: I2fa0853ba2593583a479747460f77f2ced67fd6a
2019-11-27 09:55:13 +01:00
Luboš Luňák
d3a864bb2d hopefully finally fix SkiaSalGraphicsImpl::drawMask()
It now passes BackendTest::testDrawMask, so it should be checked.

Change-Id: Ib3e1df03aefe6e9487737bec036a943377414735
2019-11-27 09:55:13 +01:00
Luboš Luňák
9fc9c5f735 temporarily disable failing tests in visualbackendtest
These should get fixed, but no point in having tests that already fail
without breaking anything.

Change-Id: Ibfa48fc22a4be1d76924d61a7dc223a56f64244b
2019-11-27 09:55:13 +01:00
Luboš Luňák
8eb00f1ccd use SkPath::kEvenOdd_FillType for polypolygon paths in Skia
Apparently that is the rule LO code uses, seeing e.g. the last screen
in visualbackendtest.

Change-Id: I88da7e96df9748cc6ffb3fbb6901512f59210cab
2019-11-27 09:55:13 +01:00
Luboš Luňák
c6524f3836 restore canvas state in SkiaSalGraphicsImpl::drawTransformedBitmap()
Otherwise the transformation stays set on the canvas also for further
operations.

Change-Id: Ibcb8480a74dd7da880bbc83cb186dabe06394fe9
2019-11-27 09:55:13 +01:00
Luboš Luňák
458cac4674 add a TODO note about Skia Vulkan surface getting recreated too often
Change-Id: I558c5c161224e5ba5835fb5ec994e585c90ec14c
2019-11-27 09:55:13 +01:00
Luboš Luňák
124f20c682 work around for Skia SkCanvas::clipRegion() bug
https://bugs.chromium.org/p/skia/issues/detail?id=9580

Change-Id: I37b7f5bd8c9b6a4a4d96a4c694dd3ad238b29f69
2019-11-27 09:55:13 +01:00
Luboš Luňák
e614161cad add Skia VCL README with some basic information
Change-Id: Ifff230ce76b4b33cd91322e564be1685afea763f
2019-11-27 09:55:13 +01:00
Luboš Luňák
065034637e default to Skia using Vulkan, use SAL_SKIA=raster to use raster
Change-Id: I5969b0672cdbb54e60b861bac102191dad6a4caf
2019-11-27 09:55:12 +01:00
Luboš Luňák
c9db77de2d more safe handling of destroying Skia surfaces/contexts
As the comment in SkiaSalGraphicsImpl::destroySurface() says,
they may both refer to each other's data when being destroyed,
so try to handle that.

Change-Id: I44353ed9d1888f8e8d15d93cd2c66414adfd372b
2019-11-27 09:55:12 +01:00
Luboš Luňák
5ac9a62f3a fix Skia Windows text rendering
There are two cases in WinSalGraphics::DrawTextLayout(), with and
without cached glyphs:
- Cached case DeferredTextDraw() gets data as BGRA with the glyph
drawn in white, it just needs to be modulated to the proper color
and drawn.
- Uncached case DrawTextMask() gets data as BGRA with A invalid,
it must be used as mask for the color to drawn, but without
the inverse alpha VCL idiosyncracy that DrawMask() handles.

Change-Id: I05dcec994df68d5986cd85cffa42a8f9f23c42c4
2019-11-27 09:55:12 +01:00
Luboš Luňák
aa08385d1a fix SkiaSalGraphicsImpl::drawMask()
Now that SalBitmap::convertDataBitCount() has been fixed,
the implementation here gets rather trivial.
This breaks Windows text drawing, which uses drawMask() incorrectly
(to be fixed in the next commit).

Change-Id: I98f11c1bd4b1600bb5e03e570319d29b40daa27e
2019-11-27 09:55:12 +01:00
Luboš Luňák
a09c5a0018 skip text drawing if there is nothing to draw
If the rectangle is empty, there is nothing to draw. This also avoids
problems with WinSalVirtualDevice::ImplCreateVirDevBitmap() calling
CreateDIBSection() with zero dimensions.

Change-Id: I3a56e64fc32cfb855443f4ab665d53604d724d9b
2019-11-27 09:55:12 +01:00
Luboš Luňák
9043a45c83 update Skia fix-shader-locale.patch.1 to the upstream version
Change-Id: Ie8606f30d3f821d7b195aa7978886d529a57bfd2
2019-11-27 09:55:12 +01:00
Tomaž Vajngerl
6d7b7cdd81 skia: implement drawTransformedBitmap
But needs more testing..

Change-Id: I4767a62a725dc54800c3fb42d81769eddae4b98b
2019-11-27 09:55:12 +01:00
Tomaž Vajngerl
37a88941ff backendtests: add some bitmap tests
Change-Id: If791dd113fb484ccdd81a2ee7c1f217057a918ca
2019-11-27 09:55:12 +01:00
Tomaž Vajngerl
84f25280a7 skia: drawAlphaRect and drawRect use common code
Change-Id: Ib7fc850d024b1fc7ec0ab933842bf1868b70a6d2
2019-11-27 09:55:12 +01:00
Luboš Luňák
f8426b9152 fix alpha in SkiaSalGraphicsImpl::drawAlphaBitmap()
The mistake in SalBitmap::convertDataBitCount() made this function
have 2 different results depending on whether that function was
used by GetAlphaSkBitmap() or not. Now that that is fixed, it
works to just handle alpha normally here.

Change-Id: Iae99cbefcda0a963401baf362faaad0df12a468f
2019-11-27 09:55:12 +01:00
Luboš Luňák
18ee3c5fc1 fix alpha conversion in SalBitmap::convertDataBitCount()
VCL sometimes uses inversed alpha, but this function should always
just convert the format and not the contents.

Change-Id: I85943cb8d9db6c09c57ccf8fa45e8a591db10e6d
2019-11-27 09:55:11 +01:00
Luboš Luňák
77eb89f043 fix warning from loplugin:datamembershadow
Change-Id: I1a15cf12adff559032f7737c14f56346063d0562
2019-11-27 09:55:11 +01:00
Luboš Luňák
f4ec92dd75 transform to device coords in Skia drawPolyPolygon()
Otherwise the logo in the about dialog is rendered outside
the graphics device size.

Change-Id: I610653293fccedd5d8c17f51afcdab55ada2d1d4
2019-11-27 09:55:11 +01:00
Luboš Luňák
0d9b86d48e reimplement supportsOperation() for Skia and OpenGL
The shared X11 implementation depends on XRender, which doesn't make
any sense.

Change-Id: I82f36e0835a993a8b226af211d8635336960d7ec
2019-11-27 09:55:11 +01:00
Tomaž Vajngerl
94d79e5505 skia: redirect drawBitmap with bitmap + mask to drawAlphaBitmap
Change-Id: I5dc62f9d6222447083b027d5ff3da1582ff4ef01
2019-11-27 09:55:11 +01:00
Tomaž Vajngerl
6b407e419c backendtests: enable tests only when render backend is skia
Change-Id: Idd06da27e405a3c0040bdad69c76537f12e50c92
2019-11-27 09:55:11 +01:00
Tomaž Vajngerl
eda5af2d45 backendtest: Add polyline bezier curve backend tests
Change-Id: I8cb3e97de79cbd683a266b09fb7d194c07b0089f
2019-11-27 09:55:11 +01:00
Tomaž Vajngerl
e3d0b69c7f backendtest: Add PolyLine B2D test diamond
Change-Id: I6e754e72ff698d62c493b827f9804f63d0e39e2d
2019-11-27 09:55:11 +01:00
Tomaž Vajngerl
25fad1c74a Add getting of render backend name + impl. for skia
Change-Id: Id4e32425579c2a3ebdc33e234f55a7324dbb39d4
2019-11-27 09:55:11 +01:00
Luboš Luňák
6bc2627a3d finish Skia toSkRegion()
vcldemo now starts without aborting

Change-Id: Ic9cd382d0f638f2040a0ac5fc204bce13f6768a9
2019-11-27 09:55:11 +01:00
Luboš Luňák
91b82f7de4 note about SkiaSalBitmap::ConvertToGreyscale() not being worth it
Change-Id: I3056eea5c7b241dab566a900a3ed4b9d6daee74e
2019-11-27 09:55:10 +01:00
Luboš Luňák
6199598270 implement pruning in SkiaGlobalWinGlyphCache
Currently based on identifying the SkBitmap's by their getPixels(),
but this may need changed later since it's probably going to be
more performant to use SkSurface.
Also move the cache pruning out of AllocateTexture(), as that may
possibly remove elements that would be used by DrawCachedGlyphs().

Change-Id: Ide2de752f634593b97573667af49b7aa9ec1f47f
2019-11-27 09:55:10 +01:00
Tomaž Vajngerl
c6b50a85a2 skia: implement direct PolyPolygon and PolyLine rendering
Polygon, PolyPolygon and PolyLine rendering taking point array is
diverted to the one taking basegfx::B2DPolyPolygon or B2DPolygon.

PolyPolygon and PolyLine is implemented with Skia, with bezier
rendering included. The one thing missing is taking the input
matrix into account.

Change-Id: Id675dddcef95d2279410f5987424c1de6863cbe6
2019-11-27 09:55:10 +01:00
Luboš Luňák
95b43437c5 remove some obsolete Skia TODO's
Change-Id: I11ec226a627e98552bd35753aa5a8fbcfca66186
2019-11-27 09:55:10 +01:00
Luboš Luňák
99bff8cf8f add GUI and configuration options for Skia
Pretty much a copy&paste of OpenGL. There are no settings for choosing
which backend Skia should use, as the plan is that simply the "best"
one will be selected.

Change-Id: I44fa876ab85de98de482a6ed9f814024334686ce
2019-11-27 09:55:10 +01:00
Luboš Luňák
fb6a2d3afb make Skia use either Raster or Vulkan, depending on a setting
For now default to raster, SAL_SKIA=vk switches to Vulkan.

Change-Id: Ia0f3ffdd4367eac9871aa977c930c1e6029e1d25
2019-11-27 09:55:10 +01:00
Luboš Luňák
7a5e8d5210 delete Skia WindowContext only after the SkSurface it has created
Because the context deletes memory that is accessed while the surface
is being destroyed.

Change-Id: I6f73baeb604e9ac79d6dd7eb2137791666a64712
2019-11-27 09:55:10 +01:00
Luboš Luňák
fe6d28a703 allocate Skia SkSurface on demand
Since VCL seems to often do a resize between creating
the SkiaSalGraphicsImpl and actually starting to draw, it's a waste
to create a surface that will be immediately destroyed again.

Change-Id: Ic1f67701042ccae2ad51cb9a3f8646b888f94cc4
2019-11-27 09:55:10 +01:00
Luboš Luňák
fd435574df update Skia PCH after the update to m79
Change-Id: I1e18686ac6f501a04d6f56c78c998621d430d721
2019-11-27 09:55:10 +01:00
Luboš Luňák
0634135933 resize surface in SkiaSalGraphicsImpl if needed
This is similar to what the OpenGL backend does. Apparently the VCL
code can just silently resize the graphics without telling.

Change-Id: Ie7c2a7798e76ad598e9cdd1435d68ed03793c408
2019-11-27 09:55:10 +01:00
Luboš Luňák
8f7c1fabfd fix Skia/vulkan with some locales
Change-Id: Ie2dcd526efba5631a6956023d864be828c6eb634
2019-11-27 09:55:09 +01:00
Luboš Luňák
2b861c8d7e update Skia to chrome-m79
Change-Id: Ie79f4752c4d0978b816774674bc923e6973289f8
2019-11-27 09:55:09 +01:00
Luboš Luňák
b4a0d68bf8 build skia by default
Change-Id: Ia7d9c95b2e1e78481755f40d817c6f16a5d2b4ed
2019-11-27 09:55:09 +01:00
Tomaž Vajngerl
1eb58a690c backendtests: remove unused variable - aReturnValue
Change-Id: I1a2ef490ad0ae6f431f8b4c40c27c7829c51e08d
2019-11-27 09:55:09 +01:00