summaryrefslogtreecommitdiff
path: root/vcl/skia
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/skia')
-rw-r--r--vcl/skia/gdiimpl.cxx1
-rw-r--r--vcl/skia/salbmp.cxx1
-rw-r--r--vcl/skia/win/gdiimpl.cxx96
3 files changed, 97 insertions, 1 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index c9936d675d66..8454de7bff0f 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -495,6 +495,7 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
&paint);
paint.setBlendMode(SkBlendMode::kSrcIn);
canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
+ canvas.flush();
drawBitmap(rPosAry, tmpBitmap);
return true;
}
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index b066569e1a45..8c466bc87296 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -362,7 +362,6 @@ const SkBitmap& SkiaSalBitmap::GetAlphaSkBitmap() const
const_cast<SkBitmap&>(mAlphaBitmap)
.setPixelRef(sk_ref_sp(mBitmap.pixelRef()), mBitmap.pixelRefOrigin().x(),
mBitmap.pixelRefOrigin().y());
- return mAlphaBitmap;
}
}
return mAlphaBitmap;
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
new file mode 100644
index 000000000000..fa173226b871
--- /dev/null
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <skia/win/gdiimpl.hxx>
+
+#include <tools/sk_app/win/WindowContextFactory_win.h>
+#include <tools/sk_app/WindowContext.h>
+
+WinSkiaSalGraphicsImpl::WinSkiaSalGraphicsImpl(WinSalGraphics& rGraphics,
+ SalGeometryProvider* mpProvider)
+ : SkiaSalGraphicsImpl(rGraphics, mpProvider)
+ , mWinParent(rGraphics)
+{
+}
+
+void WinSkiaSalGraphicsImpl::Init()
+{
+#if 0 // TODO
+ if (!IsOffscreen() && mpContext.is() && mpContext->isInitialized())
+ {
+ const GLWinWindow& rGLWindow = static_cast<const GLWinWindow&>(mpContext->getOpenGLWindow());
+ if (rGLWindow.hWnd != mrWinParent.mhWnd || rGLWindow.hDC == mrWinParent.mhLocalDC)
+ {
+ // This can legitimately happen, SalFrame keeps 2x
+ // SalGraphics which share the same hWnd and hDC.
+ // The shape 'Area' dialog does reparenting to trigger this.
+ SAL_WARN("vcl.opengl", "Unusual: Windows handle / DC changed without DeInit");
+ DeInit();
+ }
+ }
+#endif
+ SkiaSalGraphicsImpl::Init();
+}
+
+void WinSkiaSalGraphicsImpl::createSurface()
+{
+ if (isOffscreen())
+ return SkiaSalGraphicsImpl::createSurface();
+ if (GetWidth() == 0 || GetHeight() == 0)
+ {
+ // When created, Init() gets called with size (0,0), which is invalid size
+ // for Skia. So fake a surface, Init() will get called later again with the correct size.
+ mSurface = SkSurface::MakeRasterN32Premul(1, 1);
+ return;
+ }
+ sk_app::DisplayParams displayParams;
+ mWindowContext.reset(
+ sk_app::window_context_factory::NewRasterForWin(mWinParent.gethWnd(), displayParams));
+ assert(SkToBool(mWindowContext)); // TODO
+ mSurface = mWindowContext->getBackbufferSurface();
+ assert(mSurface.get());
+}
+
+void WinSkiaSalGraphicsImpl::DeInit()
+{
+ mWindowContext.reset();
+ SkiaSalGraphicsImpl::DeInit();
+}
+
+void WinSkiaSalGraphicsImpl::freeResources() {}
+
+void WinSkiaSalGraphicsImpl::performFlush()
+{
+ if (mWindowContext)
+ mWindowContext->swapBuffers();
+}
+
+bool WinSkiaSalGraphicsImpl::TryRenderCachedNativeControl(ControlCacheKey const& rControlCacheKey,
+ int nX, int nY)
+{
+ (void)rControlCacheKey;
+ (void)nX;
+ (void)nY;
+ return false; // TODO
+}
+
+// TODO OpenGLCompatibleDC?
+bool WinSkiaSalGraphicsImpl::RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite,
+ OpenGLCompatibleDC& rBlack, int nX, int nY,
+ ControlCacheKey& aControlCacheKey)
+{
+ (void)rWhite;
+ (void)rBlack;
+ (void)nX;
+ (void)nY;
+ (void)aControlCacheKey;
+ return false; // TODO
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */