summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-28 13:27:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-04-28 21:37:43 +0200
commitc33f08ca36084643e6eed20c18f151cf75045c62 (patch)
tree9f9936e77ae004ced1fc7fde574b8ee4c85a66d1 /drawinglayer
parent9f46ae1ab572b62af01119dcd473f99184e4760c (diff)
createPixelProcessor2DFromOutputDevice won't return null
nor will createProcessor2DFromOutputDevice Change-Id: I1e0359ef2f94eeaf2da9a89d9e9dfb615587d3da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114814 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/README.md21
-rw-r--r--drawinglayer/source/tools/converters.cxx119
2 files changed, 67 insertions, 73 deletions
diff --git a/drawinglayer/README.md b/drawinglayer/README.md
index 38bdc2197c70..04ebcadf0b17 100644
--- a/drawinglayer/README.md
+++ b/drawinglayer/README.md
@@ -24,18 +24,15 @@ A stripped down version with extended comments:
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(...));
- if (pProcessor2D)
- {
- // Fill-in the display list.
- drawinglayer::primitive2d::Primitive2DSequence aSequence(2);
-
- aSequence[0] = aHatchPrimitive;
- aSequence[1] = aBlackRectanglePrimitive;
-
- // Render it to the virtual device.
- pProcessor2D->process(aSequence);
- pProcessor2D.reset();
- }
+ // Fill-in the display list.
+ drawinglayer::primitive2d::Primitive2DSequence aSequence(2);
+
+ aSequence[0] = aHatchPrimitive;
+ aSequence[1] = aBlackRectanglePrimitive;
+
+ // Render it to the virtual device.
+ pProcessor2D->process(aSequence);
+ pProcessor2D.reset();
// Obtain the bitmap that was rendered from the virtual device, to re-use
// it in the widget.
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx
index e1a59d0175df..6a963748161f 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -85,87 +85,84 @@ namespace drawinglayer
*pContent,
rViewInformation2D);
- if(pContentProcessor)
- {
#ifdef DBG_UTIL
- static bool bDoSaveForVisualControl(false); // loplugin:constvars:ignore
+ static bool bDoSaveForVisualControl(false); // loplugin:constvars:ignore
#endif
- // render content
- pContentProcessor->process(aSequence);
+ // render content
+ pContentProcessor->process(aSequence);
- // get content
- pContent->EnableMapMode(false);
- const Bitmap aContent(pContent->GetBitmap(aEmptyPoint, aSizePixel));
+ // get content
+ pContent->EnableMapMode(false);
+ const Bitmap aContent(pContent->GetBitmap(aEmptyPoint, aSizePixel));
#ifdef DBG_UTIL
- if(bDoSaveForVisualControl)
- {
- SvFileStream aNew(
+ if(bDoSaveForVisualControl)
+ {
+ SvFileStream aNew(
#ifdef _WIN32
- "c:\\test_content.png"
+ "c:\\test_content.png"
#else
- "~/test_content.png"
+ "~/test_content.png"
#endif
- , StreamMode::WRITE|StreamMode::TRUNC);
- BitmapEx aContentEx(aContent);
- vcl::PNGWriter aPNGWriter(aContentEx);
- aPNGWriter.Write(aNew);
- }
+ , StreamMode::WRITE|StreamMode::TRUNC);
+ BitmapEx aContentEx(aContent);
+ vcl::PNGWriter aPNGWriter(aContentEx);
+ aPNGWriter.Write(aNew);
+ }
#endif
- // prepare for mask creation
- pContent->SetMapMode(aMapModePixel);
-
- // set alpha to all white (fully transparent)
- pContent->Erase();
-
- // embed primitives to paint them black
- const primitive2d::Primitive2DReference xRef(
- new primitive2d::ModifiedColorPrimitive2D(
- aSequence,
- std::make_shared<basegfx::BColorModifier_replace>(
- basegfx::BColor(0.0, 0.0, 0.0))));
- const primitive2d::Primitive2DContainer xSeq { xRef };
-
- // render
- pContentProcessor->process(xSeq);
- pContentProcessor.reset();
-
- // get alpha channel from vdev
- pContent->EnableMapMode(false);
- const Bitmap aAlpha(pContent->GetBitmap(aEmptyPoint, aSizePixel));
+ // prepare for mask creation
+ pContent->SetMapMode(aMapModePixel);
+
+ // set alpha to all white (fully transparent)
+ pContent->Erase();
+
+ // embed primitives to paint them black
+ const primitive2d::Primitive2DReference xRef(
+ new primitive2d::ModifiedColorPrimitive2D(
+ aSequence,
+ std::make_shared<basegfx::BColorModifier_replace>(
+ basegfx::BColor(0.0, 0.0, 0.0))));
+ const primitive2d::Primitive2DContainer xSeq { xRef };
+
+ // render
+ pContentProcessor->process(xSeq);
+ pContentProcessor.reset();
+
+ // get alpha channel from vdev
+ pContent->EnableMapMode(false);
+ const Bitmap aAlpha(pContent->GetBitmap(aEmptyPoint, aSizePixel));
#ifdef DBG_UTIL
- if(bDoSaveForVisualControl)
- {
- SvFileStream aNew(
+ if(bDoSaveForVisualControl)
+ {
+ SvFileStream aNew(
#ifdef _WIN32
- "c:\\test_alpha.png"
+ "c:\\test_alpha.png"
#else
- "~/test_alpha.png"
+ "~/test_alpha.png"
#endif
- , StreamMode::WRITE|StreamMode::TRUNC);
- BitmapEx aAlphaEx(aAlpha);
- vcl::PNGWriter aPNGWriter(aAlphaEx);
- aPNGWriter.Write(aNew);
- }
+ , StreamMode::WRITE|StreamMode::TRUNC);
+ BitmapEx aAlphaEx(aAlpha);
+ vcl::PNGWriter aPNGWriter(aAlphaEx);
+ aPNGWriter.Write(aNew);
+ }
#endif
- // create BitmapEx result
- aRetval = BitmapEx(aContent, AlphaMask(aAlpha));
+ // create BitmapEx result
+ aRetval = BitmapEx(aContent, AlphaMask(aAlpha));
#ifdef DBG_UTIL
- if(bDoSaveForVisualControl)
- {
- SvFileStream aNew(
+ if(bDoSaveForVisualControl)
+ {
+ SvFileStream aNew(
#ifdef _WIN32
- "c:\\test_combined.png"
+ "c:\\test_combined.png"
#else
- "~/test_combined.png"
-#endif
- , StreamMode::WRITE|StreamMode::TRUNC);
- vcl::PNGWriter aPNGWriter(aRetval);
- aPNGWriter.Write(aNew);
- }
+ "~/test_combined.png"
#endif
+ , StreamMode::WRITE|StreamMode::TRUNC);
+ vcl::PNGWriter aPNGWriter(aRetval);
+ aPNGWriter.Write(aNew);
}
+#endif
}
return aRetval;