ScummVM API documentation
edge.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef GRAPHICS_SCALER_EDGE_H
22 #define GRAPHICS_SCALER_EDGE_H
23 
24 #include "graphics/scalerplugin.h"
25 
26 class EdgeScaler : public SourceScaler {
27 public:
28 
29  EdgeScaler(const Graphics::PixelFormat &format);
30  uint increaseFactor() override;
31  uint decreaseFactor() override;
32 
33 protected:
34 
35  virtual void internScale(const uint8 *srcPtr, uint32 srcPitch,
36  uint8 *dstPtr, uint32 dstPitch,
37  const uint8 *oldSrcPtr, uint32 oldSrcPitch,
38  int width, int height, const uint8 *buffer, uint32 bufferPitch) override;
39 
40 private:
41 
66  template<typename ColorMask>
67  int16 *chooseGreyscale(typename ColorMask::PixelType *pixels);
68 
75  template<typename ColorMask>
76  int32 calcPixelDiffNosqrt(typename ColorMask::PixelType pixel1, typename ColorMask::PixelType pixel2);
77 
91  int findPrincipleAxis(int16 *diffs, int16 *bplane,
92  int8 *sim,
93  int32 *return_angle);
94 
98  template<typename Pixel>
99  int checkArrows(int best_dir, Pixel *pixels, int8 *sim, int half_flag);
100 
108  template<typename Pixel>
109  int refineDirection(char edge_type, Pixel *pixels, int16 *bptr,
110  int8 *sim, double angle);
111 
115  template<typename Pixel>
116  int fixKnights(int sub_type, Pixel *pixels, int8 *sim);
117 
121  void initTables(const uint8 *srcPtr, uint32 srcPitch,
122  int width, int height);
123 
127  template<typename ColorMask>
128  void antiAliasGrid2x(uint8 *dptr, int dstPitch,
129  typename ColorMask::PixelType *pixels, int sub_type, int16 *bptr,
130  int8 *sim,
131  int interpolate_2x);
132 
136  template<typename ColorMask>
137  void antiAliasGridClean3x(uint8 *dptr, int dstPitch,
138  typename ColorMask::PixelType *pixels, int sub_type, int16 *bptr);
139 
143  template<typename ColorMask>
144  void antiAliasPass2x(const uint8 *src, uint8 *dst,
145  int w, int h,
146  int srcPitch, int dstPitch,
147  int interpolate_2x,
148  bool haveOldSrc,
149  const uint8 *oldSrc, int oldSrcPitch,
150  const uint8 *buffer, int bufferPitch);
151 
155  template<typename ColorMask>
156  void antiAliasPass3x(const uint8 *src, uint8 *dst,
157  int w, int h,
158  int srcPitch, int dstPitch,
159  bool haveOldSrc,
160  const uint8* oldSrc, int oldPitch,
161  const uint8 *buffer, int bufferPitch);
162 
163  int16 _rgbTable[65536][3];
164  int16 _greyscaleTable[3][65536];
165  int16 *_chosenGreyscale;
166  int16 *_bptr;
167  int8 _simSum;
168  int16 _greyscaleDiffs[3][8];
169  int16 _bplanes[3][9];
170 };
171 
172 
173 #endif
Definition: scalerplugin.h:112
Definition: edge.h:26
Definition: pixelformat.h:138
uint increaseFactor() override
uint decreaseFactor() override
virtual void internScale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, const uint8 *oldSrcPtr, uint32 oldSrcPitch, int width, int height, const uint8 *buffer, uint32 bufferPitch) override