remove useless code

This commit is contained in:
ExMix 2013-10-22 17:36:03 +03:00 committed by Alex Zolotarev
parent 014e9271f2
commit 0fcc1f38e7
5 changed files with 0 additions and 258 deletions

View file

@ -122,72 +122,5 @@ namespace graphics
texPts[2] = srcSurface->mapPixel(m2::PointF(texRect.maxX(), texRect.maxY()));
texPts[3] = srcSurface->mapPixel(m2::PointF(texRect.minX(), texRect.maxY()));
}
void Blitter::immDrawSolidRect(m2::RectF const & rect,
graphics::Color const & color)
{
immDrawRect(rect, m2::RectF(), shared_ptr<gl::RGBA8Texture>(), false, color, true);
}
void Blitter::immDrawRect(m2::RectF const & rect,
m2::RectF const & texRect,
shared_ptr<gl::BaseTexture> texture,
bool hasTexture,
graphics::Color const & color,
bool hasColor)
{
m2::PointF rectPoints[4] =
{
m2::PointF(rect.minX(), rect.minY()),
m2::PointF(rect.maxX(), rect.minY()),
m2::PointF(rect.maxX(), rect.maxY()),
m2::PointF(rect.minX(), rect.maxY())
};
m2::PointF texRectPoints[4] =
{
m2::PointF(texRect.minX(), texRect.minY()),
m2::PointF(texRect.maxX(), texRect.minY()),
m2::PointF(texRect.maxX(), texRect.maxY()),
m2::PointF(texRect.minX(), texRect.maxY()),
};
immDrawTexturedPrimitives(rectPoints, texRectPoints, 4, texture, hasTexture, color, hasColor);
}
void Blitter::immDrawTexturedRect(m2::RectF const & rect,
m2::RectF const & texRect,
shared_ptr<gl::BaseTexture> const & texture)
{
shared_ptr<IMMDrawTexturedRect> command(new IMMDrawTexturedRect(rect,
texRect,
texture,
resourceManager()));
processCommand(command);
}
void Blitter::immDrawTexturedPrimitives(m2::PointF const * pts,
m2::PointF const * texPts,
size_t size,
shared_ptr<gl::BaseTexture> const & texture,
bool hasTexture,
graphics::Color const & color,
bool hasColor)
{
shared_ptr<IMMDrawTexturedPrimitives> command(new IMMDrawTexturedPrimitives());
command->m_ptsCount = size;
command->m_pts.resize(size);
command->m_texPts.resize(size);
copy(pts, pts + size, command->m_pts.begin());
copy(texPts, texPts + size, command->m_texPts.begin());
command->m_texture = texture;
command->m_hasTexture = hasTexture;
command->m_color = color;
command->m_hasColor = hasColor;
command->m_resourceManager = resourceManager();
processCommand(command);
}
}

View file

@ -56,29 +56,6 @@ namespace graphics
size_t s,
bool isSubPixel,
double depth);
void immDrawSolidRect(m2::RectF const & rect,
Color const & color);
void immDrawRect(m2::RectF const & rect,
m2::RectF const & texRect,
shared_ptr<gl::BaseTexture> texture,
bool hasTexture,
Color const & color,
bool hasColor);
void immDrawTexturedPrimitives(m2::PointF const * pts,
m2::PointF const * texPts,
size_t size,
shared_ptr<gl::BaseTexture> const & texture,
bool hasTexture,
Color const & color,
bool hasColor);
void immDrawTexturedRect(m2::RectF const & rect,
m2::RectF const & texRect,
shared_ptr<gl::BaseTexture> const & texture);
/// @}
};
}

View file

@ -35,14 +35,6 @@ namespace
}
};
struct TestDrawSolidRect
{
void DoDraw(shared_ptr<graphics::Screen> p)
{
p->immDrawSolidRect(m2::RectF(0, 0, 100, 100), graphics::Color(255, 0, 0, 255));
}
};
struct TestDrawLine
{
void DoDraw(shared_ptr<graphics::Screen> p)
@ -1227,40 +1219,6 @@ namespace
}
};
struct TestDrawUtilsRect
{
void DoDraw(shared_ptr<graphics::Screen> p)
{
shared_ptr<graphics::gl::RGBA8Texture> texture(new graphics::gl::RGBA8Texture(512, 512));
texture->randomize();
p->immDrawRect(
m2::RectF(0, 0, 512, 512),
m2::RectF(0, 0, 1, 1),
texture,
true,
graphics::Color(255, 0, 0, 255),
false);
}
};
struct TestDrawUtilsRectFilledTexture
{
void DoDraw(shared_ptr<graphics::Screen> p)
{
shared_ptr<graphics::gl::RGBA8Texture> texture(new graphics::gl::RGBA8Texture(512, 512));
texture->fill(graphics::Color(0, 255, 0, 255));
p->immDrawRect(
m2::RectF(0, 0, 512, 512),
m2::RectF(0, 0, 1, 1),
texture,
true,
graphics::Color(255, 0, 0, 255),
false);
}
};
struct TestDrawOverlappedSymbolWithText
{
public:

View file

@ -152,110 +152,6 @@ namespace graphics
processCommand(make_shared_ptr(new UploadData(resources, count, texture)));
}
GeometryRenderer::IMMDrawTexturedRect::IMMDrawTexturedRect(
m2::RectF const & rect,
m2::RectF const & texRect,
shared_ptr<BaseTexture> const & texture,
shared_ptr<ResourceManager> const & rm)
{
m2::PointF rectPoints[4] =
{
m2::PointF(rect.minX(), rect.minY()),
m2::PointF(rect.maxX(), rect.minY()),
m2::PointF(rect.maxX(), rect.maxY()),
m2::PointF(rect.minX(), rect.maxY())
};
m2::PointF texRectPoints[4] =
{
m2::PointF(texRect.minX(), texRect.minY()),
m2::PointF(texRect.maxX(), texRect.minY()),
m2::PointF(texRect.maxX(), texRect.maxY()),
m2::PointF(texRect.minX(), texRect.maxY()),
};
m_pts.resize(4);
m_texPts.resize(4);
copy(rectPoints, rectPoints + 4, &m_pts[0]);
copy(texRectPoints, texRectPoints + 4, &m_texPts[0]);
m_ptsCount = 4;
m_texture = texture;
m_hasTexture = true;
m_hasColor = false;
m_color = graphics::Color(255, 255, 255, 255);
m_resourceManager = rm;
}
void GeometryRenderer::IMMDrawTexturedPrimitives::perform()
{
if (isDebugging())
LOG(LINFO, ("performing IMMDrawTexturedPrimitives command"));
TStoragePool * storagePool = m_resourceManager->storagePool(ESmallStorage);
graphics::gl::Storage blitStorage = storagePool->Reserve();
if (storagePool->IsCancelled())
{
LOG(LDEBUG, ("skipping IMMDrawTexturedPrimitives on cancelled multiBlitStorages pool"));
return;
}
if (!blitStorage.m_vertices->isLocked())
blitStorage.m_vertices->lock();
if (!blitStorage.m_indices->isLocked())
blitStorage.m_indices->lock();
Vertex * pointsData = (Vertex*)blitStorage.m_vertices->data();
for (size_t i = 0; i < m_ptsCount; ++i)
{
pointsData[i].pt.x = m_pts[i].x;
pointsData[i].pt.y = m_pts[i].y;
pointsData[i].depth = 0;
pointsData[i].tex.x = m_texPts[i].x;
pointsData[i].tex.y = m_texPts[i].y;
pointsData[i].normal.x = 0;
pointsData[i].normal.y = 0;
}
blitStorage.m_vertices->unlock();
gl::RenderContext * rc = static_cast<gl::RenderContext*>(renderContext());
ProgramManager * pm = rc->programManager();
shared_ptr<Program> prg = pm->getProgram(EVxTextured, EFrgNoAlphaTest);
prg->setParam(ESemModelView, rc->matrix(EModelView));
prg->setParam(ESemProjection, rc->matrix(EProjection));
prg->setParam(ESemSampler0, 0);
prg->setStorage(blitStorage);
prg->setVertexDecl(gl::Vertex::getVertexDecl());
prg->makeCurrent();
if (m_texture)
m_texture->makeCurrent();
unsigned short idxData[4] = {0, 1, 2, 3};
memcpy(blitStorage.m_indices->data(), idxData, sizeof(idxData));
blitStorage.m_indices->unlock();
OGLCHECK(glDisable(GL_BLEND));
OGLCHECK(glDisable(GL_DEPTH_TEST));
OGLCHECK(glDepthMask(GL_FALSE));
OGLCHECK(glDrawElements(GL_TRIANGLE_FAN,
4,
GL_UNSIGNED_SHORT,
blitStorage.m_indices->glPtr()));
blitStorage.m_vertices->discard();
blitStorage.m_indices->discard();
storagePool->Free(blitStorage);
}
void GeometryRenderer::DrawGeometry::perform()
{
if (isDebugging())

View file

@ -53,28 +53,6 @@ namespace graphics
void dump();
};
struct IMMDrawTexturedPrimitives : Command
{
buffer_vector<m2::PointF, 8> m_pts;
buffer_vector<m2::PointF, 8> m_texPts;
unsigned m_ptsCount;
shared_ptr<BaseTexture> m_texture;
bool m_hasTexture;
graphics::Color m_color;
bool m_hasColor;
shared_ptr<ResourceManager> m_resourceManager;
void perform();
};
struct IMMDrawTexturedRect : IMMDrawTexturedPrimitives
{
IMMDrawTexturedRect(m2::RectF const & rect,
m2::RectF const & texRect,
shared_ptr<BaseTexture> const & texture,
shared_ptr<ResourceManager> const & rm);
};
struct FreeStorage : public Command
{
TStoragePool * m_storagePool;