summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2020-05-12 06:55:02 +1000
committerTomaž Vajngerl <quikee@gmail.com>2020-05-15 15:43:54 +0200
commit6fa6704a7e7c6970b7a7c695a4a548f8dc693d03 (patch)
tree7ae44b9c522002d5815a13b0656b463ac8f3ef94
parente55cf3bb2b445201280cdc6742926787294e2363 (diff)
vcl: move functionality out of checkRect(), rendering function obsolete
Change-Id: Iabbc82d9b31438169351eca370ae42729babd10a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94022 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--vcl/source/gdi/print2.cxx97
1 files changed, 45 insertions, 52 deletions
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 481cafcf814e..e5ace36db0ac 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -100,25 +100,6 @@ bool doesRectCoverWithUniformColor(
rMapModeVDev.IsFillColor());
}
-/** Check whether rCurrRect rectangle fully covers io_rPrevRect - if
- yes, return true and update o_rBgColor
- */
-bool checkRect( tools::Rectangle& io_rPrevRect,
- Color& o_rBgColor,
- const tools::Rectangle& rCurrRect,
- OutputDevice const & rMapModeVDev )
-{
- bool bRet = doesRectCoverWithUniformColor(io_rPrevRect, rCurrRect, rMapModeVDev);
-
- if( bRet )
- {
- io_rPrevRect = rCurrRect;
- o_rBgColor = rMapModeVDev.GetFillColor();
- }
-
- return bRet;
-}
-
/** #107169# Convert BitmapEx to Bitmap with appropriately blended
color. Convert MetaTransparentAction to plain polygon,
appropriately colored
@@ -713,72 +694,84 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
{
case MetaActionType::RECT:
{
- if( !checkRect(
- aBackgroundComponent.aBounds,
- aBackgroundComponent.aBgColor,
- static_cast<const MetaRectAction*>(pCurrAct)->GetRect(),
- *aMapModeVDev) )
+ const tools::Rectangle aRect(
+ static_cast<const MetaRectAction*>(pCurrAct)->GetRect());
+
+ if (!doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+ {
+ aBackgroundComponent.aBounds = aRect;
+ aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
bStillBackground=false; // incomplete occlusion of background
+ }
else
+ {
nLastBgAction=nActionNum; // this _is_ background
+ }
break;
}
case MetaActionType::POLYGON:
{
const tools::Polygon aPoly(
static_cast<const MetaPolygonAction*>(pCurrAct)->GetPolygon());
- if( !basegfx::utils::isRectangle(
- aPoly.getB2DPolygon()) ||
- !checkRect(
- aBackgroundComponent.aBounds,
- aBackgroundComponent.aBgColor,
- aPoly.GetBoundRect(),
- *aMapModeVDev) )
+ const tools::Rectangle aRect(aPoly.GetBoundRect());
+
+ if (!basegfx::utils::isRectangle(aPoly.getB2DPolygon()) ||
+ !doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+ {
+ aBackgroundComponent.aBounds = aRect;
+ aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
bStillBackground=false; // incomplete occlusion of background
+ }
else
+ {
nLastBgAction=nActionNum; // this _is_ background
+ }
break;
}
case MetaActionType::POLYPOLYGON:
{
const tools::PolyPolygon aPoly(
static_cast<const MetaPolyPolygonAction*>(pCurrAct)->GetPolyPolygon());
- if( aPoly.Count() != 1 ||
- !basegfx::utils::isRectangle(
- aPoly[0].getB2DPolygon()) ||
- !checkRect(
- aBackgroundComponent.aBounds,
- aBackgroundComponent.aBgColor,
- aPoly.GetBoundRect(),
- *aMapModeVDev) )
+ const tools::Rectangle aRect(aPoly.GetBoundRect());
+
+ if (aPoly.Count() != 1 ||
+ !basegfx::utils::isRectangle(aPoly[0].getB2DPolygon()) ||
+ !doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+ {
+ aBackgroundComponent.aBounds = aRect;
+ aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
bStillBackground=false; // incomplete occlusion of background
+ }
else
+ {
nLastBgAction=nActionNum; // this _is_ background
+ }
break;
}
case MetaActionType::WALLPAPER:
{
- if( !checkRect(
- aBackgroundComponent.aBounds,
- aBackgroundComponent.aBgColor,
- static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect(),
- *aMapModeVDev) )
+ const tools::Rectangle aRect(
+ static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect());
+
+ if (!doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+ {
+ aBackgroundComponent.aBounds = aRect;
+ aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
bStillBackground=false; // incomplete occlusion of background
+ }
else
+ {
nLastBgAction=nActionNum; // this _is_ background
+ }
break;
}
default:
{
- if( ImplIsNotTransparent( *pCurrAct,
- *aMapModeVDev ) )
- bStillBackground=false; // non-transparent action, possibly
- // not uniform
+ if (ImplIsNotTransparent( *pCurrAct, *aMapModeVDev))
+ bStillBackground=false; // non-transparent action, possibly not uniform
else
- // extend current bounds (next uniform action
- // needs to fully cover this area)
- aBackgroundComponent.aBounds.Union(
- ImplCalcActionBounds(*pCurrAct, *aMapModeVDev) );
+ // extend current bounds (next uniform action needs to fully cover this area)
+ aBackgroundComponent.aBounds.Union(ImplCalcActionBounds(*pCurrAct, *aMapModeVDev));
break;
}
}