diff options
author | Michael Jaumann <meta_dev@yahoo.com> | 2015-02-11 12:05:41 +0000 |
---|---|---|
committer | Michael Jaumann <meta_dev@yahoo.com> | 2015-03-02 12:42:53 +0000 |
commit | c5ad876695951a0df58446ff03b81129ee65c1eb (patch) | |
tree | 0058c7d1612fb2235dab270a2e2e7a8230737614 | |
parent | 24585d29317d14c362c2f12ee254b1aa5a943c8a (diff) |
general transformation for canvasbitmaps
applys the same transformation matrix additional to the
basic transformation matrix for each action
-> the background image is composed and drawn to the same offset
relative to the right border
Change-Id: I85bc670841c9f884fd276451233cd1812ed6d9f7
-rw-r--r-- | canvas/source/opengl/ogl_canvasbitmap.cxx | 5 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvasbitmap.hxx | 4 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvashelper.cxx | 42 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvashelper.hxx | 8 |
4 files changed, 47 insertions, 12 deletions
diff --git a/canvas/source/opengl/ogl_canvasbitmap.cxx b/canvas/source/opengl/ogl_canvasbitmap.cxx index b7c5d9bd3e01..e0f036197c2e 100644 --- a/canvas/source/opengl/ogl_canvasbitmap.cxx +++ b/canvas/source/opengl/ogl_canvasbitmap.cxx @@ -50,6 +50,11 @@ namespace oglcanvas { return maCanvasHelper.renderRecordedActions(); } + + bool CanvasBitmap::renderRecordedActions(const ::basegfx::B2DHomMatrix& rGeneralTransform) const + { + return maCanvasHelper.renderRecordedActions(rGeneralTransform); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/opengl/ogl_canvasbitmap.hxx b/canvas/source/opengl/ogl_canvasbitmap.hxx index 534837a24127..c5c320207ab6 100644 --- a/canvas/source/opengl/ogl_canvasbitmap.hxx +++ b/canvas/source/opengl/ogl_canvasbitmap.hxx @@ -65,6 +65,10 @@ namespace oglcanvas */ bool renderRecordedActions() const; + /** Write out recorded actions + apply transformation for each action + */ + bool renderRecordedActions( const ::basegfx::B2DHomMatrix& rGeneralTransform) const; private: /** MUST hold here, too, since CanvasHelper only contains a raw pointer (without refcounting) diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index 58e807229953..c0b94ec01e3b 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -326,23 +326,21 @@ namespace oglcanvas return true; } - bool lcl_drawOwnBitmap( const CanvasHelper& rHelper, + bool lcl_drawOwnBitmap( const CanvasHelper& /*rHelper*/, const ::basegfx::B2DHomMatrix& rTransform, - GLenum eSrcBlend, - GLenum eDstBlend, + GLenum /*eSrcBlend*/, + GLenum /*eDstBlend*/, const rendering::ARGBColor& /*rColor*/, const CanvasBitmap& rBitmap ) { - RenderHelper* pRenderHelper = rHelper.getDeviceHelper()->getRenderHelper(); - pRenderHelper->SetModelAndMVP(setupState(rTransform, eSrcBlend, eDstBlend)); - return rBitmap.renderRecordedActions(); + return rBitmap.renderRecordedActions(rTransform); } bool lcl_drawGenericBitmap( const CanvasHelper& rHelper, const ::basegfx::B2DHomMatrix& rTransform, GLenum eSrcBlend, GLenum eDstBlend, - const rendering::ARGBColor& rColor, + const rendering::ARGBColor& /*rColor*/, const geometry::IntegerSize2D& rPixelSize, const uno::Sequence<sal_Int8>& rPixelData, sal_uInt32 nPixelCrc32) @@ -553,7 +551,6 @@ namespace oglcanvas rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety rAct.maFunction = lcl_drawPolyPolygon; - // TODO(F2): subdivide&render whole curve /* rAct.maFunction = ::boost::bind(&lcl_drawLine, _1,_2,_3,_4,_5, geometry::RealPoint2D( @@ -659,10 +656,8 @@ namespace oglcanvas unoCapeFromCap(strokeAttributes.StartCapType) )); } - // Note: the generated stroke poly-polygon is NOT free of - // self-intersections. Therefore, if we would render it - // via OutDev::DrawPolyPolygon(), on/off fill would - // generate off areas on those self-intersections. + + //Render each subpolygon for itself const sal_uInt16 nSize( aStrokedPolyPoly.count() ); @@ -1163,10 +1158,33 @@ namespace oglcanvas return true; } + bool CanvasHelper::renderRecordedActions( const ::basegfx::B2DHomMatrix& rGeneralTransform) const + { + std::vector<Action>::const_iterator aCurr(mpRecordedActions->begin()); + const std::vector<Action>::const_iterator aEnd(mpRecordedActions->end()); + while( aCurr != aEnd ) + { + const ::basegfx::B2DHomMatrix& combinedTransform = rGeneralTransform * aCurr->maTransform; + if( !aCurr->maFunction( *this, + combinedTransform, + aCurr->meSrcBlendMode, + aCurr->meDstBlendMode, + aCurr->maARGBColor, + aCurr->maPolyPolys ) ) + return false; + + ++aCurr; + } + + return true; + } + size_t CanvasHelper::getRecordedActionCount() const { return mpRecordedActions->size(); } + + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/opengl/ogl_canvashelper.hxx b/canvas/source/opengl/ogl_canvashelper.hxx index acd0b4cf9227..7c74780e0c12 100644 --- a/canvas/source/opengl/ogl_canvashelper.hxx +++ b/canvas/source/opengl/ogl_canvashelper.hxx @@ -14,11 +14,13 @@ #include <basegfx/vector/b2isize.hxx> #include <basegfx/vector/b2dsize.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> #include <o3tl/cow_wrapper.hxx> #include <vector> #include "ogl_renderHelper.hxx" + namespace oglcanvas { class SpriteDeviceHelper; @@ -194,6 +196,11 @@ namespace oglcanvas */ bool renderRecordedActions() const; + /** Write out recorded actions + Apply the general transformation for each action + */ + bool renderRecordedActions( const ::basegfx::B2DHomMatrix& rGeneralTransform) const; + /** Retrieve number of recorded actions */ size_t getRecordedActionCount() const; @@ -205,6 +212,7 @@ namespace oglcanvas typedef o3tl::cow_wrapper< std::vector<Action>, o3tl::ThreadSafeRefCountingPolicy > RecordVectorT; + private: CanvasHelper( const CanvasHelper& ) SAL_DELETED_FUNCTION; |