GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/render/surfacegraphics.h Lines: 0 50 0.0 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2004-2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  The Mana Developers
5
 *  Copyright (C) 2011-2017  The ManaPlus Developers
6
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#ifndef RENDER_SURFACEGRAPHICS_H
24
#define RENDER_SURFACEGRAPHICS_H
25
26
#include "enums/render/blitmode.h"
27
28
#include "render/graphics.h"
29
30
#include "localconsts.h"
31
32
class Image;
33
class ImageCollection;
34
class ImageVertexes;
35
36
/**
37
 * A central point of control for graphics.
38
 */
39
class SurfaceGraphics final : public Graphics
40
{
41
    public:
42
        SurfaceGraphics();
43
44
        A_DELETE_COPY(SurfaceGraphics)
45
46
        ~SurfaceGraphics();
47
48
        void setTarget(SDL_Surface *restrict const target) restrict2 noexcept2
49
        { mTarget = target; }
50
51
        SDL_Surface *getTarget() const restrict2 noexcept2
52
        { return mTarget; }
53
54
        void beginDraw() restrict2 override final
55
        { }
56
57
        void endDraw() restrict2 override final
58
        { }
59
60
        void pushClipArea(const Rect &restrict rect A_UNUSED)
61
                          restrict2 override final
62
        { }
63
64
        void popClipArea() restrict2 override final
65
        { }
66
67
        void drawRescaledImage(const Image *restrict const image A_UNUSED,
68
                               int dstX A_UNUSED, int dstY A_UNUSED,
69
                               const int desiredWidth A_UNUSED,
70
                               const int desiredHeight A_UNUSED)
71
                               restrict2 override final
72
        { }
73
74
        void drawPattern(const Image *restrict const image A_UNUSED,
75
                         const int x A_UNUSED,
76
                         const int y A_UNUSED,
77
                         const int w A_UNUSED,
78
                         const int h A_UNUSED) restrict2 override final
79
        { }
80
81
        void drawRescaledPattern(const Image *const image A_UNUSED,
82
                                 const int x A_UNUSED,
83
                                 const int y A_UNUSED,
84
                                 const int w A_UNUSED,
85
                                 const int h A_UNUSED,
86
                                 const int scaledWidth A_UNUSED,
87
                                 const int scaledHeight A_UNUSED)
88
                                 override final
89
        { }
90
91
        void calcPattern(ImageVertexes *restrict const vert A_UNUSED,
92
                         const Image *restrict const image A_UNUSED,
93
                         const int x A_UNUSED,
94
                         const int y A_UNUSED,
95
                         const int w A_UNUSED,
96
                         const int h A_UNUSED) const restrict2 override final
97
        { }
98
99
        void calcPattern(ImageCollection *restrict const vert A_UNUSED,
100
                         const Image *restrict const image A_UNUSED,
101
                         const int x A_UNUSED,
102
                         const int y A_UNUSED,
103
                         const int w A_UNUSED,
104
                         const int h A_UNUSED) const restrict2 override final
105
        { }
106
107
        void calcTileVertexes(ImageVertexes *restrict const vert A_UNUSED,
108
                              const Image *restrict const image A_UNUSED,
109
                              int x A_UNUSED,
110
                              int y A_UNUSED) const restrict2 override final
111
                              A_NONNULL(2, 3)
112
        { }
113
114
        void calcTileSDL(ImageVertexes *restrict const vert A_UNUSED,
115
                         int x A_UNUSED,
116
                         int y A_UNUSED) const restrict2 override final
117
        { }
118
119
        void calcTileCollection(ImageCollection *restrict const
120
                                vertCol A_UNUSED,
121
                                const Image *restrict const image A_UNUSED,
122
                                int x A_UNUSED,
123
                                int y A_UNUSED) restrict2 override final
124
        { }
125
126
        void drawTileVertexes(const ImageVertexes *restrict const
127
                              vert A_UNUSED) restrict2 override final
128
        { }
129
130
        void drawTileCollection(const ImageCollection *restrict const
131
                                vertCol A_UNUSED)
132
                                restrict2 override final A_NONNULL(2)
133
        { }
134
135
        void updateScreen() override final
136
        { }
137
138
        void drawNet(const int x1 A_UNUSED,
139
                     const int y1 A_UNUSED,
140
                     const int x2 A_UNUSED,
141
                     const int y2 A_UNUSED,
142
                     const int width A_UNUSED,
143
                     const int height A_UNUSED) restrict2 override final
144
        { }
145
146
        void calcWindow(ImageCollection *restrict const vertCol A_UNUSED,
147
                        const int x A_UNUSED, const int y A_UNUSED,
148
                        const int w A_UNUSED, const int h A_UNUSED,
149
                        const ImageRect &restrict imgRect A_UNUSED)
150
                        restrict2 override final A_NONNULL(2)
151
        { }
152
153
        void setBlitMode(const BlitModeT mode) restrict2 noexcept2
154
        { mBlitMode = mode; }
155
156
        BlitModeT getBlitMode() const restrict2 noexcept2 A_WARN_UNUSED
157
        { return mBlitMode; }
158
159
        void fillRectangle(const Rect &restrict rect A_UNUSED)
160
                           restrict2 override final
161
        { }
162
163
        void drawRectangle(const Rect &restrict rect A_UNUSED)
164
                           restrict2 override final
165
        { }
166
167
        void drawPoint(int x A_UNUSED, int y A_UNUSED) restrict2 override final
168
        { }
169
170
        void drawLine(int x1 A_UNUSED, int y1 A_UNUSED,
171
                      int x2 A_UNUSED, int y2 A_UNUSED)
172
                      restrict2 override final
173
        { }
174
175
        bool setVideoMode(const int w A_UNUSED, const int h A_UNUSED,
176
                          const int scale A_UNUSED,
177
                          const int bpp A_UNUSED,
178
                          const bool fs A_UNUSED, const bool hwaccel A_UNUSED,
179
                          const bool resize A_UNUSED,
180
                          const bool noFrame A_UNUSED,
181
                          const bool allowHighDPI A_UNUSED)
182
                          restrict2 override final
183
        { return false; }
184
185
        void drawImage(const Image *restrict const image,
186
                       int dstX, int dstY) restrict2 override final;
187
188
        void copyImage(const Image *restrict const image,
189
                       int dstX, int dstY) restrict2 override final;
190
191
        void drawImageCached(const Image *restrict const image,
192
                             int x, int y) restrict2 override final;
193
194
        void drawPatternCached(const Image *restrict const image A_UNUSED,
195
                               const int x A_UNUSED,
196
                               const int y A_UNUSED,
197
                               const int w A_UNUSED,
198
                               const int h A_UNUSED) restrict2 override final
199
        { }
200
201
        void completeCache() restrict2 override final;
202
203
        /**
204
         * Draws a rectangle using images. 4 corner images, 4 side images and 1
205
         * image for the inside.
206
         */
207
        void drawImageRect(const int x A_UNUSED, const int y A_UNUSED,
208
                           const int w A_UNUSED, const int h A_UNUSED,
209
                           const ImageRect &restrict imgRect A_UNUSED)
210
                           restrict2 override final
211
        { }
212
213
    protected:
214
        BlitModeT mBlitMode;
215
        SDL_Surface *mTarget;
216
};
217
218
#endif  // RENDER_SURFACEGRAPHICS_H