summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/SceneGraph.hxx40
-rw-r--r--include/vcl/outdev.hxx4
-rw-r--r--vcl/backendtest/VisualBackendTest.cxx89
-rw-r--r--vcl/inc/SceneGraphNodes.hxx139
-rw-r--r--vcl/inc/opengl/SceneGraphRenderer.hxx4
-rw-r--r--vcl/inc/openglgdiimpl.hxx2
-rw-r--r--vcl/inc/salgdi.hxx4
-rw-r--r--vcl/inc/salgdiimpl.hxx2
-rw-r--r--vcl/inc/unx/salgdi.h2
-rw-r--r--vcl/opengl/SceneGraphRenderer.cxx21
-rw-r--r--vcl/opengl/gdiimpl.cxx2
-rw-r--r--vcl/source/outdev/outdev.cxx8
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx2
13 files changed, 199 insertions, 120 deletions
diff --git a/include/vcl/SceneGraph.hxx b/include/vcl/SceneGraph.hxx
index 3c2a0581a21b..6d427fccbb1a 100644
--- a/include/vcl/SceneGraph.hxx
+++ b/include/vcl/SceneGraph.hxx
@@ -39,27 +39,43 @@ public:
class VCL_DLLPUBLIC Node
{
+ OUString msName;
+
public:
- OUString msID;
NodeType meType;
- std::vector<std::unique_ptr<Node>> mChildren;
+ std::vector<std::shared_ptr<Node>> mChildren;
std::unique_ptr<NodePrivate> mPrivate;
- Node(OUString sID, NodeType eType)
- : msID(sID)
- , meType(eType)
+ Node(NodeType eType)
+ : meType(eType)
{}
virtual ~Node()
{}
-};
-class VCL_DLLPUBLIC RootNode : public Node
-{
-public:
- RootNode(OUString sID)
- : Node(sID, NodeType::ROOT)
- {}
+ OUString& getName()
+ {
+ return msName;
+ }
+
+ void setName(const OUString& sName)
+ {
+ msName = sName;
+ }
+
+ std::shared_ptr<Node> findByName(OUString sName)
+ {
+ for (auto& pChild : mChildren)
+ {
+ if (pChild->getName() == sName)
+ return pChild;
+
+ std::shared_ptr<Node> aFoundNode = pChild->findByName(sName);
+ if (aFoundNode)
+ return aFoundNode;
+ }
+ return std::shared_ptr<Node>();
+ }
};
}} // end vcl::sg namespace
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 6898d4c647e6..6faae239dcfc 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -416,7 +416,7 @@ private:
///@{
public:
- vcl::sg::RootNode maSceneGraphRootNode;
+ std::shared_ptr<vcl::sg::Node> mpSceneGraphRootNode;
protected:
OutputDevice();
@@ -425,7 +425,7 @@ protected:
public:
- vcl::sg::RootNode& getSceneGraphRoot();
+ vcl::sg::Node& getSceneGraphRoot();
bool renderSceneGraph();
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx
index 5534121157e4..870903ede614 100644
--- a/vcl/backendtest/VisualBackendTest.cxx
+++ b/vcl/backendtest/VisualBackendTest.cxx
@@ -52,7 +52,6 @@
#include "test/outputdevice.hxx"
-#include <o3tl/make_unique.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include "SceneGraphNodes.hxx"
@@ -106,51 +105,11 @@ void assertAndSetBackground(vcl::test::TestResult eResult, Rectangle& rRect, vcl
drawBackgroundRect(rRect, COL_RED, rRenderContext);
}
-class Factory
-{
-public:
- static vcl::sg::Node* addRectangle(vcl::sg::Node& rRoot, const basegfx::B2DRange& rRange, SalColor nLineColor, SalColor nFillColor)
- {
- rRoot.mChildren.push_back(o3tl::make_unique<vcl::sg::RectangleNode>(rRange, nLineColor, nFillColor));
- auto* pRectangleNode = static_cast<vcl::sg::RectangleNode*>(rRoot.mChildren.back().get());
- return pRectangleNode;
- }
-
- static vcl::sg::Node* addNormalizedRectangle(vcl::sg::Node& rRoot, const basegfx::B2DRange& rRange, SalColor nLineColor, SalColor nFillColor)
- {
- auto* pRectangleNode = static_cast<vcl::sg::RectangleNode*>(addRectangle(rRoot, rRange, nLineColor, nFillColor));
- pRectangleNode->mbNormalized = true;
- return pRectangleNode;
- }
-
- static vcl::sg::Node* addTransform(vcl::sg::Node& rRoot, glm::mat4 aMatrix)
- {
- rRoot.mChildren.push_back(o3tl::make_unique<vcl::sg::TransformNode>(aMatrix));
- auto* pTransformNode = static_cast<vcl::sg::TransformNode*>(rRoot.mChildren.back().get());
- return pTransformNode;
- }
-
- static vcl::sg::Node* addBitmap(vcl::sg::Node& rRoot, Bitmap& rBitmap, const basegfx::B2DRange& rRange)
- {
- rRoot.mChildren.push_back(o3tl::make_unique<vcl::sg::BitmapNode>(rBitmap, rRange));
- auto* pBitmapNode = static_cast<vcl::sg::BitmapNode*>(rRoot.mChildren.back().get());
- return pBitmapNode;
- }
-
- static vcl::sg::Node* addPolyPolygon(vcl::sg::Node& rRoot, const basegfx::B2DPolyPolygon& rPolyPolygon, SalColor nLineColor, SalColor nFillColor)
- {
- rRoot.mChildren.push_back(o3tl::make_unique<vcl::sg::PolyPolygonNode>(rPolyPolygon, nLineColor, nFillColor));
- auto* pPolyPolygonNode = static_cast<vcl::sg::PolyPolygonNode*>(rRoot.mChildren.back().get());
- return pPolyPolygonNode;
- }
-};
-
class VisualBackendSceneGraphWindow : public WorkWindow
{
private:
Timer maUpdateTimer;
std::vector<std::chrono::high_resolution_clock::time_point> mTimePoints;
- vcl::sg::TransformNode* mpTransform;
std::chrono::high_resolution_clock::time_point maStartTime;
bool mnStop;
@@ -171,24 +130,24 @@ public:
void setupScenegraph()
{
- if (!maSceneGraphRootNode.mChildren.empty())
+ if (!mpSceneGraphRootNode->mChildren.empty())
return;
- Factory::addNormalizedRectangle(maSceneGraphRootNode, basegfx::B2DRange(0.0, 0.0, 1.0, 1.0),
- SALCOLOR_NONE, MAKE_SALCOLOR(0x00, 0x00, 0x00));
+ vcl::sg::SceneGraphFactory aFactory(mpSceneGraphRootNode);
- vcl::sg::Node* pTransformNode = Factory::addTransform(maSceneGraphRootNode, glm::mat4(1.0f));
+ aFactory.addNormalizedRectangle(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0),
+ SALCOLOR_NONE, MAKE_SALCOLOR(0x00, 0x00, 0x00));
- mpTransform = static_cast<vcl::sg::TransformNode*>(pTransformNode);
+ aFactory.pushTransform(glm::mat4(1.0f), "mainTransform");
- Factory::addRectangle(*pTransformNode, basegfx::B2DRange(5.0, 5.0, 50.0, 50.0),
- SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0xff, 0x00));
+ aFactory.addRectangle(basegfx::B2DRange(5.0, 5.0, 50.0, 50.0),
+ SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0xff, 0x00));
- Factory::addRectangle(*pTransformNode, basegfx::B2DRange(50.0, 50.0, 100.0, 100.0),
- SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0x00, 0x00));
+ aFactory.addRectangle(basegfx::B2DRange(50.0, 50.0, 100.0, 100.0),
+ SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0x00, 0x00));
- Factory::addRectangle(*pTransformNode, basegfx::B2DRange(100.0, 100.0, 150.0, 150.0),
- SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0x00, 0xff));
+ aFactory.addRectangle(basegfx::B2DRange(100.0, 100.0, 150.0, 150.0),
+ SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0x00, 0xff));
{
Size aBitmapSize(2048, 2048);
@@ -197,7 +156,7 @@ public:
Bitmap::ScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(COL_WHITE);
}
- Factory::addBitmap(*pTransformNode, aBitmap, basegfx::B2DRange(150.0, 150.0, 200.0, 200.0));
+ aFactory.addBitmap(aBitmap, basegfx::B2DRange(150.0, 150.0, 200.0, 200.0));
}
{
@@ -207,7 +166,7 @@ public:
Bitmap::ScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(COL_RED);
}
- Factory::addBitmap(*pTransformNode, aBitmap, basegfx::B2DRange(150.0, 200.0, 200.0, 250.0));
+ aFactory.addBitmap(aBitmap, basegfx::B2DRange(150.0, 200.0, 200.0, 250.0));
}
{
@@ -217,7 +176,7 @@ public:
Bitmap::ScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(COL_GREEN);
}
- Factory::addBitmap(*pTransformNode, aBitmap, basegfx::B2DRange(200.0, 150.0, 250.0, 200.0));
+ aFactory.addBitmap(aBitmap, basegfx::B2DRange(200.0, 150.0, 250.0, 200.0));
}
{
@@ -227,33 +186,30 @@ public:
Bitmap::ScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(COL_BLUE);
}
- Factory::addBitmap(*pTransformNode, aBitmap, basegfx::B2DRange(200.0, 200.0, 250.0, 250.0));
+ aFactory.addBitmap(aBitmap, basegfx::B2DRange(200.0, 200.0, 250.0, 250.0));
}
glm::mat4 aPolyMatrix(1.0f);
aPolyMatrix = glm::scale(aPolyMatrix, glm::vec3(0.5f, 0.5f, 1.0f));
- {
- vcl::sg::Node* pPolyTransformNode = Factory::addTransform(*pTransformNode, aPolyMatrix);
+ aFactory.pushTransform(aPolyMatrix, "polyTransform");
+ {
OUString aPath = "M300,200 h-150 a150,150 0 1,0 150,-150 z";
basegfx::B2DPolyPolygon aPoly;
basegfx::tools::importFromSvgD(aPoly, aPath, false, nullptr);
- Factory::addPolyPolygon(*pPolyTransformNode, aPoly, SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0x00, 0x00));
+ aFactory.addPolyPolygon(aPoly, SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0x00, 0x00));
}
{
- vcl::sg::Node* pPolyTransformNode = Factory::addTransform(*pTransformNode, aPolyMatrix);
-
OUString aPath = "M275,175 v-150 a150,150 0 0,0 -150,150 z";
basegfx::B2DPolyPolygon aPoly;
basegfx::tools::importFromSvgD(aPoly, aPath, false, nullptr);
- Factory::addPolyPolygon(*pPolyTransformNode, aPoly, SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0xff, 0x00));
+ aFactory.addPolyPolygon(aPoly, SALCOLOR_NONE, MAKE_SALCOLOR(0xff, 0xff, 0x00));
}
-
updateHdl(nullptr);
}
@@ -309,7 +265,12 @@ IMPL_LINK_NOARG_TYPED(VisualBackendSceneGraphWindow, updateHdl, Timer *, void)
aMatrix = glm::rotate(aMatrix, angle, glm::vec3(0.0f, 0.0f, 1.0f));
aMatrix = glm::translate(aMatrix, glm::vec3(-50.0f, -50.0f, 0.0f));
- mpTransform->maMatrix = aMatrix;
+ auto pNode = mpSceneGraphRootNode->findByName("mainTransform");
+ if (pNode)
+ {
+ auto pTransformNode = std::static_pointer_cast<vcl::sg::TransformNode>(pNode);
+ pTransformNode->maMatrix = aMatrix;
+ }
}
maUpdateTimer.SetTimeout(1000.0 / 60.0);
maUpdateTimer.Start();
diff --git a/vcl/inc/SceneGraphNodes.hxx b/vcl/inc/SceneGraphNodes.hxx
index 70e09218d836..8c08a108b4a1 100644
--- a/vcl/inc/SceneGraphNodes.hxx
+++ b/vcl/inc/SceneGraphNodes.hxx
@@ -15,6 +15,7 @@
#include <glm/glm.hpp>
#include <basegfx/range/b2drange.hxx>
+#include <o3tl/make_unique.hxx>
namespace vcl
{
@@ -25,7 +26,7 @@ class VCL_DLLPUBLIC ClippingNode : public Node
{
public:
ClippingNode()
- : Node("ClippingNode", NodeType::CLIPPING)
+ : Node(NodeType::CLIPPING)
{}
basegfx::B2DRange maClipBox;
@@ -37,7 +38,7 @@ public:
glm::mat4 maMatrix;
TransformNode(glm::mat4 aMatrix)
- : Node("TransformNode", NodeType::TRANSFORM)
+ : Node(NodeType::TRANSFORM)
, maMatrix(aMatrix)
{}
};
@@ -53,45 +54,89 @@ class VCL_DLLPUBLIC GeometryNode : public Node
{
public:
GeometryNodeType meGeometryType;
+ bool mbNormalized;
GeometryNode(GeometryNodeType eGeometryType)
- : Node("GeometryNode", NodeType::GEOMETRY)
+ : Node(NodeType::GEOMETRY)
, meGeometryType(eGeometryType)
+ , mbNormalized(false)
+ {}
+
+
+protected:
+ void markAsModified()
{}
};
-class VCL_DLLPUBLIC RectangleNode : public GeometryNode
+struct GeometryAttributes
{
-public:
- basegfx::B2DRange maRectangle;
SalColor maLineColor;
SalColor maFillColor;
- bool mbNormalized;
- RectangleNode(basegfx::B2DRange aRectangle, SalColor aLineColor = SALCOLOR_NONE, SalColor aFillColor = SALCOLOR_NONE)
- : GeometryNode(GeometryNodeType::RECTANGLE)
- , maRectangle(aRectangle)
- , maLineColor(aLineColor)
+ GeometryAttributes(SalColor aLineColor = SALCOLOR_NONE, SalColor aFillColor = SALCOLOR_NONE)
+ : maLineColor(aLineColor)
, maFillColor(aFillColor)
- , mbNormalized(false)
{}
};
-class VCL_DLLPUBLIC PolyPolygonNode : public GeometryNode
+class VCL_DLLPUBLIC RectangleNode : public GeometryNode
{
+private:
+ basegfx::B2DRange maRectangle;
+ GeometryAttributes maAttributes;
+
public:
+ RectangleNode(const basegfx::B2DRange& rRectangle, const GeometryAttributes& rAttributes)
+ : GeometryNode(GeometryNodeType::RECTANGLE)
+ , maRectangle(rRectangle)
+ , maAttributes(rAttributes)
+ {}
+
+ const GeometryAttributes& getAttributes()
+ {
+ return maAttributes;
+ }
+
+ const basegfx::B2DRange& getRectangle()
+ {
+ return maRectangle;
+ }
+
+ void modifyAttributes(GeometryAttributes& rAttributes)
+ {
+ maAttributes = rAttributes;
+ markAsModified();
+ }
+};
+
+class VCL_DLLPUBLIC PolyPolygonNode : public GeometryNode
+{
+private:
basegfx::B2DPolyPolygon maPolyPolygon;
- SalColor maLineColor;
- SalColor maFillColor;
- bool mbNormalized;
+ GeometryAttributes maAttributes;
- PolyPolygonNode(basegfx::B2DPolyPolygon aPolyPolygon, SalColor aLineColor = SALCOLOR_NONE, SalColor aFillColor = SALCOLOR_NONE)
+public:
+ PolyPolygonNode(const basegfx::B2DPolyPolygon& rPolyPolygon, const GeometryAttributes& rAttributes)
: GeometryNode(GeometryNodeType::POLYPOLYGON)
- , maPolyPolygon(aPolyPolygon)
- , maLineColor(aLineColor)
- , maFillColor(aFillColor)
- , mbNormalized(false)
+ , maPolyPolygon(rPolyPolygon)
+ , maAttributes(rAttributes)
{}
+
+ const GeometryAttributes& getAttributes()
+ {
+ return maAttributes;
+ }
+
+ const basegfx::B2DPolyPolygon& getPolyPolygon()
+ {
+ return maPolyPolygon;
+ }
+
+ void modifyAttributes(GeometryAttributes& rAttributes)
+ {
+ maAttributes = rAttributes;
+ markAsModified();
+ }
};
class VCL_DLLPUBLIC BitmapNode : public GeometryNode
@@ -107,6 +152,58 @@ public:
{}
};
+class SceneGraphFactory
+{
+private:
+ std::vector<std::shared_ptr<Node>> maNodeStack;
+
+public:
+ SceneGraphFactory(const std::shared_ptr<Node>& pRootNode)
+ : maNodeStack({pRootNode})
+ {}
+
+ Node& getCurrent()
+ {
+ return *maNodeStack.back().get();
+ }
+
+ void pushTransform(glm::mat4 aMatrix, const OUString& rName)
+ {
+ auto pTransformNode = std::make_shared<vcl::sg::TransformNode>(aMatrix);
+ pTransformNode->setName(rName);
+ getCurrent().mChildren.push_back(pTransformNode);
+ maNodeStack.push_back(pTransformNode);
+ }
+
+ void pop()
+ {
+ maNodeStack.pop_back();
+ }
+
+ void addRectangle(const basegfx::B2DRange& rRange, SalColor nLineColor, SalColor nFillColor)
+ {
+ GeometryAttributes aAttributes(nLineColor, nFillColor);
+ getCurrent().mChildren.push_back(std::make_shared<RectangleNode>(rRange, aAttributes));
+ }
+
+ void addNormalizedRectangle(const basegfx::B2DRange& rRange, SalColor nLineColor, SalColor nFillColor)
+ {
+ addRectangle(rRange, nLineColor, nFillColor);
+ std::static_pointer_cast<RectangleNode>(getCurrent().mChildren.back())->mbNormalized = true;
+ }
+
+ void addBitmap(Bitmap& rBitmap, const basegfx::B2DRange& rRange)
+ {
+ getCurrent().mChildren.push_back(std::make_shared<BitmapNode>(rBitmap, rRange));
+ }
+
+ void addPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SalColor nLineColor, SalColor nFillColor)
+ {
+ GeometryAttributes aAttributes(nLineColor, nFillColor);
+ getCurrent().mChildren.push_back(std::make_shared<PolyPolygonNode>(rPolyPolygon, aAttributes));
+ }
+};
+
}} // end vcl::sg namespace
#endif // INCLUDED_VCL_INC_SCENEGRAPH_HXX
diff --git a/vcl/inc/opengl/SceneGraphRenderer.hxx b/vcl/inc/opengl/SceneGraphRenderer.hxx
index 5980e6f240f9..1257a7ca1bd9 100644
--- a/vcl/inc/opengl/SceneGraphRenderer.hxx
+++ b/vcl/inc/opengl/SceneGraphRenderer.hxx
@@ -25,7 +25,7 @@
class SceneGraphRenderer
{
private:
- vcl::sg::RootNode& mrRootNode;
+ vcl::sg::Node& mrRootNode;
float mfWidth;
float mfHeight;
RenderList& mrRenderList;
@@ -42,7 +42,7 @@ private:
void runChildren(vcl::sg::Node& rNode);
public:
- SceneGraphRenderer(vcl::sg::RootNode& rRootNode, RenderList& rRenderList);
+ SceneGraphRenderer(vcl::sg::Node& rRootNode, RenderList& rRenderList);
bool render(float fWidth, float fHeight);
};
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 6f69711b6bc8..f6cb76eba87e 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -371,7 +371,7 @@ public:
virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override;
- virtual bool renderSceneGraph(vcl::sg::RootNode& rRootNode);
+ virtual bool renderSceneGraph(vcl::sg::Node& rRootNode);
/// queue an idle flush of contents of the back-buffer to the screen
void flush();
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 7fef805a5abc..d8d0cf05056f 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -425,7 +425,7 @@ public:
sal_uInt8 nTransparency,
const OutputDevice *pOutDev );
- bool RenderSceneGraph(vcl::sg::RootNode& rRootNode)
+ bool RenderSceneGraph(vcl::sg::Node& rRootNode)
{
return renderSceneGraph(rRootNode);
}
@@ -616,7 +616,7 @@ protected:
long nWidth, long nHeight,
sal_uInt8 nTransparency ) = 0;
- virtual bool renderSceneGraph(vcl::sg::RootNode& /*rRootNode*/)
+ virtual bool renderSceneGraph(vcl::sg::Node& /*rRootNode*/)
{
return false;
}
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index 27dbebf43c38..f4d4c6d21e77 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -196,7 +196,7 @@ public:
virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0;
- virtual bool renderSceneGraph(vcl::sg::RootNode& /*rRootNode*/)
+ virtual bool renderSceneGraph(vcl::sg::Node& /*rRootNode*/)
{
return false;
}
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 35df48a9871e..59adc31577f5 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -259,7 +259,7 @@ public:
long nX, long nY, long nWidth,
long nHeight, sal_uInt8 nTransparency ) override;
- virtual bool renderSceneGraph(vcl::sg::RootNode& rRootNode) override;
+ virtual bool renderSceneGraph(vcl::sg::Node& rRootNode) override;
virtual SystemGraphicsData GetGraphicsData() const override;
diff --git a/vcl/opengl/SceneGraphRenderer.cxx b/vcl/opengl/SceneGraphRenderer.cxx
index 5763af96a32e..02ee75ea83d5 100644
--- a/vcl/opengl/SceneGraphRenderer.cxx
+++ b/vcl/opengl/SceneGraphRenderer.cxx
@@ -236,7 +236,7 @@ void addDrawPolyPolygon(RenderEntry& rRenderEntry,const basegfx::B2DPolyPolygon&
} // end anonymous namespace
-SceneGraphRenderer::SceneGraphRenderer(vcl::sg::RootNode& rRootNode, RenderList& rRenderList)
+SceneGraphRenderer::SceneGraphRenderer(vcl::sg::Node& rRootNode, RenderList& rRenderList)
: mrRootNode(rRootNode)
, mrRenderList(rRenderList)
{}
@@ -304,10 +304,13 @@ void SceneGraphRenderer::processBitmapNode(vcl::sg::BitmapNode* pBitmapNode)
void SceneGraphRenderer::processRectangleNode(vcl::sg::RectangleNode* pRectangleNode)
{
- float x1 = pRectangleNode->maRectangle.getMinX();
- float y1 = pRectangleNode->maRectangle.getMinY();
- float x2 = pRectangleNode->maRectangle.getMaxX();
- float y2 = pRectangleNode->maRectangle.getMaxY();
+ const vcl::sg::GeometryAttributes& rAttributes = pRectangleNode->getAttributes();
+ const basegfx::B2DRange& rRectangle = pRectangleNode->getRectangle();
+
+ float x1 = rRectangle.getMinX();
+ float y1 = rRectangle.getMinY();
+ float x2 = rRectangle.getMaxX();
+ float y2 = rRectangle.getMaxY();
if (pRectangleNode->mbNormalized)
{
@@ -321,12 +324,14 @@ void SceneGraphRenderer::processRectangleNode(vcl::sg::RectangleNode* pRectangle
RenderEntry& rRenderEntry = mrRenderList.getEntries().back();
- appendRectangle(rRenderEntry, x1, y1, x2, y2, pRectangleNode->maLineColor, pRectangleNode->maFillColor, 0.0f);
+ appendRectangle(rRenderEntry, x1, y1, x2, y2, rAttributes.maLineColor, rAttributes.maFillColor, 0.0f);
}
void SceneGraphRenderer::processPolyPolygonNode(vcl::sg::PolyPolygonNode* pPolyPolygonNode)
{
- basegfx::B2DPolyPolygon& rPolyPolygon(pPolyPolygonNode->maPolyPolygon);
+ const vcl::sg::GeometryAttributes& rAttributes = pPolyPolygonNode->getAttributes();
+
+ const basegfx::B2DPolyPolygon& rPolyPolygon(pPolyPolygonNode->getPolyPolygon());
basegfx::B2DRange aBoundingRect(rPolyPolygon.getB2DRange());
float x1 = aBoundingRect.getMinX();
@@ -338,7 +343,7 @@ void SceneGraphRenderer::processPolyPolygonNode(vcl::sg::PolyPolygonNode* pPolyP
RenderEntry& rRenderEntry = mrRenderList.getEntries().back();
- addDrawPolyPolygon(rRenderEntry, rPolyPolygon, 0.0, pPolyPolygonNode->maLineColor, pPolyPolygonNode->maFillColor, true);
+ addDrawPolyPolygon(rRenderEntry, rPolyPolygon, 0.0, rAttributes.maLineColor, rAttributes.maFillColor, true);
}
void SceneGraphRenderer::runChildren(vcl::sg::Node& rNode)
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 4301b1c9d447..56b57c9bd874 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -2208,7 +2208,7 @@ void OpenGLSalGraphicsImpl::doFlush()
VCL_GL_INFO( "doFlush - end." );
}
-bool OpenGLSalGraphicsImpl::renderSceneGraph(vcl::sg::RootNode& rRootNode)
+bool OpenGLSalGraphicsImpl::renderSceneGraph(vcl::sg::Node& rRootNode)
{
SceneGraphRenderer aSceneGraphRenderer(rRootNode, *mpRenderList);
aSceneGraphRenderer.render(GetWidth(), GetHeight());
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index f2f0e3a17bd6..5f23108d401a 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -47,7 +47,7 @@ OutputDevice::OutputDevice() :
maFillColor( COL_WHITE ),
maTextLineColor( COL_TRANSPARENT ),
mxSettings( new AllSettings(Application::GetSettings()) ),
- maSceneGraphRootNode("OutputRoot")
+ mpSceneGraphRootNode(std::make_shared<vcl::sg::Node>(vcl::sg::NodeType::ROOT))
{
mpGraphics = nullptr;
mpUnoGraphicsList = nullptr;
@@ -269,9 +269,9 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const
return mpGraphics->GetGraphicsData();
}
-vcl::sg::RootNode& OutputDevice::getSceneGraphRoot()
+vcl::sg::Node& OutputDevice::getSceneGraphRoot()
{
- return maSceneGraphRootNode;
+ return *mpSceneGraphRootNode;
}
bool OutputDevice::renderSceneGraph()
@@ -282,7 +282,7 @@ bool OutputDevice::renderSceneGraph()
return false;
}
- mpGraphics->RenderSceneGraph(maSceneGraphRootNode);
+ mpGraphics->RenderSceneGraph(*mpSceneGraphRootNode);
}
#if ENABLE_CAIRO_CANVAS
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index e162f8566c03..dfb5e9781246 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -877,7 +877,7 @@ SalGeometryProvider *X11SalGraphics::GetGeometryProvider() const
return static_cast< SalGeometryProvider * >(m_pVDev);
}
-bool X11SalGraphics::renderSceneGraph(vcl::sg::RootNode& rRootNode)
+bool X11SalGraphics::renderSceneGraph(vcl::sg::Node& rRootNode)
{
return m_bOpenGL ? mxImpl->renderSceneGraph(rRootNode) : false;
}