Kaydet (Commit) 9c48fae0 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

opengl: remove code duplication when rendering a texture combo

Change-Id: Ic184e0e96103bb63322c8aaf8758c4c8f423e0b9
üst c97ca26f
......@@ -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;
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment