Enable gcc wall and werror.
This commit is contained in:
parent
990cde402b
commit
3fad113178
64 changed files with 347 additions and 314 deletions
|
@ -56,12 +56,13 @@ std::string GlyphRunOutlines::toPostScriptPath()
|
|||
}
|
||||
|
||||
FontGlyph::FontGlyph(unsigned width, unsigned height, int bearingX, int bearingY, int advanceX, std::unique_ptr<Image> image)
|
||||
: mImage(std::move(image)),
|
||||
:
|
||||
mWidth(width),
|
||||
mHeight(height),
|
||||
mBearingX(bearingX),
|
||||
mBearingY(bearingY),
|
||||
mAdvanceX(advanceX)
|
||||
mAdvanceX(advanceX),
|
||||
mImage(std::move(image))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "FontItem.h"
|
||||
|
||||
FontItem::FontItem(const std::string& faceName, float size)
|
||||
: mFaceName(faceName),
|
||||
mSize(size)
|
||||
: mSize(size),
|
||||
mFaceName(faceName)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -30,4 +31,4 @@ const std::string& FontItem::getFaceName() const
|
|||
float FontItem::getSize() const
|
||||
{
|
||||
return mSize;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include "Scene.h"
|
||||
|
||||
DrawingContext::DrawingContext(DrawingSurface* surface, FontsManager* fontsManager, DrawingMode requestedDrawingMode)
|
||||
: mSurface(surface),
|
||||
mDrawingMode(requestedDrawingMode),
|
||||
mFontsManager(fontsManager)
|
||||
: mDrawingMode(requestedDrawingMode),
|
||||
mFontsManager(fontsManager),
|
||||
mSurface(surface)
|
||||
{
|
||||
mPainter = PainterFactory::Create(this, mDrawingMode);
|
||||
|
||||
|
@ -47,4 +47,4 @@ void DrawingContext::paint()
|
|||
AbstractPainter* DrawingContext::getPainter() const
|
||||
{
|
||||
return mPainter.get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
#include "Node.h"
|
||||
|
||||
Edge::Edge(Node* node0, Node* node1, std::size_t id)
|
||||
: mNode0(node0),
|
||||
mNode1(node1),
|
||||
mId(id)
|
||||
: mId(id),
|
||||
mNode0(node0),
|
||||
mNode1(node1)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ std::unique_ptr<TriMesh> MeshPrimitives::buildCircleAsTriMesh(std::size_t numSeg
|
|||
std::unique_ptr<LineMesh> MeshPrimitives::buildCircleAsLineMesh(std::size_t numSegments)
|
||||
{
|
||||
VecPoints locations(numSegments);
|
||||
const double delta_theta = (2.0*M_PI)/double(numSegments);
|
||||
//const double delta_theta = (2.0*M_PI)/double(numSegments);
|
||||
double theta = 0.0;
|
||||
for(unsigned idx=0; idx<numSegments; idx++)
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ std::unique_ptr<TriMesh> MeshPrimitives::buildRoundedRectangleAsTriMesh(double r
|
|||
}
|
||||
|
||||
// Inner rect edges
|
||||
std::size_t edge_offset = num_edges_per_fan*num_fans;
|
||||
// std::size_t edge_offset = num_edges_per_fan*num_fans;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ Node::~Node()
|
|||
}
|
||||
|
||||
Node::Node(const Point& p, std::size_t index)
|
||||
: mPoint(p),
|
||||
mIndex(index)
|
||||
: mIndex(index),
|
||||
mPoint(p)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void GridNode::update(SceneInfo* sceneInfo)
|
|||
|
||||
if (mDataDirty)
|
||||
{
|
||||
auto difference = mNumberX*mNumberY - mData.size();
|
||||
//auto difference = mNumberX*mNumberY - mData.size();
|
||||
mData.resize(mNumberX*mNumberY, {});
|
||||
|
||||
auto node_data = std::vector<std::vector<double> >(4*mNumberX*mNumberY);
|
||||
|
@ -128,7 +128,7 @@ void GridNode::update(SceneInfo* sceneInfo)
|
|||
|
||||
if (mTransformIsDirty)
|
||||
{
|
||||
auto size = mHeight > mWidth ? mWidth : mHeight;
|
||||
//auto size = mHeight > mWidth ? mWidth : mHeight;
|
||||
|
||||
//mBackgroundModel->updateTransform({mLocation, static_cast<double>(size), static_cast<double>(size)});
|
||||
//mOutlineModel->updateTransform({mLocation, static_cast<double>(size), static_cast<double>(size)});
|
||||
|
|
|
@ -81,7 +81,7 @@ void MeshNode::update(SceneInfo* sceneInfo)
|
|||
|
||||
if (mTransformIsDirty)
|
||||
{
|
||||
auto size = mHeight > mWidth ? mWidth : mHeight;
|
||||
//auto size = mHeight > mWidth ? mWidth : mHeight;
|
||||
//mModel->updateTransform({mLocation, static_cast<double>(size), static_cast<double>(size)});
|
||||
mTransformIsDirty = false;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
#include <iostream>
|
||||
|
||||
Scene::Scene()
|
||||
: mRootNode(std::make_unique<RootNode>()),
|
||||
mSceneInfo(std::make_unique<SceneInfo>()),
|
||||
mBackGroundColor(Color(255, 255, 255))
|
||||
: mBackGroundColor(Color(255, 255, 255)),
|
||||
mRootNode(std::make_unique<RootNode>()),
|
||||
mSceneInfo(std::make_unique<SceneInfo>())
|
||||
|
||||
{
|
||||
mRootNode->setName("Scene_RootNode");
|
||||
}
|
||||
|
|
|
@ -7,139 +7,139 @@
|
|||
#include "SvgShapeElements.h"
|
||||
|
||||
SvgNode::SvgNode(const Transform& transform)
|
||||
: MaterialNode(transform)
|
||||
: MaterialNode(transform)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SvgNode::setContent(std::unique_ptr<SvgDocument> doc)
|
||||
{
|
||||
mContent = std::move(doc);
|
||||
mContentDirty = true;
|
||||
mContent = std::move(doc);
|
||||
mContentDirty = true;
|
||||
|
||||
mChildren.clear();
|
||||
mGeometryNodes.clear();
|
||||
mChildren.clear();
|
||||
mGeometryNodes.clear();
|
||||
}
|
||||
|
||||
unsigned SvgNode::getContentWidth() const
|
||||
{
|
||||
return mContentWidth;
|
||||
return mContentWidth;
|
||||
}
|
||||
|
||||
unsigned SvgNode::getContentHeight() const
|
||||
{
|
||||
return mContentHeight;
|
||||
return mContentHeight;
|
||||
}
|
||||
|
||||
void SvgNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
|
||||
{
|
||||
if (!mContent->getRoot())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!mContent->getRoot())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto viewbox = mContent->getViewBox();
|
||||
//auto viewbox = mContent->getViewBox();
|
||||
|
||||
for (const auto& svg_element : mContent->getRoot()->getChildren())
|
||||
{
|
||||
std::unique_ptr<GeometryNode> geom_node;
|
||||
for (const auto& svg_element : mContent->getRoot()->getChildren())
|
||||
{
|
||||
std::unique_ptr<GeometryNode> geom_node;
|
||||
|
||||
if (svg_element->getTagName() == "circle")
|
||||
{
|
||||
onCircle(svg_element.get(), geom_node);
|
||||
}
|
||||
else if (svg_element->getTagName() == "path")
|
||||
{
|
||||
onPath(svg_element.get(), geom_node);
|
||||
}
|
||||
if (svg_element->getTagName() == "circle")
|
||||
{
|
||||
onCircle(svg_element.get(), geom_node);
|
||||
}
|
||||
else if (svg_element->getTagName() == "path")
|
||||
{
|
||||
onPath(svg_element.get(), geom_node);
|
||||
}
|
||||
|
||||
AbstractVisualNode* raw_node{ nullptr };
|
||||
if (geom_node)
|
||||
{
|
||||
raw_node = geom_node.get();
|
||||
mGeometryNodes.push_back(std::move(geom_node));
|
||||
}
|
||||
AbstractVisualNode* raw_node{ nullptr };
|
||||
if (geom_node)
|
||||
{
|
||||
raw_node = geom_node.get();
|
||||
mGeometryNodes.push_back(std::move(geom_node));
|
||||
}
|
||||
|
||||
if (raw_node)
|
||||
{
|
||||
addChild(raw_node);
|
||||
}
|
||||
}
|
||||
if (raw_node)
|
||||
{
|
||||
addChild(raw_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SvgNode::update(SceneInfo* sceneInfo)
|
||||
{
|
||||
if (mContent && mContentDirty)
|
||||
{
|
||||
createOrUpdateGeometry(sceneInfo);
|
||||
mContentDirty = false;
|
||||
}
|
||||
if (mContent && mContentDirty)
|
||||
{
|
||||
createOrUpdateGeometry(sceneInfo);
|
||||
mContentDirty = false;
|
||||
}
|
||||
|
||||
if (mMaterialIsDirty)
|
||||
{
|
||||
if (mHasFillColor)
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setFillColor(mFillColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setHasFillColor(false);
|
||||
}
|
||||
}
|
||||
if (mMaterialIsDirty)
|
||||
{
|
||||
if (mHasFillColor)
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setFillColor(mFillColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setHasFillColor(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (mHasStrokeColor)
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setStrokeColor(mStrokeColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setHasStrokeColor(false);
|
||||
}
|
||||
}
|
||||
mMaterialIsDirty = false;
|
||||
}
|
||||
if (mHasStrokeColor)
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setStrokeColor(mStrokeColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& geom_node : mGeometryNodes)
|
||||
{
|
||||
geom_node->setHasStrokeColor(false);
|
||||
}
|
||||
}
|
||||
mMaterialIsDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
void SvgNode::onCircle(XmlElement* element, std::unique_ptr<GeometryNode>& node)
|
||||
{
|
||||
auto svg_circle = dynamic_cast<SvgCircle*>(element);
|
||||
auto loc = svg_circle->getLocation();
|
||||
auto radius = svg_circle->getRadius();
|
||||
auto minor_radius = radius;
|
||||
auto svg_circle = dynamic_cast<SvgCircle*>(element);
|
||||
auto loc = svg_circle->getLocation();
|
||||
auto radius = svg_circle->getRadius();
|
||||
auto minor_radius = radius;
|
||||
|
||||
if (svg_circle->getType() == SvgCircle::Type::ELLIPSE)
|
||||
{
|
||||
minor_radius = svg_circle->getMinorRadius();
|
||||
}
|
||||
if (svg_circle->getType() == SvgCircle::Type::ELLIPSE)
|
||||
{
|
||||
minor_radius = svg_circle->getMinorRadius();
|
||||
}
|
||||
|
||||
if (element->hasAttribute("transform"))
|
||||
{
|
||||
const auto transform = svg_circle->getTransform();
|
||||
loc.move(transform.getLocation().getX(), transform.getLocation().getY());
|
||||
radius *= transform.getScaleX();
|
||||
minor_radius *= transform.getScaleY();
|
||||
}
|
||||
if (element->hasAttribute("transform"))
|
||||
{
|
||||
const auto transform = svg_circle->getTransform();
|
||||
loc.move(transform.getLocation().getX(), transform.getLocation().getY());
|
||||
radius *= transform.getScaleX();
|
||||
minor_radius *= transform.getScaleY();
|
||||
}
|
||||
|
||||
auto circle_node = std::make_unique<CircleNode>(loc, radius);
|
||||
circle_node->setMinorRadius(minor_radius);
|
||||
node = std::move(circle_node);
|
||||
auto circle_node = std::make_unique<CircleNode>(loc, radius);
|
||||
circle_node->setMinorRadius(minor_radius);
|
||||
node = std::move(circle_node);
|
||||
}
|
||||
|
||||
void SvgNode::onPath(XmlElement* element, std::unique_ptr<GeometryNode>& node)
|
||||
{
|
||||
auto svg_path = dynamic_cast<SvgPath*>(element);
|
||||
auto svg_path = dynamic_cast<SvgPath*>(element);
|
||||
|
||||
Point loc;
|
||||
auto path_node = std::make_unique<PathNode>(loc, svg_path->getPath());
|
||||
node = std::move(path_node);
|
||||
}
|
||||
Point loc;
|
||||
auto path_node = std::make_unique<PathNode>(loc, svg_path->getPath());
|
||||
node = std::move(path_node);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ std::unique_ptr<SvgDocument> SvgPainter::paint(Scene* scene, double width, doubl
|
|||
}
|
||||
}
|
||||
|
||||
return std::move(doc);
|
||||
return doc;
|
||||
}
|
||||
|
||||
void SvgPainter::paintMesh(SvgDocument* document, SceneModel* model, bool showOutline) const
|
||||
|
@ -161,7 +161,6 @@ void SvgPainter::paintCircle(SvgDocument* document, SceneModel* model) const
|
|||
{
|
||||
auto model_circle = dynamic_cast<Circle*>(model->getGeometry());
|
||||
|
||||
auto is_ellipse = model_circle->getMinorRadius() != model_circle->getRadius();
|
||||
auto circle = std::make_unique<SvgCircle>(model_circle->isEllipse() ? SvgCircle::Type::ELLIPSE : SvgCircle::Type::REGULAR);
|
||||
circle->setRadius(model_circle->getRadius());
|
||||
if (model_circle->isEllipse())
|
||||
|
@ -223,5 +222,5 @@ std::unique_ptr<XmlAttribute> SvgPainter::toTransform(const Transform& transform
|
|||
}
|
||||
svg_transform->setValue(ops);
|
||||
|
||||
return std::move(svg_transform);
|
||||
return svg_transform;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue