mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:20:04 +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
|
||||
{
|
||||
public:
|
||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
||||
explicit Impl(const std::shared_ptr<GlContext>& context) :
|
||||
context_ {context},
|
||||
shaderProgram_ {nullptr},
|
||||
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
||||
|
|
@ -69,6 +69,9 @@ public:
|
|||
|
||||
~Impl() {}
|
||||
|
||||
void UpdateBuffers();
|
||||
void Update(bool textureAtlasChanged);
|
||||
|
||||
std::shared_ptr<GlContext> context_;
|
||||
|
||||
bool dirty_ {false};
|
||||
|
|
@ -98,12 +101,9 @@ public:
|
|||
std::array<GLuint, 2> vbo_;
|
||||
|
||||
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))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace draw
|
|||
class PlacefileIcons : public DrawItem
|
||||
{
|
||||
public:
|
||||
explicit PlacefileIcons(std::shared_ptr<GlContext> context);
|
||||
explicit PlacefileIcons(const std::shared_ptr<GlContext>& context);
|
||||
~PlacefileIcons();
|
||||
|
||||
PlacefileIcons(const PlacefileIcons&) = delete;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ static const boost::gil::rgba8_pixel_t kBlack_ {0, 0, 0, 255};
|
|||
class PlacefileLines::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
||||
explicit Impl(const std::shared_ptr<GlContext>& context) :
|
||||
context_ {context},
|
||||
shaderProgram_ {nullptr},
|
||||
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
||||
|
|
@ -49,7 +49,8 @@ public:
|
|||
const float angle,
|
||||
const boost::gil::rgba8_pixel_t color,
|
||||
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();
|
||||
|
||||
std::shared_ptr<GlContext> context_;
|
||||
|
|
@ -79,7 +80,7 @@ public:
|
|||
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))
|
||||
{
|
||||
}
|
||||
|
|
@ -255,7 +256,7 @@ void PlacefileLines::FinishLines()
|
|||
}
|
||||
|
||||
void PlacefileLines::Impl::UpdateBuffers(
|
||||
std::shared_ptr<const gr::Placefile::LineDrawItem> di)
|
||||
const std::shared_ptr<const gr::Placefile::LineDrawItem>& di)
|
||||
{
|
||||
// Threshold value
|
||||
units::length::nautical_miles<double> threshold = di->threshold_;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace draw
|
|||
class PlacefileLines : public DrawItem
|
||||
{
|
||||
public:
|
||||
explicit PlacefileLines(std::shared_ptr<GlContext> context);
|
||||
explicit PlacefileLines(const std::shared_ptr<GlContext>& context);
|
||||
~PlacefileLines();
|
||||
|
||||
PlacefileLines(const PlacefileLines&) = delete;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ typedef std::array<GLdouble, kTessVertexSize_> TessVertexArray;
|
|||
class PlacefilePolygons::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
||||
explicit Impl(const std::shared_ptr<GlContext>& context) :
|
||||
context_ {context},
|
||||
shaderProgram_ {nullptr},
|
||||
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
||||
|
|
@ -115,7 +115,8 @@ public:
|
|||
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))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace draw
|
|||
class PlacefilePolygons : public DrawItem
|
||||
{
|
||||
public:
|
||||
explicit PlacefilePolygons(std::shared_ptr<GlContext> context);
|
||||
explicit PlacefilePolygons(const std::shared_ptr<GlContext>& context);
|
||||
~PlacefilePolygons();
|
||||
|
||||
PlacefilePolygons(const PlacefilePolygons&) = delete;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class PlacefileText::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(std::shared_ptr<GlContext> context,
|
||||
const std::string& placefileName) :
|
||||
explicit Impl(const std::shared_ptr<GlContext>& context,
|
||||
const std::string& placefileName) :
|
||||
context_ {context}, placefileName_ {placefileName}
|
||||
{
|
||||
}
|
||||
|
|
@ -63,8 +63,8 @@ public:
|
|||
std::vector<std::shared_ptr<const gr::Placefile::TextDrawItem>> newList_ {};
|
||||
};
|
||||
|
||||
PlacefileText::PlacefileText(std::shared_ptr<GlContext> context,
|
||||
const std::string& placefileName) :
|
||||
PlacefileText::PlacefileText(const std::shared_ptr<GlContext>& context,
|
||||
const std::string& placefileName) :
|
||||
DrawItem(context->gl()), p(std::make_unique<Impl>(context, placefileName))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ namespace draw
|
|||
class PlacefileText : public DrawItem
|
||||
{
|
||||
public:
|
||||
explicit PlacefileText(std::shared_ptr<GlContext> context,
|
||||
const std::string& placefileName);
|
||||
explicit PlacefileText(const std::shared_ptr<GlContext>& context,
|
||||
const std::string& placefileName);
|
||||
~PlacefileText();
|
||||
|
||||
PlacefileText(const PlacefileText&) = delete;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
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))
|
||||
{
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class DrawLayerImpl;
|
|||
class DrawLayer : public GenericLayer
|
||||
{
|
||||
public:
|
||||
explicit DrawLayer(std::shared_ptr<MapContext> context);
|
||||
explicit DrawLayer(const std::shared_ptr<MapContext>& context);
|
||||
virtual ~DrawLayer();
|
||||
|
||||
virtual void Initialize();
|
||||
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual void Deinitialize();
|
||||
|
||||
protected:
|
||||
void AddDrawItem(std::shared_ptr<gl::draw::DrawItem> drawItem);
|
||||
void AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem);
|
||||
|
||||
private:
|
||||
std::unique_ptr<DrawLayerImpl> p;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class PlacefileLayer::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(PlacefileLayer* self,
|
||||
std::shared_ptr<MapContext> context,
|
||||
const std::string& placefileName) :
|
||||
explicit Impl(PlacefileLayer* self,
|
||||
const std::shared_ptr<MapContext>& context,
|
||||
const std::string& placefileName) :
|
||||
self_ {self},
|
||||
placefileName_ {placefileName},
|
||||
placefileIcons_ {std::make_shared<gl::draw::PlacefileIcons>(context)},
|
||||
|
|
@ -53,8 +53,8 @@ public:
|
|||
std::shared_ptr<gl::draw::PlacefileText> placefileText_;
|
||||
};
|
||||
|
||||
PlacefileLayer::PlacefileLayer(std::shared_ptr<MapContext> context,
|
||||
const std::string& placefileName) :
|
||||
PlacefileLayer::PlacefileLayer(const std::shared_ptr<MapContext>& context,
|
||||
const std::string& placefileName) :
|
||||
DrawLayer(context),
|
||||
p(std::make_unique<PlacefileLayer::Impl>(this, context, placefileName))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ class PlacefileLayer : public DrawLayer
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlacefileLayer(std::shared_ptr<MapContext> context,
|
||||
const std::string& placefileName);
|
||||
explicit PlacefileLayer(const std::shared_ptr<MapContext>& context,
|
||||
const std::string& placefileName);
|
||||
~PlacefileLayer();
|
||||
|
||||
std::string placefile_name() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue