mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 03:30:05 +00:00
Clean up placefile shared pointer usage with const references
This commit is contained in:
parent
232fafc9fa
commit
9955c4ccbe
12 changed files with 33 additions and 31 deletions
|
|
@ -54,7 +54,7 @@ struct PlacefileIconInfo
|
||||||
class PlacefileIcons::Impl
|
class PlacefileIcons::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
explicit Impl(const std::shared_ptr<GlContext>& context) :
|
||||||
context_ {context},
|
context_ {context},
|
||||||
shaderProgram_ {nullptr},
|
shaderProgram_ {nullptr},
|
||||||
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
||||||
|
|
@ -69,6 +69,9 @@ public:
|
||||||
|
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
|
void UpdateBuffers();
|
||||||
|
void Update(bool textureAtlasChanged);
|
||||||
|
|
||||||
std::shared_ptr<GlContext> context_;
|
std::shared_ptr<GlContext> context_;
|
||||||
|
|
||||||
bool dirty_ {false};
|
bool dirty_ {false};
|
||||||
|
|
@ -98,12 +101,9 @@ public:
|
||||||
std::array<GLuint, 2> vbo_;
|
std::array<GLuint, 2> vbo_;
|
||||||
|
|
||||||
GLsizei numVertices_;
|
GLsizei numVertices_;
|
||||||
|
|
||||||
void UpdateBuffers();
|
|
||||||
void Update(bool textureAtlasChanged);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PlacefileIcons::PlacefileIcons(std::shared_ptr<GlContext> context) :
|
PlacefileIcons::PlacefileIcons(const std::shared_ptr<GlContext>& context) :
|
||||||
DrawItem(context->gl()), p(std::make_unique<Impl>(context))
|
DrawItem(context->gl()), p(std::make_unique<Impl>(context))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace draw
|
||||||
class PlacefileIcons : public DrawItem
|
class PlacefileIcons : public DrawItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PlacefileIcons(std::shared_ptr<GlContext> context);
|
explicit PlacefileIcons(const std::shared_ptr<GlContext>& context);
|
||||||
~PlacefileIcons();
|
~PlacefileIcons();
|
||||||
|
|
||||||
PlacefileIcons(const PlacefileIcons&) = delete;
|
PlacefileIcons(const PlacefileIcons&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ static const boost::gil::rgba8_pixel_t kBlack_ {0, 0, 0, 255};
|
||||||
class PlacefileLines::Impl
|
class PlacefileLines::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
explicit Impl(const std::shared_ptr<GlContext>& context) :
|
||||||
context_ {context},
|
context_ {context},
|
||||||
shaderProgram_ {nullptr},
|
shaderProgram_ {nullptr},
|
||||||
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
||||||
|
|
@ -49,7 +49,8 @@ public:
|
||||||
const float angle,
|
const float angle,
|
||||||
const boost::gil::rgba8_pixel_t color,
|
const boost::gil::rgba8_pixel_t color,
|
||||||
const GLint threshold);
|
const GLint threshold);
|
||||||
void UpdateBuffers(std::shared_ptr<const gr::Placefile::LineDrawItem>);
|
void
|
||||||
|
UpdateBuffers(const std::shared_ptr<const gr::Placefile::LineDrawItem>& di);
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
std::shared_ptr<GlContext> context_;
|
std::shared_ptr<GlContext> context_;
|
||||||
|
|
@ -79,7 +80,7 @@ public:
|
||||||
GLsizei numVertices_;
|
GLsizei numVertices_;
|
||||||
};
|
};
|
||||||
|
|
||||||
PlacefileLines::PlacefileLines(std::shared_ptr<GlContext> context) :
|
PlacefileLines::PlacefileLines(const std::shared_ptr<GlContext>& context) :
|
||||||
DrawItem(context->gl()), p(std::make_unique<Impl>(context))
|
DrawItem(context->gl()), p(std::make_unique<Impl>(context))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +256,7 @@ void PlacefileLines::FinishLines()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileLines::Impl::UpdateBuffers(
|
void PlacefileLines::Impl::UpdateBuffers(
|
||||||
std::shared_ptr<const gr::Placefile::LineDrawItem> di)
|
const std::shared_ptr<const gr::Placefile::LineDrawItem>& di)
|
||||||
{
|
{
|
||||||
// Threshold value
|
// Threshold value
|
||||||
units::length::nautical_miles<double> threshold = di->threshold_;
|
units::length::nautical_miles<double> threshold = di->threshold_;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace draw
|
||||||
class PlacefileLines : public DrawItem
|
class PlacefileLines : public DrawItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PlacefileLines(std::shared_ptr<GlContext> context);
|
explicit PlacefileLines(const std::shared_ptr<GlContext>& context);
|
||||||
~PlacefileLines();
|
~PlacefileLines();
|
||||||
|
|
||||||
PlacefileLines(const PlacefileLines&) = delete;
|
PlacefileLines(const PlacefileLines&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ typedef std::array<GLdouble, kTessVertexSize_> TessVertexArray;
|
||||||
class PlacefilePolygons::Impl
|
class PlacefilePolygons::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
explicit Impl(const std::shared_ptr<GlContext>& context) :
|
||||||
context_ {context},
|
context_ {context},
|
||||||
shaderProgram_ {nullptr},
|
shaderProgram_ {nullptr},
|
||||||
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
||||||
|
|
@ -115,7 +115,8 @@ public:
|
||||||
GLint currentThreshold_;
|
GLint currentThreshold_;
|
||||||
};
|
};
|
||||||
|
|
||||||
PlacefilePolygons::PlacefilePolygons(std::shared_ptr<GlContext> context) :
|
PlacefilePolygons::PlacefilePolygons(
|
||||||
|
const std::shared_ptr<GlContext>& context) :
|
||||||
DrawItem(context->gl()), p(std::make_unique<Impl>(context))
|
DrawItem(context->gl()), p(std::make_unique<Impl>(context))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace draw
|
||||||
class PlacefilePolygons : public DrawItem
|
class PlacefilePolygons : public DrawItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PlacefilePolygons(std::shared_ptr<GlContext> context);
|
explicit PlacefilePolygons(const std::shared_ptr<GlContext>& context);
|
||||||
~PlacefilePolygons();
|
~PlacefilePolygons();
|
||||||
|
|
||||||
PlacefilePolygons(const PlacefilePolygons&) = delete;
|
PlacefilePolygons(const PlacefilePolygons&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
class PlacefileText::Impl
|
class PlacefileText::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(std::shared_ptr<GlContext> context,
|
explicit Impl(const std::shared_ptr<GlContext>& context,
|
||||||
const std::string& placefileName) :
|
const std::string& placefileName) :
|
||||||
context_ {context}, placefileName_ {placefileName}
|
context_ {context}, placefileName_ {placefileName}
|
||||||
{
|
{
|
||||||
|
|
@ -63,7 +63,7 @@ public:
|
||||||
std::vector<std::shared_ptr<const gr::Placefile::TextDrawItem>> newList_ {};
|
std::vector<std::shared_ptr<const gr::Placefile::TextDrawItem>> newList_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
PlacefileText::PlacefileText(std::shared_ptr<GlContext> context,
|
PlacefileText::PlacefileText(const std::shared_ptr<GlContext>& context,
|
||||||
const std::string& placefileName) :
|
const std::string& placefileName) :
|
||||||
DrawItem(context->gl()), p(std::make_unique<Impl>(context, placefileName))
|
DrawItem(context->gl()), p(std::make_unique<Impl>(context, placefileName))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace draw
|
||||||
class PlacefileText : public DrawItem
|
class PlacefileText : public DrawItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PlacefileText(std::shared_ptr<GlContext> context,
|
explicit PlacefileText(const std::shared_ptr<GlContext>& context,
|
||||||
const std::string& placefileName);
|
const std::string& placefileName);
|
||||||
~PlacefileText();
|
~PlacefileText();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
std::uint64_t textureAtlasBuildCount_ {};
|
std::uint64_t textureAtlasBuildCount_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
DrawLayer::DrawLayer(std::shared_ptr<MapContext> context) :
|
DrawLayer::DrawLayer(const std::shared_ptr<MapContext>& context) :
|
||||||
GenericLayer(context), p(std::make_unique<DrawLayerImpl>(context))
|
GenericLayer(context), p(std::make_unique<DrawLayerImpl>(context))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +76,7 @@ void DrawLayer::Deinitialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawLayer::AddDrawItem(std::shared_ptr<gl::draw::DrawItem> drawItem)
|
void DrawLayer::AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem)
|
||||||
{
|
{
|
||||||
p->drawList_.push_back(drawItem);
|
p->drawList_.push_back(drawItem);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class DrawLayerImpl;
|
||||||
class DrawLayer : public GenericLayer
|
class DrawLayer : public GenericLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit DrawLayer(std::shared_ptr<MapContext> context);
|
explicit DrawLayer(const std::shared_ptr<MapContext>& context);
|
||||||
virtual ~DrawLayer();
|
virtual ~DrawLayer();
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
|
|
@ -23,7 +23,7 @@ public:
|
||||||
virtual void Deinitialize();
|
virtual void Deinitialize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddDrawItem(std::shared_ptr<gl::draw::DrawItem> drawItem);
|
void AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<DrawLayerImpl> p;
|
std::unique_ptr<DrawLayerImpl> p;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class PlacefileLayer::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(PlacefileLayer* self,
|
explicit Impl(PlacefileLayer* self,
|
||||||
std::shared_ptr<MapContext> context,
|
const std::shared_ptr<MapContext>& context,
|
||||||
const std::string& placefileName) :
|
const std::string& placefileName) :
|
||||||
self_ {self},
|
self_ {self},
|
||||||
placefileName_ {placefileName},
|
placefileName_ {placefileName},
|
||||||
|
|
@ -53,7 +53,7 @@ public:
|
||||||
std::shared_ptr<gl::draw::PlacefileText> placefileText_;
|
std::shared_ptr<gl::draw::PlacefileText> placefileText_;
|
||||||
};
|
};
|
||||||
|
|
||||||
PlacefileLayer::PlacefileLayer(std::shared_ptr<MapContext> context,
|
PlacefileLayer::PlacefileLayer(const std::shared_ptr<MapContext>& context,
|
||||||
const std::string& placefileName) :
|
const std::string& placefileName) :
|
||||||
DrawLayer(context),
|
DrawLayer(context),
|
||||||
p(std::make_unique<PlacefileLayer::Impl>(this, context, placefileName))
|
p(std::make_unique<PlacefileLayer::Impl>(this, context, placefileName))
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class PlacefileLayer : public DrawLayer
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PlacefileLayer(std::shared_ptr<MapContext> context,
|
explicit PlacefileLayer(const std::shared_ptr<MapContext>& context,
|
||||||
const std::string& placefileName);
|
const std::string& placefileName);
|
||||||
~PlacefileLayer();
|
~PlacefileLayer();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue