BitmapEx->Bitmap in bitmapExFromXBitmap

now that Bitmap can handle transparency

Change-Id: Id87889a0e5ca0a3398f9baceee3474369eb0f7aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188539
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-08-07 13:09:57 +02:00
parent 3a02dd3d1c
commit 09298d001e
18 changed files with 279 additions and 80 deletions
+11 -11
View File
@@ -46,11 +46,11 @@ namespace cppcanvas::internal
class BitmapAction : public CachedPrimitiveBase
{
public:
BitmapAction( const ::BitmapEx&,
BitmapAction( const ::Bitmap&,
const ::basegfx::B2DPoint& rDstPoint,
const CanvasSharedPtr&,
const OutDevState& );
BitmapAction( const ::BitmapEx&,
BitmapAction( const ::Bitmap&,
const ::basegfx::B2DPoint& rDstPoint,
const ::basegfx::B2DVector& rDstSize,
const CanvasSharedPtr&,
@@ -76,12 +76,12 @@ namespace cppcanvas::internal
};
BitmapAction::BitmapAction( const ::BitmapEx& rBmpEx,
BitmapAction::BitmapAction( const ::Bitmap& rBmpEx,
const ::basegfx::B2DPoint& rDstPoint,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
CachedPrimitiveBase( rCanvas, true ),
mxBitmap( vcl::unotools::xBitmapFromBitmapEx( rBmpEx ) ),
mxBitmap( vcl::unotools::xBitmapFromBitmap( rBmpEx ) ),
mpCanvas( rCanvas )
{
tools::initRenderState(maState,rState);
@@ -101,13 +101,13 @@ namespace cppcanvas::internal
nullptr );
}
BitmapAction::BitmapAction( const ::BitmapEx& rBmpEx,
BitmapAction::BitmapAction( const ::Bitmap& rBmp,
const ::basegfx::B2DPoint& rDstPoint,
const ::basegfx::B2DVector& rDstSize,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
CachedPrimitiveBase( rCanvas, true ),
mxBitmap( vcl::unotools::xBitmapFromBitmapEx( rBmpEx ) ),
mxBitmap( vcl::unotools::xBitmapFromBitmap( rBmp ) ),
mpCanvas( rCanvas )
{
tools::initRenderState(maState,rState);
@@ -115,7 +115,7 @@ namespace cppcanvas::internal
// Setup transformation such that the next render call is
// moved rPoint away, and scaled according to the ratio
// given by src and dst size.
const ::Size aBmpSize( rBmpEx.GetSizePixel() );
const ::Size aBmpSize( rBmp.GetSizePixel() );
const ::basegfx::B2DVector aScale( rDstSize.getX() / aBmpSize.Width(),
rDstSize.getY() / aBmpSize.Height() );
@@ -192,21 +192,21 @@ namespace cppcanvas::internal
}
}
std::shared_ptr<Action> BitmapActionFactory::createBitmapAction( const ::BitmapEx& rBmpEx,
std::shared_ptr<Action> BitmapActionFactory::createBitmapAction( const ::Bitmap& rBmp,
const ::basegfx::B2DPoint& rDstPoint,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState )
{
return std::make_shared<BitmapAction>(rBmpEx, rDstPoint, rCanvas, rState );
return std::make_shared<BitmapAction>(rBmp, rDstPoint, rCanvas, rState );
}
std::shared_ptr<Action> BitmapActionFactory::createBitmapAction( const ::BitmapEx& rBmpEx,
std::shared_ptr<Action> BitmapActionFactory::createBitmapAction( const ::Bitmap& rBmp,
const ::basegfx::B2DPoint& rDstPoint,
const ::basegfx::B2DVector& rDstSize,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState )
{
return std::make_shared<BitmapAction>(rBmpEx,
return std::make_shared<BitmapAction>(rBmp,
rDstPoint,
rDstSize,
rCanvas,
@@ -44,13 +44,13 @@ namespace cppcanvas::internal
namespace BitmapActionFactory
{
/// Unscaled bitmap action, only references destination point
std::shared_ptr<Action> createBitmapAction( const ::BitmapEx&,
std::shared_ptr<Action> createBitmapAction( const ::Bitmap&,
const ::basegfx::B2DPoint& rDstPoint,
const CanvasSharedPtr&,
const OutDevState& );
/// Scaled bitmap action, dest point and dest size
std::shared_ptr<Action> createBitmapAction( const ::BitmapEx&,
std::shared_ptr<Action> createBitmapAction( const ::Bitmap&,
const ::basegfx::B2DPoint& rDstPoint,
const ::basegfx::B2DVector& rDstSize,
const CanvasSharedPtr&,
+12 -12
View File
@@ -1683,8 +1683,8 @@ namespace cppcanvas::internal
Graphic aGraphic;
aFill.getGraphic( aGraphic );
BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
const ::Size aBmpSize( aBmpEx.GetSizePixel() );
Bitmap aBmp( aGraphic.GetBitmapEx() );
const ::Size aBmpSize( aBmp.GetSizePixel() );
::SvtGraphicFill::Transform aTransform;
aFill.getTransform( aTransform );
@@ -1723,7 +1723,7 @@ namespace cppcanvas::internal
aMatrix );
aTexture.Alpha = 1.0 - aFill.getTransparency();
aTexture.Bitmap = vcl::unotools::xBitmapFromBitmapEx( aBmpEx );
aTexture.Bitmap = vcl::unotools::xBitmapFromBitmap( aBmp );
if( aFill.isTiling() )
{
aTexture.RepeatModeX = rendering::TexturingMode::REPEAT;
@@ -2111,7 +2111,7 @@ namespace cppcanvas::internal
std::shared_ptr<Action> pBmpAction(
internal::BitmapActionFactory::createBitmapAction(
BitmapEx(pAct->GetBitmap()),
pAct->GetBitmap(),
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
rCanvas,
@@ -2134,7 +2134,7 @@ namespace cppcanvas::internal
std::shared_ptr<Action> pBmpAction(
internal::BitmapActionFactory::createBitmapAction(
BitmapEx(pAct->GetBitmap()),
pAct->GetBitmap(),
rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
rStates.getState().mapModeTransform * vcl::unotools::b2DVectorFromSize( pAct->GetSize() ),
rCanvas,
@@ -2164,7 +2164,7 @@ namespace cppcanvas::internal
std::shared_ptr<Action> pBmpAction(
internal::BitmapActionFactory::createBitmapAction(
BitmapEx(aBmp),
aBmp,
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
rStates.getState().mapModeTransform *
@@ -2189,7 +2189,7 @@ namespace cppcanvas::internal
std::shared_ptr<Action> pBmpAction(
internal::BitmapActionFactory::createBitmapAction(
pAct->GetBitmapEx(),
Bitmap(pAct->GetBitmapEx()),
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
rCanvas,
@@ -2212,7 +2212,7 @@ namespace cppcanvas::internal
std::shared_ptr<Action> pBmpAction(
internal::BitmapActionFactory::createBitmapAction(
pAct->GetBitmapEx(),
Bitmap(pAct->GetBitmapEx()),
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
rStates.getState().mapModeTransform *
@@ -2237,7 +2237,7 @@ namespace cppcanvas::internal
// crop bitmap to given source rectangle (no
// need to copy and convert the whole bitmap)
BitmapEx aBmp( pAct->GetBitmapEx() );
Bitmap aBmp( pAct->GetBitmapEx() );
const ::tools::Rectangle aCropRect( pAct->GetSrcPoint(),
pAct->GetSrcSize() );
aBmp.Crop( aCropRect );
@@ -2270,7 +2270,7 @@ namespace cppcanvas::internal
// create masked BitmapEx right here, as the
// canvas does not provide equivalent
// functionality
BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
Bitmap aBmp( createMaskBmpEx( pAct->GetBitmap(),
pAct->GetColor() ));
std::shared_ptr<Action> pBmpAction(
@@ -2299,7 +2299,7 @@ namespace cppcanvas::internal
// create masked BitmapEx right here, as the
// canvas does not provide equivalent
// functionality
BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
Bitmap aBmp( createMaskBmpEx( pAct->GetBitmap(),
pAct->GetColor() ));
std::shared_ptr<Action> pBmpAction(
@@ -2330,7 +2330,7 @@ namespace cppcanvas::internal
// create masked BitmapEx right here, as the
// canvas does not provide equivalent
// functionality
BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
Bitmap aBmp( createMaskBmpEx( pAct->GetBitmap(),
pAct->GetColor() ));
// crop bitmap to given source rectangle (no
@@ -383,9 +383,9 @@ namespace cppcanvas::internal
// update buffered bitmap and transformation
BitmapSharedPtr aBmp( VCLFactory::createBitmap(
mpCanvas,
BitmapEx(aVDev->GetBitmap(
aVDev->GetBitmap(
aBitmapPoint,
aBitmapSizePixel ) ) ));
aBitmapSizePixel ) ) );
mxBufferBitmap = aBmp->getUNOBitmap();
maLastTransformation = aTotalTransform;
maLastSubset = rSubset;
+2 -2
View File
@@ -54,7 +54,7 @@ namespace cppcanvas
}
BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& rCanvas,
const ::BitmapEx& rBmpEx )
const ::Bitmap& rBmp )
{
OSL_ENSURE( rCanvas && rCanvas->getUNOCanvas().is(),
"VCLFactory::createBitmap(): Invalid canvas" );
@@ -67,7 +67,7 @@ namespace cppcanvas
return BitmapSharedPtr();
return std::make_shared<internal::ImplBitmap>( rCanvas,
vcl::unotools::xBitmapFromBitmapEx(rBmpEx) );
vcl::unotools::xBitmapFromBitmap(rBmp) );
}
RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr& rCanvas,