// Provide the layers. if (o3tl::make_unsigned(nLayer) >= mpLayers->size())
{ const sal_Int32 nOldLayerCount (mpLayers->size());
mpLayers->resize(nLayer+1);
for (size_t nIndex=nOldLayerCount; nIndex<mpLayers->size(); ++nIndex)
(*mpLayers)[nIndex] = std::make_shared<Layer>();
}
(*mpLayers)[nLayer]->AddPainter(rpPainter); if (nLayer == 0)
(*mpLayers)[nLayer]->Initialize(mpTargetWindow);
// Remove top most layers that do not contain any painters. while ( ! mpLayers->empty() && ! mpLayers->back()->HasPainter())
mpLayers->pop_back();
}
void LayeredDevice::Repaint (const vcl::Region& rRepaintRegion)
{ // Validate the contents of all layers (that have their own devices.) for (autoconst& it : *mpLayers)
{
it->Validate(mpTargetWindow->GetMapMode());
}
void LayeredDevice::RepaintRectangle (const ::tools::Rectangle& rRepaintRectangle)
{ if (mpLayers->empty()) return; elseif (mpLayers->size() == 1)
{ // Just copy the main layer into the target device.
(*mpLayers)[0]->Repaint(*mpTargetWindow->GetOutDev(), rRepaintRectangle);
} else
{ // Paint all layers first into the back buffer (to avoid flickering // due to synchronous paints) and then copy that into the target // device.
mpBackBuffer->SetMapMode(mpTargetWindow->GetMapMode()); for (autoconst& it : *mpLayers)
{
it->Repaint(*mpBackBuffer, rRepaintRectangle);
}
DeviceCopy(*mpTargetWindow->GetOutDev(), *mpBackBuffer, rRepaintRectangle);
}
}
void LayeredDevice::Resize()
{ const Size aSize (mpTargetWindow->GetSizePixel());
mpBackBuffer->SetOutputSizePixel(aSize); for (autoconst& it : *mpLayers)
{
it->Resize(aSize);
}
}
void LayeredDevice::Dispose()
{ for (autoconst& it : *mpLayers)
{
it->Dispose();
}
mpLayers->clear();
}
const ::tools::Rectangle aLogicWindowBox (
mpTargetWindow->PixelToLogic(::tools::Rectangle(Point(0,0), mpTargetWindow->GetSizePixel()))); if (maSavedMapMode.GetScaleX() != rMapMode.GetScaleX()
|| maSavedMapMode.GetScaleY() != rMapMode.GetScaleY()
|| maSavedMapMode.GetMapUnit() != rMapMode.GetMapUnit())
{ // When the scale has changed then we have to paint everything.
InvalidateAllLayers(aLogicWindowBox);
} elseif (maSavedMapMode.GetOrigin() != rMapMode.GetOrigin())
{ // Window has been scrolled. Adapt contents of backbuffers and // layer devices. const Point aDelta (rMapMode.GetOrigin() - maSavedMapMode.GetOrigin());
mpBackBuffer->CopyArea(
aLogicWindowBox.TopLeft(),
mpTargetWindow->PixelToLogic(Point(0,0), maSavedMapMode),
aLogicWindowBox.GetSize());
// Invalidate the area(s) that have been exposed. const ::tools::Rectangle aWindowBox (Point(0,0), mpTargetWindow->GetSizePixel()); if (aDelta.Y() < 0)
InvalidateAllLayers(mpTargetWindow->PixelToLogic(::tools::Rectangle(
aWindowBox.Left(),
aWindowBox.Bottom()+aDelta.Y(),
aWindowBox.Right(),
aWindowBox.Bottom()))); elseif (aDelta.Y() > 0)
InvalidateAllLayers(mpTargetWindow->PixelToLogic(::tools::Rectangle(
aWindowBox.Left(),
aWindowBox.Top(),
aWindowBox.Right(),
aWindowBox.Top()+aDelta.Y()))); if (aDelta.X() < 0)
InvalidateAllLayers(mpTargetWindow->PixelToLogic(::tools::Rectangle(
aWindowBox.Right()+aDelta.X(),
aWindowBox.Top(),
aWindowBox.Right(),
aWindowBox.Bottom()))); elseif (aDelta.X() > 0)
InvalidateAllLayers(mpTargetWindow->PixelToLogic(::tools::Rectangle(
aWindowBox.Left(),
aWindowBox.Top(),
aWindowBox.Left()+aDelta.X(),
aWindowBox.Bottom())));
} else
{ // Can this happen? Lets trigger a warning when it does.
OSL_ASSERT(false);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.