summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-11-22 15:12:57 +0100
committerLuboš Luňák <l.lunak@collabora.com>2019-11-26 13:24:58 +0100
commit6368d06feb891ed1a7f3855dfce5ea359bcfaffb (patch)
tree1973ea0a51294788e708ea0daa02805efa05c567
parent18347c209ff661918e8a34571e24870f3b817d9c (diff)
don't fall back to raster if Skia is first asked for offscreen surface
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
-rw-r--r--vcl/skia/gdiimpl.cxx32
1 files changed, 14 insertions, 18 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index dfa7eb7a7320..b109b698914b 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -245,26 +245,22 @@ void SkiaSalGraphicsImpl::createOffscreenSurface()
{
mOffscreenGrContext = sk_app::VulkanWindowContext::getSharedGrContext();
GrContext* grContext = mOffscreenGrContext.getGrContext();
- // We may not get a GrContext if called before any onscreen window is created,
- // but that happens very early, so this should be rare and insignificant.
- // Unittests are an exception, they usually do not create any windows,
- // so in that case do create GrContext that has no window associated.
+ // We may not get a GrContext if called before any onscreen window is created.
if (!grContext)
{
- static bool isUnitTest = (getenv("LO_TESTNAME") != nullptr);
- if (isUnitTest)
- {
- // Create temporary WindowContext with no window. That will fail,
- // but it will initialize the shared GrContext.
- createWindowContext();
- // Keep a reference.
- sk_app::VulkanWindowContext::SharedGrContext context
- = sk_app::VulkanWindowContext::getSharedGrContext();
- // Destroy the temporary WindowContext.
- destroySurface();
- mOffscreenGrContext = context;
- grContext = mOffscreenGrContext.getGrContext();
- }
+ SAL_INFO("vcl.skia",
+ "creating Vulkan offscreen GPU surface before any window exists");
+ // Create temporary WindowContext with no window. That will fail,
+ // but it will initialize the shared GrContext.
+ createWindowContext();
+ // Keep a reference.
+ sk_app::VulkanWindowContext::SharedGrContext context
+ = sk_app::VulkanWindowContext::getSharedGrContext();
+ // Destroy the temporary WindowContext.
+ destroySurface();
+ // Keep a reference until the surface is destroyed.
+ mOffscreenGrContext = context;
+ grContext = mOffscreenGrContext.getGrContext();
}
if (grContext)
{