From 4cab6fc78e19799f223d951d5ccc9afb303b65f2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 Jun 2014 16:24:46 +0300 Subject: Remove duplicate code in renderers. --- src/render/graphicsdef.hpp | 4 ---- src/render/openglgraphicsdef.hpp | 4 ++++ src/render/sdl2graphics.cpp | 14 -------------- src/render/sdl2softwaregraphics.cpp | 14 -------------- src/render/sdlgraphics.cpp | 13 ------------- 5 files changed, 4 insertions(+), 45 deletions(-) (limited to 'src/render') diff --git a/src/render/graphicsdef.hpp b/src/render/graphicsdef.hpp index 29cdc4a0f..6d3511f6b 100644 --- a/src/render/graphicsdef.hpp +++ b/src/render/graphicsdef.hpp @@ -29,10 +29,6 @@ public: int w, int h, const ImageRect &imgRect); - bool drawNet(const int x1, const int y1, - const int x2, const int y2, - const int width, const int height) override final; - void beginDraw(); void endDraw(); diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp index e99c4cc62..4a48d919a 100644 --- a/src/render/openglgraphicsdef.hpp +++ b/src/render/openglgraphicsdef.hpp @@ -38,6 +38,10 @@ public: void drawRectangle(const Rect &rect, const bool filled); + bool drawNet(const int x1, const int y1, + const int x2, const int y2, + const int width, const int height) override final; + static void dumpSettings(); void prepareScreenshot() override final; diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index 38ddfe8d5..9c93c6e38 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -610,20 +610,6 @@ SDL_Surface *SDLGraphics::getScreenshot() return screenshot; } -bool SDLGraphics::drawNet(const int x1, const int y1, - const int x2, const int y2, - const int width, const int height) -{ - // +++ need use SDL_RenderDrawLines - for (int y = y1; y < y2; y += height) - drawLine(x1, y, x2, y); - - for (int x = x1; x < x2; x += width) - drawLine(x, y1, x, y2); - - return true; -} - void SDLGraphics::calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index 2efc5772e..8a5729027 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -800,20 +800,6 @@ SDL_Surface *SDL2SoftwareGraphics::getScreenshot() return screenshot; } -bool SDL2SoftwareGraphics::drawNet(const int x1, const int y1, - const int x2, const int y2, - const int width, const int height) -{ - // +++ need use SDL_RenderDrawLines - for (int y = y1; y < y2; y += height) - drawLine(x1, y, x2, y); - - for (int x = x1; x < x2; x += width) - drawLine(x, y1, x, y2); - - return true; -} - void SDL2SoftwareGraphics::calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 3581a526d..494e17e0e 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -801,19 +801,6 @@ SDL_Surface *SDLGraphics::getScreenshot() return screenshot; } -bool SDLGraphics::drawNet(const int x1, const int y1, - const int x2, const int y2, - const int width, const int height) -{ - for (int y = y1; y < y2; y += height) - drawLine(x1, y, x2, y); - - for (int x = x1; x < x2; x += width) - drawLine(x, y1, x, y2); - - return true; -} - void SDLGraphics::calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, -- cgit v1.2.3-60-g2f50