summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-08-03 15:06:55 +0900
committerTomaž Vajngerl <quikee@gmail.com>2015-08-07 00:58:19 +0000
commitdea885f80a80c6a5839ee5dbf8521487186a9522 (patch)
treeb211f8bb3f57bb7da9763e2d4ca83eb08a6e9b5b /vcl/win
parent4c57e8bb69ac727713a23a066ac6ed618eff28c8 (diff)
opengl: cache native widget textures also for Windows
Change-Id: I476f0ffaef383f3227c0c12b50fcdebf393190f6 Reviewed-on: https://gerrit.libreoffice.org/17487 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/source/gdi/gdiimpl.cxx14
-rw-r--r--vcl/win/source/gdi/gdiimpl.hxx6
-rw-r--r--vcl/win/source/gdi/salnativewidgets-luna.cxx25
3 files changed, 30 insertions, 15 deletions
diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx
index aea064d077cd..fbe386cf63ad 100644
--- a/vcl/win/source/gdi/gdiimpl.cxx
+++ b/vcl/win/source/gdi/gdiimpl.cxx
@@ -17,10 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <svsys.h>
+
#include "gdiimpl.hxx"
#include <string.h>
-#include <svsys.h>
#include <rtl/strbuf.hxx>
#include <tools/debug.hxx>
#include <tools/poly.hxx>
@@ -2320,4 +2321,15 @@ bool WinSalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/,
return false;
}
+bool WinSalGraphicsImpl::TryRenderCachedNativeControl(ControlCacheKey& /*rControlCacheKey*/, int /*nX*/, int /*nY*/)
+{
+ return false;
+}
+
+bool WinSalGraphicsImpl::RenderAndCacheNativeControl(OpenGLCompatibleDC& /*rWhite*/, OpenGLCompatibleDC& /*rBlack*/,
+ int /*nX*/, int /*nY*/ , ControlCacheKey& /*aControlCacheKey*/)
+{
+ return false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/source/gdi/gdiimpl.hxx b/vcl/win/source/gdi/gdiimpl.hxx
index bdcdda181370..c22d0bfce4a0 100644
--- a/vcl/win/source/gdi/gdiimpl.hxx
+++ b/vcl/win/source/gdi/gdiimpl.hxx
@@ -18,6 +18,7 @@
*/
#include "salgdiimpl.hxx"
+#include "win/salgdi.h"
#include <vcl/gradient.hxx>
@@ -221,6 +222,11 @@ public:
virtual void beginPaint() SAL_OVERRIDE { }
virtual void endPaint() SAL_OVERRIDE { }
+
+ virtual bool TryRenderCachedNativeControl(ControlCacheKey& rControlCacheKey, int nX, int nY);
+
+ virtual bool RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack,
+ int nX, int nY , ControlCacheKey& aControlCacheKey);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index 7d545b02c4d4..ec3d79f44972 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -1170,6 +1170,16 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
bool bOk = false;
HTHEME hTheme = NULL;
+ Rectangle buttonRect = rControlRegion;
+
+ WinOpenGLSalGraphicsImpl* pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get());
+
+ ControlCacheKey aControlCacheKey(nType, nPart, nState, buttonRect.GetSize());
+ if (pImpl != NULL && pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), buttonRect.Top()))
+ {
+ return true;
+ }
+
switch( nType )
{
case CTRL_PUSHBUTTON:
@@ -1256,7 +1266,6 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
if( !hTheme )
return false;
- Rectangle buttonRect = rControlRegion;
RECT rc;
rc.left = buttonRect.Left();
rc.right = buttonRect.Right()+1;
@@ -1265,7 +1274,6 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
OUString aCaptionStr(aCaption.replace('~', '&')); // translate mnemonics
- WinOpenGLSalGraphicsImpl *pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get());
if (pImpl == NULL)
{
// set default text alignment
@@ -1290,18 +1298,7 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
if (ImplDrawNativeControl(aBlackDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr) &&
ImplDrawNativeControl(aWhiteDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr))
{
- pImpl->PreDraw();
-
- std::unique_ptr<OpenGLTexture> xBlackTexture(aBlackDC.getTexture());
- std::unique_ptr<OpenGLTexture> xWhiteTexture(aWhiteDC.getTexture());
-
- if (xBlackTexture && xWhiteTexture)
- {
- pImpl->DrawTextureDiff(*xWhiteTexture, *xBlackTexture, aBlackDC.getTwoRect());
- bOk = true;
- }
-
- pImpl->PostDraw();
+ bOk = pImpl->RenderAndCacheNativeControl(aWhiteDC, aBlackDC, buttonRect.Left(), buttonRect.Top(), aControlCacheKey);
}
}