ScummVM API documentation
scale.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 
22 #ifndef NUVIE_SCREEN_SCALE_H
23 #define NUVIE_SCREEN_SCALE_H
24 
25 #include "ultima/shared/std/string.h"
26 
27 namespace Ultima {
28 namespace Nuvie {
29 
30 #define SCALER_FLAG_2X_ONLY 1
31 #define SCALER_FLAG_16BIT_ONLY 2
32 #define SCALER_FLAG_32BIT_ONLY 4
33 
34 struct ScalerStruct {
35  typedef void (*ScalerType16)(uint16 *, int , int , int , int , const int , const int , uint16 *, const int, int);
36  typedef void (*ScalerType32)(uint32 *, int , int , int , int , const int , const int , uint32 *, const int, int);
37 
38  const char *name;
39  uint32 flags; // Scaler flags
40 
41  ScalerType16 scale16;
42  ScalerType16 scale555;
43  ScalerType16 scale565;
44 
45  ScalerType32 scale32;
46  ScalerType32 scale888;
47 
48  // Call this to scale a section of the screen
49  inline void Scale(
50  int type, // Format type of buffers 16, 555, 565, 32 or 888
51  void *source, // ->source pixels.
52  int srcx, int srcy, // Start of rectangle within src.
53  int srcw, int srch, // Dims. of rectangle.
54  const int sline_pixels, // Pixels /line for source.
55  const int sheight, // Source height.
56  void *dest, // ->dest pixels.
57  const int dline_pixels, // Pixels /line for dest.
58  int scale_factor // Scale factor
59  ) const {
60  if (type == 16) {
61  scale16((uint16 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint16 *) dest, dline_pixels, scale_factor);
62  } else if (type == 555) {
63  scale16((uint16 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint16 *) dest, dline_pixels, scale_factor);
64  } else if (type == 565) {
65  scale16((uint16 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint16 *) dest, dline_pixels, scale_factor);
66  } else if (type == 32) {
67  scale32((uint32 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint32 *) dest, dline_pixels, scale_factor);
68  } else if (type == 888) {
69  scale888((uint32 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint32 *) dest, dline_pixels, scale_factor);
70  }
71  }
72 
73 };
74 
75 //
76 // This entire class is just static
77 //
79  static const ScalerStruct scaler_array[];
80  int num_scalers;
81 
82 public:
83 
84  // Constructor
86 
87  // Destructor
88  ~ScalerRegistry();
89 
90  // Get the total Number of scalers
91  int GetNumScalers() {
92  return num_scalers;
93  }
94 
95  // Get the Scaler Index from it's name
96  int GetIndexForName(const Std::string &name);
97 
98  // Get Name of a Scaler from its Index
99  const char *GetNameForIndex(int index);
100 
101  // Get a Scaler from it's Index
102  const ScalerStruct *GetScaler(int index);
103 
104  // Get the Point Sampling Scaler
105  const ScalerStruct *GetPointScaler();
106 };
107 
108 } // End of namespace Nuvie
109 } // End of namespace Ultima
110 
111 #endif
Definition: scale.h:78
Definition: scale.h:34
Definition: detection.h:27
Definition: string.h:30