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

tdf#93859 opengl - don't cache radiobuttons, refactor code dupl.

Radio buttons and check boxes can't be cached with current
framework as they have an additional rendering state provided in
additional data.

Refactor code to control which controls can be cached in one place
only.

Change-Id: I095a01cbf5dde013247d70ada89020f64c8c6510
üst 26e84b38
......@@ -279,6 +279,19 @@ public:
&& maSize.Width() == aOther.maSize.Width()
&& maSize.Height() == aOther.maSize.Height();
}
bool canCacheControl()
{
switch(mnType)
{
case CTRL_CHECKBOX:
case CTRL_RADIOBUTTON:
return false;
default:
break;
}
return true;
}
};
struct ControlCacheHashFunction
......
......@@ -119,7 +119,7 @@ bool WinOpenGLSalGraphicsImpl::RenderAndCacheNativeControl(OpenGLCompatibleDC& r
if (!bResult)
return false;
if (aControlCacheKey.mnType == CTRL_CHECKBOX)
if (!aControlCacheKey.canCacheControl())
return true;
ControlCachePair pair(aControlCacheKey, std::move(pCombo));
......
......@@ -235,7 +235,7 @@ bool X11OpenGLSalGraphicsImpl::RenderAndCacheNativeControl(X11Pixmap* pPixmap, X
if (!bResult)
return false;
if (aControlCacheKey.mnType == CTRL_CHECKBOX)
if (!aControlCacheKey.canCacheControl())
return true;
ControlCachePair pair(aControlCacheKey, std::move(pCombo));
......
......@@ -904,8 +904,11 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
Size( aCtrlRect.GetWidth()+2, aCtrlRect.GetHeight()+2) );
ControlCacheKey aControlCacheKey(nType, nPart, nState, aPixmapRect.GetSize());
if (TryRenderCachedNativeControl(aControlCacheKey, aPixmapRect.Left(), aPixmapRect.Top()))
if (aControlCacheKey.canCacheControl()
&& TryRenderCachedNativeControl(aControlCacheKey, aPixmapRect.Left(), aPixmapRect.Top()))
{
return true;
}
clipList aClip;
int nPasses = 0;
......
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