[Libreoffice-commits] core.git: Branch 'feature/opengl-canvas-rework' - 2 commits - canvas/source
Michael Jaumann
meta_dev at yahoo.com
Wed Feb 11 05:40:40 PST 2015
canvas/source/opengl/ogl_canvasbitmap.cxx | 5 +++
canvas/source/opengl/ogl_canvasbitmap.hxx | 4 ++
canvas/source/opengl/ogl_canvashelper.cxx | 42 +++++++++++++++++++++---------
canvas/source/opengl/ogl_canvashelper.hxx | 8 +++++
canvas/source/opengl/ogl_canvastools.cxx | 8 ++---
5 files changed, 50 insertions(+), 17 deletions(-)
New commits:
commit 2ff6febd530646dde32d6f2b3fa2212886b74dc3
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Feb 11 12:13:10 2015 +0000
removed unnecessary conversion
Change-Id: Id5c1c7d9d26bb74d34a652655ddac8dae7568a41
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index eacac6b..6490cff 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -112,16 +112,14 @@ namespace oglcanvas
GLenum eSrcBlend,
GLenum eDstBlend)
{
- float aGLTransform[] =
- {
+ const glm::mat4 aGLTransform = glm::mat4(
(float) rTransform.get(0,0), (float) rTransform.get(1,0), 0, 0,
(float) rTransform.get(0,1), (float) rTransform.get(1,1), 0, 0,
0, 0, 1, 0,
- (float) rTransform.get(0,2), (float) rTransform.get(1,2), 0, 1
- };
+ (float) rTransform.get(0,2), (float) rTransform.get(1,2), 0, 1);
glEnable(GL_BLEND);
glBlendFunc(eSrcBlend, eDstBlend);
- return glm::make_mat4(aGLTransform);
+ return aGLTransform;
}
void renderOSD( const std::vector<double>& rNumbers, double scale, RenderHelper *renderHelper)
commit ec6054e0cdd03827f118cdb344595bc5b51320ec
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Feb 11 12:05:41 2015 +0000
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
diff --git a/canvas/source/opengl/ogl_canvasbitmap.cxx b/canvas/source/opengl/ogl_canvasbitmap.cxx
index b7c5d9b..e0f0361 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 534837a..c5c3202 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 58e8072..c0b94ec 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 71b7f2c..7e5d6f8 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:
// declared, but not defined
CanvasHelper( const CanvasHelper& );
More information about the Libreoffice-commits
mailing list