// store current output area (need to tunnel that to the // background, scroll, opaque and general sprite repaint // routines)
maScrapRect = rCurrArea;
// clear area that needs to be blitted to screen beforehand
maUpdateRect.reset();
// TODO(P1): Might be worthwhile to track areas of background // changes, too.
// TODO(P2): Might be worthwhile to use page-flipping only if // a certain percentage of screen area has changed - and // compose directly to the front buffer otherwise. if( !bUpdateAll && !io_bSurfaceDirty )
{ // background has not changed, so we're free to optimize // repaint to areas where a sprite has changed
// process each independent area of overlapping sprites // separately.
mpRedrawManager->forEachSpriteArea( *this );
// flip primary surface to screen // ==============================
// perform buffer flipping
mpRenderModule->flip( maUpdateRect,
rCurrArea );
} else
{ // limit update to parent window area (ignored for fullscreen) // TODO(E1): Use numeric_cast to catch overflow here const ::basegfx::B2IRectangle aUpdateArea( 0,0, static_cast<sal_Int32>(rCurrArea.getWidth()), static_cast<sal_Int32>(rCurrArea.getHeight()) );
// background has changed, or called requested full // update, or we're performing double buffering via page // flipping, so we currently have no choice but repaint // everything
// repaint the whole screen with background content
mpBackBuffer->draw(aUpdateArea);
// round rectangles to integer pixel. Note: have to be // extremely careful here, to avoid off-by-one errors for // the destination area: otherwise, the next scroll update // would copy pixel that are not supposed to be part of // the sprite. const ::basegfx::B2IRange& rDestRect(
::canvas::tools::spritePixelAreaFromB2DRange( rMoveEnd ) );
// not much sense in really implementing scrollUpdate here, // since outputting a sprite only partially would result in // expensive clipping. Furthermore, we cannot currently render // 3D directly to the front buffer, thus, would have to blit // the full sprite area, anyway. But at least optimized in the // sense that unnecessary background paints behind the sprites // are avoided. for( constauto& rComponent : rUpdateArea.maComponentList )
{ const ::canvas::Sprite::Reference& rSprite( rComponent.second.getSprite() );
if( rSprite.is() )
{ // downcast to derived dxcanvas::Sprite interface, which // provides the actual redraw methods.
::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw();
}
}
// repaint uncovered areas from backbuffer - take the // _rounded_ rectangles from above, to have the update // consistent with the scroll above.
std::vector< ::basegfx::B2DRange > aUncoveredAreas;
::basegfx::computeSetDifference( aUncoveredAreas,
rUpdateArea.maTotalBounds,
::basegfx::B2DRange( rDestRect ) ); for( constauto& rUncoveredArea : aUncoveredAreas )
repaintBackground( rUncoveredArea, maScrapRect, mpBackBuffer );
// TODO(E1): Use numeric_cast to catch overflow here
::basegfx::B2IRange aActualArea( 0, 0, static_cast<sal_Int32>(maScrapRect.getWidth()), static_cast<sal_Int32>(maScrapRect.getHeight()) );
aActualArea.intersect( fround( rUpdateArea.maTotalBounds ) );
// add given update area to the 'blit to foreground' rect
maUpdateRect.expand( aActualArea );
}
// TODO(P2): optimize this by truly rendering to the front // buffer. Currently, we've the 3D device only for the back // buffer. for( constauto& rSprite : rSortedUpdateSprites )
{ if( rSprite.is() )
{ // downcast to derived dxcanvas::Sprite interface, which // provides the actual redraw methods.
::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw();
}
}
// TODO(E1): Use numeric_cast to catch overflow here
::basegfx::B2IRange aActualArea( 0, 0, static_cast<sal_Int32>(maScrapRect.getWidth()), static_cast<sal_Int32>(maScrapRect.getHeight()) );
aActualArea.intersect( fround( rTotalArea ) );
// add given update area to the 'blit to foreground' rect
maUpdateRect.expand( aActualArea );
}
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.