diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-11-15 19:12:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-11-16 07:57:00 +0100 |
commit | 8011b16e05c97a92efee2debb23f5eae60f1236b (patch) | |
tree | 21e65803fa6f15e33e8bbbbbf701819fd0ad6171 /drawinglayer | |
parent | 5b0a6621858b141022743dd8d500558895dedb1f (diff) |
Use BitmapEx in BitmapPrimitive2D
we no longer need to wrap it in the framework XBitmap
implemenation
Change-Id: I0dc56ad63364e2c5a4cedd5e70d4ae7ea7eae563
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142746
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
17 files changed, 37 insertions, 49 deletions
diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx index 519ad153696b..7dc58c3fe00a 100644 --- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx @@ -26,9 +26,8 @@ using namespace com::sun::star; namespace drawinglayer::primitive2d { -BitmapPrimitive2D::BitmapPrimitive2D(css::uno::Reference<css::awt::XBitmap> xXBitmap, - basegfx::B2DHomMatrix aTransform) - : maXBitmap(std::move(xXBitmap)) +BitmapPrimitive2D::BitmapPrimitive2D(BitmapEx xXBitmap, basegfx::B2DHomMatrix aTransform) + : maBitmap(std::move(xXBitmap)) , maTransform(std::move(aTransform)) { } @@ -39,7 +38,7 @@ bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { const BitmapPrimitive2D& rCompare = static_cast<const BitmapPrimitive2D&>(rPrimitive); - return (getXBitmap() == rCompare.getXBitmap() && getTransform() == rCompare.getTransform()); + return (getBitmap() == rCompare.getBitmap() && getTransform() == rCompare.getTransform()); } return false; @@ -55,19 +54,11 @@ BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInforma sal_Int64 BitmapPrimitive2D::estimateUsage() { - if (!getXBitmap().is()) + if (getBitmap().IsEmpty()) { return 0; } - - uno::Reference<util::XAccounting> const xAcc(getXBitmap(), uno::UNO_QUERY); - - if (!xAcc.is()) - { - return 0; - } - - return xAcc->estimateUsage(); + return getBitmap().GetSizeBytes(); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 14d4f7b69446..c776319e86f5 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -198,7 +198,7 @@ namespace drawinglayer::primitive2d // create primitive xRetval = new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(aContent), + aContent, aBitmapTransform); } catch( const uno::Exception& ) diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx index 8a86f83204bd..7ec7040ff2a1 100644 --- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx @@ -66,7 +66,7 @@ namespace drawinglayer::primitive2d // create BitmapPrimitive2D with now object-local coordinate data rContainer.push_back( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getBitmapEx()), + getBitmapEx(), aObjectTransform)); } diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx index 290d9d2d7ffd..4a64da368a2f 100644 --- a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx @@ -171,7 +171,7 @@ namespace drawinglayer::primitive2d // TopLeft xRetval[0] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTopLeft()), + getDiscreteShadow().getTopLeft(), basegfx::utils::createScaleTranslateB2DHomMatrix( fBigLenX, fBigLenY, @@ -181,7 +181,7 @@ namespace drawinglayer::primitive2d // Top xRetval[1] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTop()), + getDiscreteShadow().getTop(), basegfx::utils::createScaleTranslateB2DHomMatrix( 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX, fBorderY, @@ -191,7 +191,7 @@ namespace drawinglayer::primitive2d // TopRight xRetval[2] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTopRight()), + getDiscreteShadow().getTopRight(), basegfx::utils::createScaleTranslateB2DHomMatrix( fBigLenX, fBigLenY, @@ -201,7 +201,7 @@ namespace drawinglayer::primitive2d // Right xRetval[3] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getRight()), + getDiscreteShadow().getRight(), basegfx::utils::createScaleTranslateB2DHomMatrix( fBorderX, 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY, @@ -211,7 +211,7 @@ namespace drawinglayer::primitive2d // BottomRight xRetval[4] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottomRight()), + getDiscreteShadow().getBottomRight(), basegfx::utils::createScaleTranslateB2DHomMatrix( fBigLenX, fBigLenY, @@ -221,7 +221,7 @@ namespace drawinglayer::primitive2d // Bottom xRetval[5] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottom()), + getDiscreteShadow().getBottom(), basegfx::utils::createScaleTranslateB2DHomMatrix( 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX, fBorderY, @@ -231,7 +231,7 @@ namespace drawinglayer::primitive2d // BottomLeft xRetval[6] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottomLeft()), + getDiscreteShadow().getBottomLeft(), basegfx::utils::createScaleTranslateB2DHomMatrix( fBigLenX, fBigLenY, @@ -241,7 +241,7 @@ namespace drawinglayer::primitive2d // Left xRetval[7] = Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getLeft()), + getDiscreteShadow().getLeft(), basegfx::utils::createScaleTranslateB2DHomMatrix( fBorderX, 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY, diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx b/drawinglayer/source/primitive2d/glowprimitive2d.cxx index 956a6f94eb82..47103ac9a011 100644 --- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx @@ -225,11 +225,10 @@ void GlowPrimitive2D::create2DDecomposition( // Independent from discrete sizes of glow alpha creation, always // map and project glow result to geometry range extended by glow // radius, but to the eventually clipped instance (ClippedRange) - const primitive2d::Primitive2DReference xEmbedRefBitmap( - new BitmapPrimitive2D(VCLUnoHelper::CreateVCLXBitmap(result), - basegfx::utils::createScaleTranslateB2DHomMatrix( - aClippedRange.getWidth(), aClippedRange.getHeight(), - aClippedRange.getMinX(), aClippedRange.getMinY()))); + const primitive2d::Primitive2DReference xEmbedRefBitmap(new BitmapPrimitive2D( + result, basegfx::utils::createScaleTranslateB2DHomMatrix( + aClippedRange.getWidth(), aClippedRange.getHeight(), + aClippedRange.getMinX(), aClippedRange.getMinY()))); rContainer = primitive2d::Primitive2DContainer{ xEmbedRefBitmap }; } diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 223390c81e3e..344e7328a84f 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -187,7 +187,7 @@ namespace drawinglayer::primitive2d return Primitive2DReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(bitmap), + bitmap, getTransform())); } @@ -526,7 +526,7 @@ namespace drawinglayer::primitive2d { aRetval.resize(1); aRetval[0] = new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(rGraphic.GetBitmapEx()), + rGraphic.GetBitmapEx(), rTransform); } diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index cdaa15e53322..62d1cd5c26ca 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -63,7 +63,7 @@ namespace drawinglayer::primitive2d rContainer.push_back( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getMarker()), + getMarker(), aTransform)); } } diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx index ed1789be0924..2021fc28360d 100644 --- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx @@ -148,7 +148,7 @@ namespace drawinglayer::primitive2d { const primitive2d::Primitive2DReference xEmbedRefBitmap( new primitive2d::BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(aBitmapEx), + aBitmapEx, basegfx::B2DHomMatrix())); aContent = primitive2d::Primitive2DContainer { xEmbedRefBitmap }; } diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 95c43ddbb8bc..76504eb8e8fe 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -472,7 +472,7 @@ namespace drawinglayer::primitive2d // create bitmap primitive and add rContainer.push_back( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(maOldRenderedBitmap), + maOldRenderedBitmap, aNew2DTransform)); // test: Allow to add an outline in the debugger when tests are needed diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index 67188d8358af..8fb2a312266b 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -273,10 +273,9 @@ void ShadowPrimitive2D::create2DDecomposition( // map and project blur result to geometry range extended by blur // radius, but to the eventually clipped instance (ClippedRange) const primitive2d::Primitive2DReference xEmbedRefBitmap( - new BitmapPrimitive2D(VCLUnoHelper::CreateVCLXBitmap(result), - basegfx::utils::createScaleTranslateB2DHomMatrix( - aClippedRange.getWidth(), aClippedRange.getHeight(), - aClippedRange.getMinX(), aClippedRange.getMinY()))); + new BitmapPrimitive2D(result, basegfx::utils::createScaleTranslateB2DHomMatrix( + aClippedRange.getWidth(), aClippedRange.getHeight(), + aClippedRange.getMinX(), aClippedRange.getMinY()))); rContainer = primitive2d::Primitive2DContainer{ xEmbedRefBitmap }; } diff --git a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx index f01b6759c7f2..e4cbb0d58a4f 100644 --- a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx @@ -216,10 +216,9 @@ void SoftEdgePrimitive2D::create2DDecomposition( // map and project soft result to geometry range extended by soft // radius, but to the eventually clipped instance (ClippedRange) const primitive2d::Primitive2DReference xEmbedRefBitmap( - new BitmapPrimitive2D(VCLUnoHelper::CreateVCLXBitmap(result), - basegfx::utils::createScaleTranslateB2DHomMatrix( - aClippedRange.getWidth(), aClippedRange.getHeight(), - aClippedRange.getMinX(), aClippedRange.getMinY()))); + new BitmapPrimitive2D(result, basegfx::utils::createScaleTranslateB2DHomMatrix( + aClippedRange.getWidth(), aClippedRange.getHeight(), + aClippedRange.getMinX(), aClippedRange.getMinY()))); rContainer = primitive2d::Primitive2DContainer{ xEmbedRefBitmap }; diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx index 4bc7211ae45c..1211e21c718f 100644 --- a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx @@ -54,7 +54,7 @@ namespace drawinglayer::primitive2d Primitive2DReference xReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getBitmapEx()), + getBitmapEx(), aObjectTransform)); aRetval = xReference; @@ -153,7 +153,7 @@ namespace drawinglayer::primitive2d Primitive2DReference xReference( new BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(getBitmapEx()), + getBitmapEx(), aObjectTransform)); aRetval = xReference; diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index 1ebc8d541619..9af3504a5113 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -428,7 +428,7 @@ namespace drawinglayer::processor2d if(!aRange.isEmpty()) { const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate)); - const BitmapEx aBitmapEx(VCLUnoHelper::GetBitmap(rBitmapCandidate.getXBitmap())); + const BitmapEx aBitmapEx(rBitmapCandidate.getBitmap()); const Size& rSizePixel(aBitmapEx.GetSizePixel()); // When tiled rendering, don't bother with the pixel size of the candidate. diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 77c35caa1e27..07f9868a798c 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -423,7 +423,7 @@ void VclProcessor2D::RenderPolygonHairlinePrimitive2D( // direct draw of transformed BitmapEx primitive void VclProcessor2D::RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate) { - BitmapEx aBitmapEx(VCLUnoHelper::GetBitmap(rBitmapCandidate.getXBitmap())); + BitmapEx aBitmapEx(rBitmapCandidate.getBitmap()); const basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rBitmapCandidate.getTransform()); diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 91f07d88d765..b8a3abb2bac1 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -1539,7 +1539,7 @@ namespace emfplushelper { mrTargetHolders.Current().append( new drawinglayer::primitive2d::BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(aBmp), aTransformMatrix)); + aBmp, aTransformMatrix)); } else SAL_WARN("drawinglayer.emf", "EMF+\t warning: empty bitmap"); diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index 63562973d6ca..176b1384dd86 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -664,7 +664,7 @@ void Primitive2dXmlDump::decomposeAndWrite( rWriter.startElement("bitmap"); writeMatrix(rWriter, rBitmapPrimitive2D.getTransform()); - const BitmapEx aBitmapEx(VCLUnoHelper::GetBitmap(rBitmapPrimitive2D.getXBitmap())); + const BitmapEx aBitmapEx(rBitmapPrimitive2D.getBitmap()); const Size& rSizePixel(aBitmapEx.GetSizePixel()); rWriter.attribute("height", rSizePixel.getHeight()); diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 4ec6863eecea..7b1f83b43195 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -626,7 +626,7 @@ namespace wmfemfhelper rTarget.append( new drawinglayer::primitive2d::BitmapPrimitive2D( - VCLUnoHelper::CreateVCLXBitmap(rBitmapEx), + rBitmapEx, aObjectTransform)); } |