[drape] review fix

This commit is contained in:
ExMix 2014-04-09 13:48:12 +03:00 committed by Alex Zolotarev
parent 148c981742
commit cc0787c79f
3 changed files with 25 additions and 35 deletions

View file

@ -27,7 +27,7 @@ void Blending::Apply() const
GLFunctions::glDisable(GLConst::GLBlending);
}
bool Blending::operator < (const Blending & other) const
bool Blending::operator < (Blending const & other) const
{
if (m_isEnabled != other.m_isEnabled)
return m_isEnabled < other.m_isEnabled;
@ -39,7 +39,7 @@ bool Blending::operator < (const Blending & other) const
return m_blendDstFactor < other.m_blendDstFactor;
}
bool Blending::operator == (const Blending & other) const
bool Blending::operator == (Blending const & other) const
{
return m_isEnabled == other.m_isEnabled &&
m_blendFunction == other.m_blendFunction &&
@ -56,59 +56,39 @@ GLState::GLState(uint32_t gpuProgramIndex, DepthLayer depthLayer)
{
}
const GLState::DepthLayer &GLState::GetDepthLayer() const
{
return m_depthLayer;
}
void GLState::SetTextureSet(int32_t textureSet)
{
m_mask |= TEXTURE_BIT;
m_textureSet = textureSet;
}
int32_t GLState::GetTextureSet() const
{
return m_textureSet;
}
bool GLState::HasTextureSet() const
{
return (m_mask & TEXTURE_BIT) != 0;
}
void GLState::SetColor(const Color & c)
void GLState::SetColor(Color const & c)
{
m_mask |= COLOR_BIT;
m_color = c;
}
const Color & GLState::GetColor() const
{
return m_color;
}
bool GLState::HasColor() const
{
return (m_mask & COLOR_BIT) != 0;
}
void GLState::SetBlending(const Blending & blending)
void GLState::SetBlending(Blending const & blending)
{
m_blending = blending;
}
const Blending & GLState::GetBlending() const
{
return m_blending;
}
int GLState::GetProgramIndex() const
{
return m_gpuProgramIndex;
}
bool GLState::operator<(const GLState & other) const
bool GLState::operator<(GLState const & other) const
{
if (m_mask != other.m_mask)
return m_mask < other.m_mask;
@ -126,13 +106,13 @@ bool GLState::operator<(const GLState & other) const
namespace
{
void ApplyUniformValue(const UniformValue & value, RefPointer<GpuProgram> program)
void ApplyUniformValue(UniformValue const & value, RefPointer<GpuProgram> program)
{
value.Apply(program);
}
}
void ApplyUniforms(const UniformValuesStorage & uniforms, RefPointer<GpuProgram> program)
void ApplyUniforms(UniformValuesStorage const & uniforms, RefPointer<GpuProgram> program)
{
uniforms.ForeachValue(bind(&ApplyUniformValue, _1, program));
}

View file

@ -31,22 +31,22 @@ public:
GLState(uint32_t gpuProgramIndex, DepthLayer depthLayer);
DepthLayer const & GetDepthLayer() const;
DepthLayer const & GetDepthLayer() const { return m_depthLayer; }
void SetTextureSet(int32_t textureSet);
int32_t GetTextureSet() const;
int32_t GetTextureSet() const { return m_textureSet; }
bool HasTextureSet() const;
void SetColor(Color const & c);
Color const & GetColor() const;
Color const & GetColor() const { return m_color; }
bool HasColor() const;
void SetBlending(Blending const & blending);
const Blending & GetBlending() const;
const Blending & GetBlending() const { return m_blending; }
int GetProgramIndex() const;
int GetProgramIndex() const { return m_gpuProgramIndex; }
bool operator<(const GLState & other) const;
bool operator<(GLState const & other) const;
private:
uint32_t m_gpuProgramIndex;
@ -58,5 +58,5 @@ private:
uint32_t m_mask;
};
void ApplyUniforms(const UniformValuesStorage & uniforms, RefPointer<GpuProgram> program);
void ApplyUniforms(UniformValuesStorage const & uniforms, RefPointer<GpuProgram> program);
void ApplyState(GLState state, RefPointer<GpuProgram> program, RefPointer<TextureSetController> textures);

View file

@ -14,10 +14,20 @@ void OverlayTree::Add(RefPointer<OverlayHandle> handle)
m2::RectD pixelRect = handle->GetPixelRect(m_modelView);
find_result_t elements;
/*
* Find elements that already on OverlayTree and it's pixel rect
* intersect with handle pixel rect ("Intersected elements")
*/
FindIntersectedFunctor f(pixelRect, elements);
m_tree.for_each(f);
double inputPriority = handle->GetPriority();
/*
* In this loop we decide which element must be visible
* If input element "handle" more priority than all "Intersected elements"
* than we remove all "Intersected elements" and insert input element "handle"
* But if some of already inserted elements more priority than we don't insert "handle"
*/
for (find_result_t::const_iterator it = elements.begin(); it != elements.end(); ++it)
{
if (inputPriority < (*it)->m_nodeValue->GetPriority())
@ -88,7 +98,7 @@ void OverlayTree::FindIntersectedFunctor::operator()(OverlayTree::Node const & n
m2::RectD const & r = base_t::m_rect;
bool isIntersect = !((node.m_pts[2] <= r.minX()) || (node.m_pts[0] >= r.maxX()) ||
(node.m_pts[3] <= r.minY()) || (node.m_pts[1] >= r.maxY()));
(node.m_pts[3] <= r.minY()) || (node.m_pts[1] >= r.maxY()));
if (isIntersect)
m_intersections.push_back(&node);
}