From fd539a6d02fd7a68ad6a1d26c32644c0eb0838f2 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Mon, 18 Apr 2005 08:22:36 +0000 Subject: INTEGRATION: CWS presfixes03 (1.16.42); FILE MERGED 2005/04/14 12:08:54 thb 1.16.42.1: #i46805# The GraphicCache errorneously used a cached bitmap, prepared for a monochrome VDev with draw mode BLACKBITMAP, for normal output. Fixed by a) ruling out BLACK/WHITE_BITMAP for caching at all, and b) storing both bit depth and draw mode of target outdev in the DisplayCacheEntry --- goodies/source/graphic/grfcache.cxx | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'goodies') diff --git a/goodies/source/graphic/grfcache.cxx b/goodies/source/graphic/grfcache.cxx index 99cb739233cb..4c8da945611d 100644 --- a/goodies/source/graphic/grfcache.cxx +++ b/goodies/source/graphic/grfcache.cxx @@ -2,9 +2,9 @@ * * $RCSfile: grfcache.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: hr $ $Date: 2004-09-09 11:35:11 $ + * last change: $Author: obo $ $Date: 2005-04-18 09:22:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -445,6 +445,8 @@ private: GraphicAttr maAttr; Size maOutSizePix; ULONG mnCacheSize; + ULONG mnOutDevDrawMode; + USHORT mnOutDevBitCount; public: @@ -460,7 +462,9 @@ public: mpRefCacheEntry( pRefCacheEntry ), mpMtf( NULL ), mpBmpEx( new BitmapEx( rBmpEx ) ), maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ), - mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ) + mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ), + mnOutDevDrawMode( pOut->GetDrawMode() ), + mnOutDevBitCount( pOut->GetBitCount() ) { } @@ -471,7 +475,9 @@ public: mpRefCacheEntry( pRefCacheEntry ), mpMtf( new GDIMetaFile( rMtf ) ), mpBmpEx( NULL ), maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ), - mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ) + mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ), + mnOutDevDrawMode( pOut->GetDrawMode() ), + mnOutDevBitCount( pOut->GetBitCount() ) { } @@ -482,6 +488,8 @@ public: const Size& GetOutputSizePixel() const { return maOutSizePix; } const ULONG GetCacheSize() const { return mnCacheSize; } const GraphicCacheEntry* GetReferencedCacheEntry() const { return mpRefCacheEntry; } + const ULONG GetOutDevDrawMode() const { return mnOutDevDrawMode; } + const USHORT GetOutDevBitCount() const { return mnOutDevBitCount; } void SetReleaseTime( const ::vos::TTimeValue& rReleaseTime ) { maReleaseTime = rReleaseTime; } const ::vos::TTimeValue& GetReleaseTime() const { return maReleaseTime; } @@ -489,9 +497,17 @@ public: BOOL Matches( OutputDevice* pOut, const Point& rPtPixel, const Size& rSzPixel, const GraphicCacheEntry* pCacheEntry, const GraphicAttr& rAttr ) const { + // #i46805# Additional match + // criteria: outdev draw mode and + // bit count. One cannot reuse + // this cache object, if it's + // e.g. generated for + // DRAWMODE_GRAYBITMAP. return( ( pCacheEntry == mpRefCacheEntry ) && ( maAttr == rAttr ) && - ( ( maOutSizePix == rSzPixel ) || ( !maOutSizePix.Width() && !maOutSizePix.Height() ) ) ); + ( ( maOutSizePix == rSzPixel ) || ( !maOutSizePix.Width() && !maOutSizePix.Height() ) ) && + ( pOut->GetBitCount() == mnOutDevBitCount ) && + ( pOut->GetDrawMode() == mnOutDevDrawMode ) ); } void Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const; -- cgit