diff --git a/graphics/blitter.cpp b/graphics/blitter.cpp index f46ea8f047..a3762541eb 100644 --- a/graphics/blitter.cpp +++ b/graphics/blitter.cpp @@ -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(), false, color, true); - } - - void Blitter::immDrawRect(m2::RectF const & rect, - m2::RectF const & texRect, - shared_ptr 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 const & texture) - { - shared_ptr 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 const & texture, - bool hasTexture, - graphics::Color const & color, - bool hasColor) - { - shared_ptr 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); - } } diff --git a/graphics/blitter.hpp b/graphics/blitter.hpp index 7fd5862c13..b4fa7f45ba 100644 --- a/graphics/blitter.hpp +++ b/graphics/blitter.hpp @@ -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 texture, - bool hasTexture, - Color const & color, - bool hasColor); - - void immDrawTexturedPrimitives(m2::PointF const * pts, - m2::PointF const * texPts, - size_t size, - shared_ptr const & texture, - bool hasTexture, - Color const & color, - bool hasColor); - - void immDrawTexturedRect(m2::RectF const & rect, - m2::RectF const & texRect, - shared_ptr const & texture); - /// @} }; } diff --git a/graphics/graphics_tests/screengl_test.cpp b/graphics/graphics_tests/screengl_test.cpp index 24265506e9..9c87410d71 100644 --- a/graphics/graphics_tests/screengl_test.cpp +++ b/graphics/graphics_tests/screengl_test.cpp @@ -35,14 +35,6 @@ namespace } }; - struct TestDrawSolidRect - { - void DoDraw(shared_ptr p) - { - p->immDrawSolidRect(m2::RectF(0, 0, 100, 100), graphics::Color(255, 0, 0, 255)); - } - }; - struct TestDrawLine { void DoDraw(shared_ptr p) @@ -1227,40 +1219,6 @@ namespace } }; - struct TestDrawUtilsRect - { - void DoDraw(shared_ptr p) - { - shared_ptr 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 p) - { - shared_ptr 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: diff --git a/graphics/opengl/geometry_renderer.cpp b/graphics/opengl/geometry_renderer.cpp index 64c2e8e9c5..2fc0c23776 100644 --- a/graphics/opengl/geometry_renderer.cpp +++ b/graphics/opengl/geometry_renderer.cpp @@ -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 const & texture, - shared_ptr 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(renderContext()); - ProgramManager * pm = rc->programManager(); - shared_ptr 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()) diff --git a/graphics/opengl/geometry_renderer.hpp b/graphics/opengl/geometry_renderer.hpp index f8cc53c4c4..d8da1669de 100644 --- a/graphics/opengl/geometry_renderer.hpp +++ b/graphics/opengl/geometry_renderer.hpp @@ -53,28 +53,6 @@ namespace graphics void dump(); }; - struct IMMDrawTexturedPrimitives : Command - { - buffer_vector m_pts; - buffer_vector m_texPts; - unsigned m_ptsCount; - shared_ptr m_texture; - bool m_hasTexture; - graphics::Color m_color; - bool m_hasColor; - shared_ptr m_resourceManager; - - void perform(); - }; - - struct IMMDrawTexturedRect : IMMDrawTexturedPrimitives - { - IMMDrawTexturedRect(m2::RectF const & rect, - m2::RectF const & texRect, - shared_ptr const & texture, - shared_ptr const & rm); - }; - struct FreeStorage : public Command { TStoragePool * m_storagePool;