1 //  SuperTux
2 //  Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_VIDEO_SDL_SDL_PAINTER_HPP
18 #define HEADER_SUPERTUX_VIDEO_SDL_SDL_PAINTER_HPP
19 
20 #include "video/painter.hpp"
21 
22 #include <boost/optional.hpp>
23 
24 class Renderer;
25 class SDLScreenRenderer;
26 class SDLVideoSystem;
27 struct DrawingRequest;
28 struct SDL_Renderer;
29 
30 class SDLPainter final : public Painter
31 {
32 public:
33   SDLPainter(SDLVideoSystem& video_system, Renderer& renderer, SDL_Renderer* sdl_renderer);
34 
35   virtual void draw_texture(const TextureRequest& request) override;
36   virtual void draw_gradient(const GradientRequest& request) override;
37   virtual void draw_filled_rect(const FillRectRequest& request) override;
38   virtual void draw_inverse_ellipse(const InverseEllipseRequest& request) override;
39   virtual void draw_line(const LineRequest& request) override;
40   virtual void draw_triangle(const TriangleRequest& request) override;
41 
42   virtual void clear(const Color& color) override;
43   virtual void get_pixel(const GetPixelRequest& request) const override;
44 
45   virtual void set_clip_rect(const Rect& rect) override;
46   virtual void clear_clip_rect() override;
47 
48 private:
49   SDLVideoSystem& m_video_system;
50   Renderer& m_renderer;
51   SDL_Renderer* m_sdl_renderer;
52   boost::optional<SDL_Rect> m_cliprect;
53 
54 private:
55   SDLPainter(const SDLPainter&) = delete;
56   SDLPainter& operator=(const SDLPainter&) = delete;
57 };
58 
59 #endif
60 
61 /* EOF */
62