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