summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-05-03 16:14:21 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2014-05-03 20:53:43 +1000
commitbe8a6756179beeb9dedcab5fbb105ab92808a4f8 (patch)
treec6ec76626fe94fe7859ad3fd16a8b010a8576529
parente81212315b5fe22e1005d41149a0ea1a557bf412 (diff)
Rearrange outdev.cxx functions, et al.
* Rearranged outdev.cxx functions to better match outdev.hxx layout * Moved transparency functions from outdev.cxx to transparency.cxx * Corrected one comment typo in outdev.hxx * Moved CreateUnoGraphicsList definition to outdev.cxx out of header * Formatted function declarations in outdev.hxx Change-Id: I6fda24ae8208ef5ea7b2fe8f59079d48d0af1488
-rw-r--r--include/vcl/outdev.hxx133
-rw-r--r--vcl/source/outdev/map.cxx20
-rw-r--r--vcl/source/outdev/outdev.cxx645
-rw-r--r--vcl/source/outdev/outdevstate.cxx27
-rw-r--r--vcl/source/outdev/transparent.cxx52
-rw-r--r--vcl/source/outdev/wallpaper.cxx19
6 files changed, 470 insertions, 426 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 9cc34e850c48..676cf08f557d 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -405,11 +405,7 @@ public:
css::uno::Reference< css::awt::XGraphics >
CreateUnoGraphics();
VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; }
- VCLXGraphicsList_impl* CreateUnoGraphicsList()
- {
- mpUnoGraphicsList = new VCLXGraphicsList_impl();
- return mpUnoGraphicsList;
- }
+ VCLXGraphicsList_impl* CreateUnoGraphicsList();
protected:
@@ -503,14 +499,19 @@ private:
public:
- virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
- const Point& rSrcPt, const Size& rSrcSize );
- virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
- const Point& rSrcPt, const Size& rSrcSize,
- const OutputDevice& rOutDev );
- virtual void CopyArea( const Point& rDestPt,
- const Point& rSrcPt, const Size& rSrcSize,
- sal_uInt16 nFlags = 0 );
+ virtual void DrawOutDev(
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize );
+
+ virtual void DrawOutDev(
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize,
+ const OutputDevice& rOutDev );
+
+ virtual void CopyArea(
+ const Point& rDestPt,
+ const Point& rSrcPt, const Size& rSrcSize,
+ sal_uInt16 nFlags = 0 );
protected:
@@ -589,11 +590,16 @@ public:
void SetFont( const Font& rNewFont );
const Font& GetFont() const { return maFont; }
+protected:
+
+ virtual void ImplReleaseFonts();
+
private:
SAL_DLLPRIVATE void InitLineColor();
SAL_DLLPRIVATE void InitFillColor();
+
///@}
@@ -796,14 +802,17 @@ public:
void DrawEllipse( const Rectangle& rRect );
- void DrawArc( const Rectangle& rRect,
- const Point& rStartPt, const Point& rEndPt );
+ void DrawArc(
+ const Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
- void DrawPie( const Rectangle& rRect,
- const Point& rStartPt, const Point& rEndPt );
+ void DrawPie(
+ const Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
- void DrawChord( const Rectangle& rRect,
- const Point& rStartPt, const Point& rEndPt );
+ void DrawChord(
+ const Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt );
///@}
@@ -1126,7 +1135,6 @@ public:
protected:
virtual void InitFont() const;
- virtual void ImplReleaseFonts();
virtual void SetFontOrientation( ImplFontEntry* const pFontEntry ) const;
virtual long GetFontExtLeading() const;
@@ -1417,17 +1425,19 @@ public:
@attention the output metafile is prepared in pixel mode for the currentOutputDevice
state. It can not be moved or rotated reliably anymore.
*/
- bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
- long nMaxBmpDPIX, long nMaxBmpDPIY,
- bool bReduceTransparency,
- bool bTransparencyAutoMode,
- bool bDownsampleBitmaps,
- const Color& rBackground = Color( COL_TRANSPARENT )
- );
-
- SAL_DLLPRIVATE void ImplPrintTransparent ( const Bitmap& rBmp, const Bitmap& rMask,
- const Point& rDestPt, const Size& rDestSize,
- const Point& rSrcPtPixel, const Size& rSrcSizePixel );
+ bool RemoveTransparenciesFromMetaFile(
+ const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
+ long nMaxBmpDPIX, long nMaxBmpDPIY,
+ bool bReduceTransparency,
+ bool bTransparencyAutoMode,
+ bool bDownsampleBitmaps,
+ const Color& rBackground = Color( COL_TRANSPARENT ) );
+
+ SAL_DLLPRIVATE void ImplPrintTransparent (
+ const Bitmap& rBmp, const Bitmap& rMask,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel );
+
SAL_DLLPRIVATE Color ImplDrawModeToColor ( const Color& rColor ) const;
@@ -1441,10 +1451,12 @@ public:
void DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
- void DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
- const Gradient& rTransparenceGradient );
+ void DrawTransparent(
+ const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
+ const Gradient& rTransparenceGradient );
protected:
+
virtual void EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
void DrawInvisiblePolygon( const PolyPolygon& rPolyPoly );
@@ -1473,9 +1485,10 @@ public:
protected:
- virtual void DrawDeviceMask ( const Bitmap& rMask, const Color& rMaskColor,
- const Point& rDestPt, const Size& rDestSize,
- const Point& rSrcPtPixel, const Size& rSrcSizePixel );
+ virtual void DrawDeviceMask (
+ const Bitmap& rMask, const Color& rMaskColor,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel );
///@}
@@ -1809,31 +1822,34 @@ public:
/** Query the native control to determine if it was acted upon
*/
- bool HitTestNativeControl( ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- const Point& aPos,
- bool& rIsInside ) const;
+ bool HitTestNativeControl(
+ ControlType nType,
+ ControlPart nPart,
+ const Rectangle& rControlRegion,
+ const Point& aPos,
+ bool& rIsInside ) const;
/** Request rendering of a particular control and/or part
*/
- bool DrawNativeControl( ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- const OUString& aCaption );
+ bool DrawNativeControl(
+ ControlType nType,
+ ControlPart nPart,
+ const Rectangle& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ const OUString& aCaption );
/** Query the native control's actual drawing region (including adornment)
*/
- bool GetNativeControlRegion( ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- const OUString& aCaption,
- Rectangle &rNativeBoundingRegion,
- Rectangle &rNativeContentRegion ) const;
+ bool GetNativeControlRegion(
+ ControlType nType,
+ ControlPart nPart,
+ const Rectangle& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ const OUString& aCaption,
+ Rectangle &rNativeBoundingRegion,
+ Rectangle &rNativeContentRegion ) const;
///@}
/** @name EPS functions
@@ -1842,13 +1858,14 @@ public:
public:
- /** Added return value to see if EPS could be painted directly.
+ /** @returns boolean value to see if EPS could be painted directly.
Theoreticaly, handing over a matrix would be needed to handle
painting rotated EPS files (e.g. contained in Metafiles). This
would then need to be supported for Mac and PS printers, but
that's too much for now, wrote \#i107046# for this */
- bool DrawEPS( const Point& rPt, const Size& rSz,
- const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
+ bool DrawEPS(
+ const Point& rPt, const Size& rSz,
+ const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
///@}
};
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 9cc8bcc139e6..117429dd6364 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -332,6 +332,26 @@ inline void ImplCalcMapResolution( const MapMode& rMapMode,
ImplCalcBigIntThreshold( nDPIX, nDPIY, rMapRes, rThresRes );
}
+// #i75163#
+void OutputDevice::ImplInvalidateViewTransform()
+{
+ if(mpOutDevData)
+ {
+ if(mpOutDevData->mpViewTransform)
+ {
+ delete mpOutDevData->mpViewTransform;
+ mpOutDevData->mpViewTransform = NULL;
+ }
+
+ if(mpOutDevData->mpInverseViewTransform)
+ {
+ delete mpOutDevData->mpInverseViewTransform;
+ mpOutDevData->mpInverseViewTransform = NULL;
+ }
+ }
+}
+
+
static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
long nThres )
{
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 62f31d6f1ea7..3d5241c7486c 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -77,6 +77,7 @@ namespace {
}
#endif
+// Begin initializer and accessor public functions
OutputDevice::OutputDevice() :
maRegion(true),
@@ -242,6 +243,151 @@ OutputDevice::~OutputDevice()
delete mpAlphaVDev;
}
+SalGraphics* OutputDevice::GetGraphics()
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( !mpGraphics )
+ {
+ if ( !AcquireGraphics() )
+ {
+ SAL_WARN("vcl", "No mpGraphics set");
+ }
+ }
+
+ return mpGraphics;
+}
+
+SalGraphics const *OutputDevice::GetGraphics() const
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( !mpGraphics )
+ {
+ if ( !AcquireGraphics() )
+ {
+ SAL_WARN("vcl", "No mpGraphics set");
+ }
+ }
+
+ return mpGraphics;
+}
+
+void OutputDevice::SetConnectMetaFile( GDIMetaFile* pMtf )
+{
+ mpMetaFile = pMtf;
+}
+
+void OutputDevice::SetSettings( const AllSettings& rSettings )
+{
+ *mxSettings = rSettings;
+
+ if( mpAlphaVDev )
+ mpAlphaVDev->SetSettings( rSettings );
+}
+
+SystemGraphicsData OutputDevice::GetSystemGfxData() const
+{
+ if ( !mpGraphics )
+ {
+ if ( !AcquireGraphics() )
+ return SystemGraphicsData();
+ }
+
+ return mpGraphics->GetGraphicsData();
+}
+
+css::uno::Any OutputDevice::GetSystemGfxDataAny() const
+{
+ const SystemGraphicsData aSysData = GetSystemGfxData();
+ css::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)&aSysData,
+ aSysData.nSize );
+
+ return css::uno::makeAny(aSeq);
+}
+
+void OutputDevice::SetRefPoint()
+{
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaRefPointAction( Point(), false ) );
+
+ mbRefPoint = false;
+ maRefPoint.X() = maRefPoint.Y() = 0L;
+
+ if( mpAlphaVDev )
+ mpAlphaVDev->SetRefPoint();
+}
+
+void OutputDevice::SetRefPoint( const Point& rRefPoint )
+{
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaRefPointAction( rRefPoint, true ) );
+
+ mbRefPoint = true;
+ maRefPoint = rRefPoint;
+
+ if( mpAlphaVDev )
+ mpAlphaVDev->SetRefPoint( rRefPoint );
+}
+
+sal_uInt16 OutputDevice::GetBitCount() const
+{
+ // we need a graphics instance
+ if ( !mpGraphics )
+ {
+ if ( !((OutputDevice*)this)->AcquireGraphics() )
+ return 0;
+ }
+
+ return (sal_uInt16)mpGraphics->GetBitCount();
+}
+
+sal_uLong OutputDevice::GetColorCount() const
+{
+
+ const sal_uInt16 nBitCount = GetBitCount();
+ return( ( nBitCount > 31 ) ? ULONG_MAX : ( ( (sal_uLong) 1 ) << nBitCount) );
+}
+
+css::uno::Reference< css::rendering::XCanvas > OutputDevice::GetCanvas() const
+{
+ css::uno::Sequence< css::uno::Any > aArg(6);
+
+ aArg[ 0 ] = css::uno::makeAny( reinterpret_cast<sal_Int64>(this) );
+ aArg[ 2 ] = css::uno::makeAny( css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
+ aArg[ 3 ] = css::uno::makeAny( sal_False );
+ aArg[ 5 ] = GetSystemGfxDataAny();
+
+ css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+
+ // Create canvas instance with window handle
+ static css::uno::Reference<css::lang::XMultiComponentFactory > xCanvasFactory( css::rendering::CanvasFactory::create( xContext ) );
+
+ css::uno::Reference<css::rendering::XCanvas> xCanvas;
+ xCanvas.set(
+ xCanvasFactory->createInstanceWithArgumentsAndContext(
+ "com.sun.star.rendering.Canvas", aArg, xContext ),
+ css::uno::UNO_QUERY );
+
+ return xCanvas;
+}
+
+css::uno::Reference< css::awt::XGraphics > OutputDevice::CreateUnoGraphics()
+{
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ return pWrapper ? pWrapper->CreateGraphics( this ) : css::uno::Reference< css::awt::XGraphics >();
+}
+
+VCLXGraphicsList_impl* OutputDevice::CreateUnoGraphicsList()
+{
+ mpUnoGraphicsList = new VCLXGraphicsList_impl();
+ return mpUnoGraphicsList;
+}
+
+// Helper public function
+
bool OutputDevice::SupportsOperation( OutDevSupportType eType ) const
{
if( !mpGraphics )
@@ -251,6 +397,8 @@ bool OutputDevice::SupportsOperation( OutDevSupportType eType ) const
return bHasSupport;
}
+// Helper private function
+
void OutputDevice::ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY,
short nOrientation ) const
{
@@ -302,211 +450,65 @@ void OutputDevice::ImplRotatePos( long nOriginX, long nOriginY, long& rX, long&
}
}
-void OutputDevice::EnableRTL( bool bEnable )
-{
- mbEnableRTL = bEnable;
-
- if( mpAlphaVDev )
- mpAlphaVDev->EnableRTL( bEnable );
-}
-
-bool OutputDevice::HasMirroredGraphics() const
-{
- return ( AcquireGraphics() && (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) );
-}
-
-
-bool OutputDevice::ImplIsAntiparallel() const
-{
- bool bRet = false;
- if( AcquireGraphics() )
- {
- if( ( (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && ! IsRTLEnabled() ) ||
- ( ! (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && IsRTLEnabled() ) )
- {
- bRet = true;
- }
- }
- return bRet;
-}
-
-// note: the coordiantes to be remirrored are in frame coordiantes !
-
-void OutputDevice::ReMirror( Point &rPoint ) const
-{
- rPoint.X() = mnOutOffX + mnOutWidth - 1 - rPoint.X() + mnOutOffX;
-}
-void OutputDevice::ReMirror( Rectangle &rRect ) const
-{
- long nWidth = rRect.Right() - rRect.Left();
-
- //long lc_x = rRect.nLeft - mnOutOffX; // normalize
- //lc_x = mnOutWidth - nWidth - 1 - lc_x; // mirror
- //rRect.nLeft = lc_x + mnOutOffX; // re-normalize
+// Frame public functions
- rRect.Left() = mnOutOffX + mnOutWidth - nWidth - 1 - rRect.Left() + mnOutOffX;
- rRect.Right() = rRect.Left() + nWidth;
-}
-void OutputDevice::ReMirror( Region &rRegion ) const
+void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
+ OutputDevice& rDev )
{
- RectangleVector aRectangles;
- rRegion.GetRegionRectangles(aRectangles);
- Region aMirroredRegion;
-
- for(RectangleVector::iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
- {
- ReMirror(*aRectIter);
- aMirroredRegion.Union(*aRectIter);
- }
-
- rRegion = aMirroredRegion;
+ bool bOldMap = mbMap;
+ mbMap = false;
+ rDev.DrawOutDev( rDevPt, rDevSize, rPt, rDevSize, *this );
+ mbMap = bOldMap;
}
-SalGraphics* OutputDevice::GetGraphics()
+void OutputDevice::ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
+ const OutputDevice& rOutDev, const Region& rRegion )
{
- DBG_TESTSOLARMUTEX();
-
- if ( !mpGraphics )
- {
- if ( !AcquireGraphics() )
- {
- SAL_WARN("vcl", "No mpGraphics set");
- }
- }
- return mpGraphics;
-}
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ bool bOldMap = mbMap;
+ RasterOp eOldROP = GetRasterOp();
+ mpMetaFile = NULL;
+ mbMap = false;
+ SetRasterOp( ROP_OVERPAINT );
-SalGraphics const *OutputDevice::GetGraphics() const
-{
- DBG_TESTSOLARMUTEX();
+ if ( !IsDeviceOutputNecessary() )
+ return;
if ( !mpGraphics )
{
if ( !AcquireGraphics() )
- {
- SAL_WARN("vcl", "No mpGraphics set");
- }
- }
-
- return mpGraphics;
-}
-
-void OutputDevice::ImplReleaseFonts()
-{
- mpGraphics->ReleaseFonts();
- mbNewFont = true;
- mbInitFont = true;
-
- if ( mpFontEntry )
- {
- mpFontCache->Release( mpFontEntry );
- mpFontEntry = NULL;
- }
-
- if ( mpGetDevFontList )
- {
- delete mpGetDevFontList;
- mpGetDevFontList = NULL;
- }
-
- if ( mpGetDevSizeList )
- {
- delete mpGetDevSizeList;
- mpGetDevSizeList = NULL;
- }
-}
-
-// #i75163#
-void OutputDevice::ImplInvalidateViewTransform()
-{
- if(mpOutDevData)
- {
- if(mpOutDevData->mpViewTransform)
- {
- delete mpOutDevData->mpViewTransform;
- mpOutDevData->mpViewTransform = NULL;
- }
-
- if(mpOutDevData->mpInverseViewTransform)
- {
- delete mpOutDevData->mpInverseViewTransform;
- mpOutDevData->mpInverseViewTransform = NULL;
- }
+ return;
}
-}
-
-bool OutputDevice::ImplIsRecordLayout() const
-{
- return mpOutDevData && mpOutDevData->mpRecordLayout;
-}
-
-void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rPosAry )
-{
- SalGraphics* pGraphics2;
- if ( this == pSrcDev )
- pGraphics2 = NULL;
+ // ClipRegion zuruecksetzen
+ if ( rRegion.IsNull() )
+ mpGraphics->ResetClipRegion();
else
- {
- if ( (GetOutDevType() != pSrcDev->GetOutDevType()) ||
- (GetOutDevType() != OUTDEV_WINDOW) )
- {
- if ( !pSrcDev->mpGraphics )
- {
- if ( !((OutputDevice*)pSrcDev)->AcquireGraphics() )
- return;
- }
- pGraphics2 = pSrcDev->mpGraphics;
- }
- else
- {
- if ( ((Window*)this)->mpWindowImpl->mpFrameWindow == ((Window*)pSrcDev)->mpWindowImpl->mpFrameWindow )
- pGraphics2 = NULL;
- else
- {
- if ( !pSrcDev->mpGraphics )
- {
- if ( !((OutputDevice*)pSrcDev)->AcquireGraphics() )
- return;
- }
- pGraphics2 = pSrcDev->mpGraphics;
-
- if ( !mpGraphics )
- {
- if ( !AcquireGraphics() )
- return;
- }
- DBG_ASSERT( mpGraphics && pSrcDev->mpGraphics,
- "OutputDevice::DrawOutDev(): We need more than one Graphics" );
- }
- }
- }
+ SelectClipRegion( rRegion );
- // #102532# Offset only has to be pseudo window offset
- const Rectangle aSrcOutRect( Point( pSrcDev->mnOutOffX, pSrcDev->mnOutOffY ),
- Size( pSrcDev->mnOutWidth, pSrcDev->mnOutHeight ) );
+ SalTwoRect aPosAry;
+ aPosAry.mnSrcX = rDevPt.X();
+ aPosAry.mnSrcY = rDevPt.Y();
+ aPosAry.mnSrcWidth = rDevSize.Width();
+ aPosAry.mnSrcHeight = rDevSize.Height();
+ aPosAry.mnDestX = rPt.X();
+ aPosAry.mnDestY = rPt.Y();
+ aPosAry.mnDestWidth = rDevSize.Width();
+ aPosAry.mnDestHeight = rDevSize.Height();
+ ImplDrawOutDevDirect( &rOutDev, aPosAry );
- AdjustTwoRect( rPosAry, aSrcOutRect );
+ // Ensure that ClipRegion is recalculated and set
+ mbInitClipRegion = true;
- if ( rPosAry.mnSrcWidth && rPosAry.mnSrcHeight && rPosAry.mnDestWidth && rPosAry.mnDestHeight )
- {
- // --- RTL --- if this is no window, but pSrcDev is a window
- // mirroring may be required
- // because only windows have a SalGraphicsLayout
- // mirroring is performed here
- if( (GetOutDevType() != OUTDEV_WINDOW) && pGraphics2 && (pGraphics2->GetLayout() & SAL_LAYOUT_BIDI_RTL) )
- {
- SalTwoRect aPosAry2 = rPosAry;
- pGraphics2->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcDev );
- mpGraphics->CopyBits( aPosAry2, pGraphics2, this, pSrcDev );
- }
- else
- mpGraphics->CopyBits( rPosAry, pGraphics2, this, pSrcDev );
- }
+ SetRasterOp( eOldROP );
+ mbMap = bOldMap;
+ mpMetaFile = pOldMetaFile;
}
+// Direct OutputDevice drawing public functions
+
void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPt, const Size& rSrcSize )
{
@@ -686,6 +688,8 @@ void OutputDevice::CopyArea( const Point& rDestPt,
mpAlphaVDev->CopyArea( rDestPt, rSrcPt, rSrcSize, nFlags );
}
+// Direct OutputDevice drawing protected function
+
void OutputDevice::CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 /*nFlags*/)
{
if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
@@ -696,238 +700,143 @@ void OutputDevice::CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 /*nFlags*/)
mpGraphics->CopyBits(aPosAry, NULL, this, NULL);
}
-void OutputDevice::ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
- const OutputDevice& rOutDev, const Region& rRegion )
-{
-
- GDIMetaFile* pOldMetaFile = mpMetaFile;
- bool bOldMap = mbMap;
- RasterOp eOldROP = GetRasterOp();
- mpMetaFile = NULL;
- mbMap = false;
- SetRasterOp( ROP_OVERPAINT );
-
- if ( !IsDeviceOutputNecessary() )
- return;
-
- if ( !mpGraphics )
- {
- if ( !AcquireGraphics() )
- return;
- }
-
- // ClipRegion zuruecksetzen
- if ( rRegion.IsNull() )
- mpGraphics->ResetClipRegion();
- else
- SelectClipRegion( rRegion );
-
- SalTwoRect aPosAry;
- aPosAry.mnSrcX = rDevPt.X();
- aPosAry.mnSrcY = rDevPt.Y();
- aPosAry.mnSrcWidth = rDevSize.Width();
- aPosAry.mnSrcHeight = rDevSize.Height();
- aPosAry.mnDestX = rPt.X();
- aPosAry.mnDestY = rPt.Y();
- aPosAry.mnDestWidth = rDevSize.Width();
- aPosAry.mnDestHeight = rDevSize.Height();
- ImplDrawOutDevDirect( &rOutDev, aPosAry );
-
- // Ensure that ClipRegion is recalculated and set
- mbInitClipRegion = true;
-
- SetRasterOp( eOldROP );
- mbMap = bOldMap;
- mpMetaFile = pOldMetaFile;
-}
-
-void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
- OutputDevice& rDev )
-{
-
- bool bOldMap = mbMap;
- mbMap = false;
- rDev.DrawOutDev( rDevPt, rDevSize, rPt, rDevSize, *this );
- mbMap = bOldMap;
-}
-
+// Direct OutputDevice drawing private function
-Color OutputDevice::ImplDrawModeToColor( const Color& rColor ) const
+void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rPosAry )
{
- Color aColor( rColor );
- sal_uLong nDrawMode = GetDrawMode();
+ SalGraphics* pGraphics2;
- if( nDrawMode & ( DRAWMODE_BLACKLINE | DRAWMODE_WHITELINE |
- DRAWMODE_GRAYLINE | DRAWMODE_GHOSTEDLINE |
- DRAWMODE_SETTINGSLINE ) )
+ if ( this == pSrcDev )
+ pGraphics2 = NULL;
+ else
{
- if( !ImplIsColorTransparent( aColor ) )
+ if ( (GetOutDevType() != pSrcDev->GetOutDevType()) ||
+ (GetOutDevType() != OUTDEV_WINDOW) )
{
- if( nDrawMode & DRAWMODE_BLACKLINE )
- {
- aColor = Color( COL_BLACK );
- }
- else if( nDrawMode & DRAWMODE_WHITELINE )
- {
- aColor = Color( COL_WHITE );
- }
- else if( nDrawMode & DRAWMODE_GRAYLINE )
+ if ( !pSrcDev->mpGraphics )
{
- const sal_uInt8 cLum = aColor.GetLuminance();
- aColor = Color( cLum, cLum, cLum );
+ if ( !((OutputDevice*)pSrcDev)->AcquireGraphics() )
+ return;
}
- else if( nDrawMode & DRAWMODE_SETTINGSLINE )
+ pGraphics2 = pSrcDev->mpGraphics;
+ }
+ else
+ {
+ if ( ((Window*)this)->mpWindowImpl->mpFrameWindow == ((Window*)pSrcDev)->mpWindowImpl->mpFrameWindow )
+ pGraphics2 = NULL;
+ else
{
- aColor = GetSettings().GetStyleSettings().GetFontColor();
- }
+ if ( !pSrcDev->mpGraphics )
+ {
+ if ( !((OutputDevice*)pSrcDev)->AcquireGraphics() )
+ return;
+ }
+ pGraphics2 = pSrcDev->mpGraphics;
- if( nDrawMode & DRAWMODE_GHOSTEDLINE )
- {
- aColor = Color( ( aColor.GetRed() >> 1 ) | 0x80,
- ( aColor.GetGreen() >> 1 ) | 0x80,
- ( aColor.GetBlue() >> 1 ) | 0x80);
+ if ( !mpGraphics )
+ {
+ if ( !AcquireGraphics() )
+ return;
+ }
+ DBG_ASSERT( mpGraphics && pSrcDev->mpGraphics,
+ "OutputDevice::DrawOutDev(): We need more than one Graphics" );
}
}
}
- return aColor;
-}
-
-void OutputDevice::SetRefPoint()
-{
-
- if ( mpMetaFile )
- mpMetaFile->AddAction( new MetaRefPointAction( Point(), false ) );
-
- mbRefPoint = false;
- maRefPoint.X() = maRefPoint.Y() = 0L;
-
- if( mpAlphaVDev )
- mpAlphaVDev->SetRefPoint();
-}
-
-void OutputDevice::SetRefPoint( const Point& rRefPoint )
-{
- if ( mpMetaFile )
- mpMetaFile->AddAction( new MetaRefPointAction( rRefPoint, true ) );
+ // #102532# Offset only has to be pseudo window offset
+ const Rectangle aSrcOutRect( Point( pSrcDev->mnOutOffX, pSrcDev->mnOutOffY ),
+ Size( pSrcDev->mnOutWidth, pSrcDev->mnOutHeight ) );
- mbRefPoint = true;
- maRefPoint = rRefPoint;
+ AdjustTwoRect( rPosAry, aSrcOutRect );
- if( mpAlphaVDev )
- mpAlphaVDev->SetRefPoint( rRefPoint );
+ if ( rPosAry.mnSrcWidth && rPosAry.mnSrcHeight && rPosAry.mnDestWidth && rPosAry.mnDestHeight )
+ {
+ // --- RTL --- if this is no window, but pSrcDev is a window
+ // mirroring may be required
+ // because only windows have a SalGraphicsLayout
+ // mirroring is performed here
+ if( (GetOutDevType() != OUTDEV_WINDOW) && pGraphics2 && (pGraphics2->GetLayout() & SAL_LAYOUT_BIDI_RTL) )
+ {
+ SalTwoRect aPosAry2 = rPosAry;
+ pGraphics2->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcDev );
+ mpGraphics->CopyBits( aPosAry2, pGraphics2, this, pSrcDev );
+ }
+ else
+ mpGraphics->CopyBits( rPosAry, pGraphics2, this, pSrcDev );
+ }
}
-void OutputDevice::SetConnectMetaFile( GDIMetaFile* pMtf )
-{
- mpMetaFile = pMtf;
-}
+// Layout public functions
-void OutputDevice::SetSettings( const AllSettings& rSettings )
+void OutputDevice::EnableRTL( bool bEnable )
{
- *mxSettings = rSettings;
+ mbEnableRTL = bEnable;
if( mpAlphaVDev )
- mpAlphaVDev->SetSettings( rSettings );
+ mpAlphaVDev->EnableRTL( bEnable );
}
-sal_uInt16 OutputDevice::GetBitCount() const
+bool OutputDevice::ImplIsAntiparallel() const
{
- // we need a graphics instance
- if ( !mpGraphics )
+ bool bRet = false;
+ if( AcquireGraphics() )
{
- if ( !((OutputDevice*)this)->AcquireGraphics() )
- return 0;
+ if( ( (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && ! IsRTLEnabled() ) ||
+ ( ! (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && IsRTLEnabled() ) )
+ {
+ bRet = true;
+ }
}
-
- return (sal_uInt16)mpGraphics->GetBitCount();
+ return bRet;
}
-sal_uInt16 OutputDevice::GetAlphaBitCount() const
+// note: the coordinates to be remirrored are in frame coordiantes !
+
+void OutputDevice::ReMirror( Point &rPoint ) const
{
- return 0;
+ rPoint.X() = mnOutOffX + mnOutWidth - 1 - rPoint.X() + mnOutOffX;
}
-
-sal_uLong OutputDevice::GetColorCount() const
+void OutputDevice::ReMirror( Rectangle &rRect ) const
{
+ long nWidth = rRect.Right() - rRect.Left();
- const sal_uInt16 nBitCount = GetBitCount();
- return( ( nBitCount > 31 ) ? ULONG_MAX : ( ( (sal_uLong) 1 ) << nBitCount) );
-}
+ //long lc_x = rRect.nLeft - mnOutOffX; // normalize
+ //lc_x = mnOutWidth - nWidth - 1 - lc_x; // mirror
+ //rRect.nLeft = lc_x + mnOutOffX; // re-normalize
-bool OutputDevice::HasAlpha()
-{
- return mpAlphaVDev != NULL;
+ rRect.Left() = mnOutOffX + mnOutWidth - nWidth - 1 - rRect.Left() + mnOutOffX;
+ rRect.Right() = rRect.Left() + nWidth;
}
-css::uno::Reference< css::awt::XGraphics > OutputDevice::CreateUnoGraphics()
+void OutputDevice::ReMirror( Region &rRegion ) const
{
- UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
- return pWrapper ? pWrapper->CreateGraphics( this ) : css::uno::Reference< css::awt::XGraphics >();
-}
+ RectangleVector aRectangles;
+ rRegion.GetRegionRectangles(aRectangles);
+ Region aMirroredRegion;
-SystemGraphicsData OutputDevice::GetSystemGfxData() const
-{
- if ( !mpGraphics )
+ for(RectangleVector::iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
{
- if ( !AcquireGraphics() )
- return SystemGraphicsData();
+ ReMirror(*aRectIter);
+ aMirroredRegion.Union(*aRectIter);
}
- return mpGraphics->GetGraphicsData();
-}
-
-css::uno::Any OutputDevice::GetSystemGfxDataAny() const
-{
- const SystemGraphicsData aSysData = GetSystemGfxData();
- css::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)&aSysData,
- aSysData.nSize );
+ rRegion = aMirroredRegion;
- return css::uno::makeAny(aSeq);
}
-css::uno::Reference< css::rendering::XCanvas > OutputDevice::GetCanvas() const
+bool OutputDevice::HasMirroredGraphics() const
{
- css::uno::Sequence< css::uno::Any > aArg(6);
-
- aArg[ 0 ] = css::uno::makeAny( reinterpret_cast<sal_Int64>(this) );
- aArg[ 2 ] = css::uno::makeAny( css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
- aArg[ 3 ] = css::uno::makeAny( sal_False );
- aArg[ 5 ] = GetSystemGfxDataAny();
-
- css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
-
- // Create canvas instance with window handle
- static css::uno::Reference<css::lang::XMultiComponentFactory > xCanvasFactory( css::rendering::CanvasFactory::create( xContext ) );
-
- css::uno::Reference<css::rendering::XCanvas> xCanvas;
- xCanvas.set(
- xCanvasFactory->createInstanceWithArgumentsAndContext(
- "com.sun.star.rendering.Canvas", aArg, xContext ),
- css::uno::UNO_QUERY );
-
- return xCanvas;
+ return ( AcquireGraphics() && (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) );
}
-void OutputDevice::Erase()
+bool OutputDevice::ImplIsRecordLayout() const
{
- if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
- return;
-
- if ( mbBackground )
- {
- RasterOp eRasterOp = GetRasterOp();
- if ( eRasterOp != ROP_OVERPAINT )
- SetRasterOp( ROP_OVERPAINT );
- DrawWallpaper( 0, 0, mnOutWidth, mnOutHeight, maBackground );
- if ( eRasterOp != ROP_OVERPAINT )
- SetRasterOp( eRasterOp );
- }
-
- if( mpAlphaVDev )
- mpAlphaVDev->Erase();
+ return mpOutDevData && mpOutDevData->mpRecordLayout;
}
+// EPS public function
+
bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
const GfxLink& rGfxLink, GDIMetaFile* pSubst )
{
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 15c5dd682e4b..2dcaf11f76a0 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -35,6 +35,7 @@
#include <vcl/outdevstate.hxx>
+#include "outdev.h"
#include "outdata.hxx"
#include "salgdi.hxx"
#include "sallayout.hxx"
@@ -638,4 +639,30 @@ void OutputDevice::InitFillColor()
mbInitFillColor = false;
}
+void OutputDevice::ImplReleaseFonts()
+{
+ mpGraphics->ReleaseFonts();
+ mbNewFont = true;
+ mbInitFont = true;
+
+ if ( mpFontEntry )
+ {
+ mpFontCache->Release( mpFontEntry );
+ mpFontEntry = NULL;
+ }
+
+ if ( mpGetDevFontList )
+ {
+ delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
+ }
+
+ if ( mpGetDevSizeList )
+ {
+ delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
+ }
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 21d7bb466370..2b94fb6dc5e3 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -20,10 +20,13 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <boost/scoped_array.hpp>
+
#include <vcl/outdev.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
+#include <vcl/settings.hxx>
+#include "outdata.hxx"
#include "salgdi.hxx"
namespace
@@ -64,7 +67,56 @@ namespace
return aTarget;
}
+}
+
+Color OutputDevice::ImplDrawModeToColor( const Color& rColor ) const
+{
+ Color aColor( rColor );
+ sal_uLong nDrawMode = GetDrawMode();
+ if( nDrawMode & ( DRAWMODE_BLACKLINE | DRAWMODE_WHITELINE |
+ DRAWMODE_GRAYLINE | DRAWMODE_GHOSTEDLINE |
+ DRAWMODE_SETTINGSLINE ) )
+ {
+ if( !ImplIsColorTransparent( aColor ) )
+ {
+ if( nDrawMode & DRAWMODE_BLACKLINE )
+ {
+ aColor = Color( COL_BLACK );
+ }
+ else if( nDrawMode & DRAWMODE_WHITELINE )
+ {
+ aColor = Color( COL_WHITE );
+ }
+ else if( nDrawMode & DRAWMODE_GRAYLINE )
+ {
+ const sal_uInt8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+ else if( nDrawMode & DRAWMODE_SETTINGSLINE )
+ {
+ aColor = GetSettings().GetStyleSettings().GetFontColor();
+ }
+
+ if( nDrawMode & DRAWMODE_GHOSTEDLINE )
+ {
+ aColor = Color( ( aColor.GetRed() >> 1 ) | 0x80,
+ ( aColor.GetGreen() >> 1 ) | 0x80,
+ ( aColor.GetBlue() >> 1 ) | 0x80);
+ }
+ }
+ }
+ return aColor;
+}
+
+sal_uInt16 OutputDevice::GetAlphaBitCount() const
+{
+ return 0;
+}
+
+bool OutputDevice::HasAlpha()
+{
+ return mpAlphaVDev != NULL;
}
void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index a46c3b495125..14fd74176e29 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -77,6 +77,25 @@ void OutputDevice::DrawColorWallpaper( long nX, long nY,
EnableMapMode( bMap );
}
+void OutputDevice::Erase()
+{
+ if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
+ return;
+
+ if ( mbBackground )
+ {
+ RasterOp eRasterOp = GetRasterOp();
+ if ( eRasterOp != ROP_OVERPAINT )
+ SetRasterOp( ROP_OVERPAINT );
+ DrawWallpaper( 0, 0, mnOutWidth, mnOutHeight, maBackground );
+ if ( eRasterOp != ROP_OVERPAINT )
+ SetRasterOp( eRasterOp );
+ }
+
+ if( mpAlphaVDev )
+ mpAlphaVDev->Erase();
+}
+
void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
long nWidth, long nHeight,
const Wallpaper& rWallpaper )