Kaydet (Commit) a3694b1b authored tarafından Caolán McNamara's avatar Caolán McNamara

move static bitmap into a svapp member

so it won't crash on exit when its dtor uses stuff destroyed by deinitvcl
already.

also fix comparisons, i.e. presumably
aLastColorTopLeft == aLastColorTopLeft etc
should have been aLastColorTopLeft == aColorTopLeft

Change-Id: I1f3dc47504c5add113b3a8bcadf010ca3b9f4c31
üst 104a7bab
......@@ -284,6 +284,26 @@ struct ImplSVNWFData
bool mbDDListBoxNoTextArea:1;
};
struct BlendFrameCache
{
Size m_aLastSize;
sal_uInt8 m_nLastAlpha;
Color m_aLastColorTopLeft;
Color m_aLastColorTopRight;
Color m_aLastColorBottomRight;
Color m_aLastColorBottomLeft;
BitmapEx m_aLastResult;
BlendFrameCache()
: m_aLastSize(0, 0)
, m_nLastAlpha(0)
, m_aLastColorTopLeft(COL_BLACK)
, m_aLastColorTopRight(COL_BLACK)
, m_aLastColorBottomRight(COL_BLACK)
, m_aLastColorBottomLeft(COL_BLACK)
{
}
};
struct ImplSVData
{
......@@ -312,6 +332,7 @@ struct ImplSVData
UnoWrapperBase* mpUnoWrapper;
Window* mpIntroWindow; // the splash screen
DockingManager* mpDockingManager;
BlendFrameCache* mpBlendFrameCache;
sal_Bool mbIsTestTool;
oslThreadIdentifier mnMainThreadId;
......@@ -330,6 +351,7 @@ Window* ImplGetDefaultWindow();
VCL_PLUGIN_PUBLIC ResMgr* ImplGetResMgr();
VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
DockingManager* ImplGetDockingManager();
BlendFrameCache* ImplGetBlendFrameCache();
void ImplWindowAutoMnemonic( Window* pWindow );
void ImplUpdateSystemProcessWindow();
......
......@@ -256,6 +256,15 @@ DockingManager* ImplGetDockingManager()
return pSVData->mpDockingManager;
}
BlendFrameCache* ImplGetBlendFrameCache()
{
ImplSVData* pSVData = ImplGetSVData();
if ( !pSVData->mpBlendFrameCache)
pSVData->mpBlendFrameCache= new BlendFrameCache();
return pSVData->mpBlendFrameCache;
}
class AccessBridgeCurrentContext: public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext >
{
public:
......
......@@ -540,6 +540,9 @@ void DeInitVCL()
if ( pSVData->maAppData.mpFirstEventHook )
ImplFreeEventHookData();
if (pSVData->mpBlendFrameCache)
delete pSVData->mpBlendFrameCache, pSVData->mpBlendFrameCache = NULL;
ImplDeletePrnQueueList();
delete pSVData->maGDIData.mpScreenFontList;
pSVData->maGDIData.mpScreenFontList = NULL;
......
......@@ -1252,31 +1252,25 @@ BitmapEx VCL_DLLPUBLIC createBlendFrame(
Color aColorBottomRight,
Color aColorBottomLeft)
{
static Size aLastSize(0, 0);
static sal_uInt8 nLastAlpha(0);
static Color aLastColorTopLeft(COL_BLACK);
static Color aLastColorTopRight(COL_BLACK);
static Color aLastColorBottomRight(COL_BLACK);
static Color aLastColorBottomLeft(COL_BLACK);
static BitmapEx aLastResult;
if(aLastSize == rSize
&& nLastAlpha == nAlpha
&& aLastColorTopLeft == aLastColorTopLeft
&& aLastColorTopRight == aLastColorTopRight
&& aLastColorBottomRight == aLastColorBottomRight
&& aLastColorBottomLeft == aLastColorBottomLeft)
BlendFrameCache* pBlendFrameCache = ImplGetBlendFrameCache();
if(pBlendFrameCache->m_aLastSize == rSize
&& pBlendFrameCache->m_nLastAlpha == nAlpha
&& pBlendFrameCache->m_aLastColorTopLeft == aColorTopLeft
&& pBlendFrameCache->m_aLastColorTopRight == aColorTopRight
&& pBlendFrameCache->m_aLastColorBottomRight == aColorBottomRight
&& pBlendFrameCache->m_aLastColorBottomLeft == aColorBottomLeft)
{
return aLastResult;
return pBlendFrameCache->m_aLastResult;
}
aLastSize = rSize;
nLastAlpha = nAlpha;
aLastColorTopLeft = aLastColorTopLeft;
aLastColorTopRight = aLastColorTopRight;
aLastColorBottomRight = aLastColorBottomRight;
aLastColorBottomLeft = aLastColorBottomLeft;
aLastResult.Clear();
pBlendFrameCache->m_aLastSize = rSize;
pBlendFrameCache->m_nLastAlpha = nAlpha;
pBlendFrameCache->m_aLastColorTopLeft = aColorTopLeft;
pBlendFrameCache->m_aLastColorTopRight = aColorTopRight;
pBlendFrameCache->m_aLastColorBottomRight = aColorBottomRight;
pBlendFrameCache->m_aLastColorBottomLeft = aColorBottomLeft;
pBlendFrameCache->m_aLastResult.Clear();
const long nW(rSize.Width());
const long nH(rSize.Height());
......@@ -1348,7 +1342,7 @@ BitmapEx VCL_DLLPUBLIC createBlendFrame(
aContent.ReleaseAccess(pContent);
aAlpha.ReleaseAccess(pAlpha);
aLastResult = BitmapEx(aContent, aAlpha);
pBlendFrameCache->m_aLastResult = BitmapEx(aContent, aAlpha);
}
else
{
......@@ -1364,7 +1358,7 @@ BitmapEx VCL_DLLPUBLIC createBlendFrame(
}
}
return aLastResult;
return pBlendFrameCache->m_aLastResult;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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