diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-07 23:11:35 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-07 23:16:42 +1000 |
commit | e6997a8e40325903c857eb3c83c8da530a3b7bc9 (patch) | |
tree | 3d29f8f32a4a7da1727e61e84a35cb5db0ed634c /vcl/source/gdi | |
parent | 95e220de1d217d19cd8d1ecaa458a67acd8d8f80 (diff) |
Bring static functions into OutputDevice as private functions
Also rename them to something saner. ImplIsActionSpecial in particular
is not a particularly useful function name, so updating this for
clarity.
Functions renamed:
+ ImplIsActionHandlingTransparency() -> DoesActionHandleTransparency()
+ ImplIsActionSpecial() -> IsTransparentAction()
I've also updated some of the comments to clarify.
Change-Id: I6c9d0c33d96ce40af2c877b52da66de17ed8ce78
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/print2.cxx | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index c16e702c6121..5ff22c8b3367 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -67,10 +67,9 @@ struct ConnectedComponents typedef ::std::list< ConnectedComponents > ConnectedComponentsList; /** \#i10613# Extracted from Printer::GetPreparedMetaFile. Returns true - if given action requires special handling (usually because of - transparency) + if given action requires special transparency handling */ -static bool ImplIsActionSpecial( const MetaAction& rAct ) +bool OutputDevice::IsTransparentAction( const MetaAction& rAct ) { switch( rAct.GetType() ) { @@ -94,6 +93,33 @@ static bool ImplIsActionSpecial( const MetaAction& rAct ) } } + +/** Determines whether the action can handle transparency correctly + (i.e. when painted on white background, does the action still look + correct)? + */ +bool OutputDevice::DoesActionHandleTransparency( const MetaAction& rAct ) +{ + // META_FLOATTRANSPARENT_ACTION can contain a whole metafile, + // which is to be rendered with the given transparent gradient. We + // currently cannot emulate transparent painting on a white + // background reliably. + + // the remainder can handle printing itself correctly on a uniform + // white background. + switch( rAct.GetType() ) + { + case META_TRANSPARENT_ACTION: + case META_BMPEX_ACTION: + case META_BMPEXSCALE_ACTION: + case META_BMPEXSCALEPART_ACTION: + return true; + + default: + return false; + } +} + /** Check whether rCurrRect rectangle fully covers io_rPrevRect - if yes, return true and update o_rBgColor */ @@ -622,28 +648,6 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic return Rectangle(); } -static bool ImplIsActionHandlingTransparency( const MetaAction& rAct ) -{ - // META_FLOATTRANSPARENT_ACTION can contain a whole metafile, - // which is to be rendered with the given transparent gradient. We - // currently cannot emulate transparent painting on a white - // background reliably. - - // the remainder can handle printing itself correctly on a uniform - // white background. - switch( rAct.GetType() ) - { - case META_TRANSPARENT_ACTION: - case META_BMPEX_ACTION: - case META_BMPEXSCALE_ACTION: - case META_BMPEXSCALEPART_ACTION: - return true; - - default: - return false; - } -} - bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, long nMaxBmpDPIX, long nMaxBmpDPIY, bool bReduceTransparency, bool bTransparencyAutoMode, @@ -663,7 +667,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct && !bTransparent; pCurrAct = ( (GDIMetaFile&) rInMtf ).NextAction() ) { - // #i10613# Extracted "specialness" predicate into extra method + // #i10613# determine if the action is a transparency capable // #107169# Also examine metafiles with masked bitmaps in // detail. Further down, this is optimized in such a way @@ -672,7 +676,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // of uniform opacity): if a masked bitmap is printed over // empty background, we convert to a plain bitmap with // white background. - if( ImplIsActionSpecial( *pCurrAct ) ) + if( IsTransparentAction( *pCurrAct ) ) { bTransparent = true; } @@ -994,7 +998,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // prev component(s) special -> this one, too aTotalComponents.bIsSpecial = true; } - else if( !ImplIsActionSpecial( *pCurrAct ) ) + else if( !IsTransparentAction( *pCurrAct ) ) { // added action and none of prev components special -> // this one normal, too @@ -1008,7 +1012,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // can the action handle transparency correctly // (i.e. when painted on white background, does the // action still look correct)? - if( !ImplIsActionHandlingTransparency( *pCurrAct ) ) + if( !DoesActionHandleTransparency( *pCurrAct ) ) { // no, action cannot handle its transparency on // a printer device, render to bitmap @@ -1294,7 +1298,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // are the first (or sole) action in their bounds // list. Note that we previously ensured that no // fully-transparent objects are before us here. - if( ImplIsActionHandlingTransparency( *pCurrAct ) && + if( DoesActionHandleTransparency( *pCurrAct ) && pCurrAssociatedComponent->aComponentList.begin()->first == pCurrAct ) { // convert actions, where masked-out parts are of |