diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-10-12 11:01:13 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-10-12 11:39:25 +0200 |
commit | 9c48fae01c4577cfa1bd8dca5fd44367d25bbaf0 (patch) | |
tree | e004eef778a36f031161b6f77c4f8483c8ba6d18 | |
parent | c97ca26f2d5790d46b712813c15bb6731f0232b0 (diff) |
opengl: remove code duplication when rendering a texture combo
Change-Id: Ic184e0e96103bb63322c8aaf8758c4c8f423e0b9
-rw-r--r-- | vcl/inc/opengl/win/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/opengl/win/gdiimpl.cxx | 37 |
2 files changed, 20 insertions, 19 deletions
diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx index 5c91727f3800..9e8c26a44f50 100644 --- a/vcl/inc/opengl/win/gdiimpl.hxx +++ b/vcl/inc/opengl/win/gdiimpl.hxx @@ -33,6 +33,8 @@ protected: virtual rtl::Reference<OpenGLContext> CreateWinContext() SAL_OVERRIDE; virtual bool UseContext( const rtl::Reference<OpenGLContext> &pContext ) SAL_OVERRIDE; + bool RenderTextureCombo(TextureCombo& rCombo, int nX, int nY); + public: virtual void Init() SAL_OVERRIDE; virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE; diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index cc34d670209f..dba32a8676de 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -87,19 +87,25 @@ bool WinOpenGLSalGraphicsImpl::TryRenderCachedNativeControl(ControlCacheKey& rCo const std::unique_ptr<TextureCombo>& pCombo = iterator->second; + bool bRet = false; + PreDraw(); - OpenGLTexture& rTexture = *pCombo->mpTexture; + bRet = RenderTextureCombo(*pCombo, nX, nY); - SalTwoRect aPosAry(0, 0, rTexture.GetWidth(), rTexture.GetHeight(), - nX, nY, rTexture.GetWidth(), rTexture.GetHeight()); + PostDraw(); + + return bRet; +} - if (pCombo->mpMask) - DrawTextureDiff(rTexture, *pCombo->mpMask, aPosAry); - else - DrawTexture(rTexture, aPosAry); +bool WinOpenGLSalGraphicsImpl::RenderTextureCombo(TextureCombo& rCombo, int nX, int nY) +{ + OpenGLTexture& rTexture = *rCombo.mpTexture; - PostDraw(); + SalTwoRect aPosAry(0, 0, rTexture.GetWidth(), rTexture.GetHeight(), + nX, nY, rTexture.GetWidth(), rTexture.GetHeight()); + + DrawTextureDiff(rTexture, *rCombo.mpMask, aPosAry); return true; } @@ -107,24 +113,17 @@ bool WinOpenGLSalGraphicsImpl::TryRenderCachedNativeControl(ControlCacheKey& rCo bool WinOpenGLSalGraphicsImpl::RenderCompatibleDC(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack, int nX, int nY, TextureCombo& rCombo) { + bool bRet = false; + PreDraw(); rCombo.mpTexture.reset(rWhite.getTexture()); rCombo.mpMask.reset(rBlack.getTexture()); - - if (rCombo.mpTexture && rCombo.mpMask) - { - OpenGLTexture& rTexture = *rCombo.mpTexture; - - SalTwoRect aPosAry(0, 0, rTexture.GetWidth(), rTexture.GetHeight(), - nX, nY, rTexture.GetWidth(), rTexture.GetHeight()); - - DrawTextureDiff(*rCombo.mpTexture, *rCombo.mpMask, aPosAry); - } + bRet = RenderTextureCombo(rCombo, nX, nY); PostDraw(); - return true; + return bRet; } bool WinOpenGLSalGraphicsImpl::RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack, |