11 |
11 |
12 static FBlitter_32bppAnim iFBlitter_32bppAnim; |
12 static FBlitter_32bppAnim iFBlitter_32bppAnim; |
13 |
13 |
14 void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) |
14 void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) |
15 { |
15 { |
16 if (bp->dst < _screen.dst_ptr || bp->dst > (uint32 *)_screen.dst_ptr + _screen.width * _screen.height) { |
16 if (_screen_disable_anim) { |
17 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */ |
17 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */ |
18 Blitter_32bppOptimized::Draw(bp, mode, zoom); |
18 Blitter_32bppOptimized::Draw(bp, mode, zoom); |
19 return; |
19 return; |
20 } |
20 } |
21 |
21 |
96 } |
96 } |
97 } |
97 } |
98 |
98 |
99 void Blitter_32bppAnim::DrawColorMappingRect(void *dst, int width, int height, int pal) |
99 void Blitter_32bppAnim::DrawColorMappingRect(void *dst, int width, int height, int pal) |
100 { |
100 { |
|
101 if (_screen_disable_anim) { |
|
102 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColorMappingRect() */ |
|
103 Blitter_32bppOptimized::DrawColorMappingRect(dst, width, height, pal); |
|
104 return; |
|
105 } |
|
106 |
101 uint32 *udst = (uint32 *)dst; |
107 uint32 *udst = (uint32 *)dst; |
102 uint8 *anim; |
108 uint8 *anim; |
103 |
109 |
104 anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr); |
110 anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr); |
105 |
111 |
134 } |
140 } |
135 |
141 |
136 void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 color) |
142 void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 color) |
137 { |
143 { |
138 *((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(color); |
144 *((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(color); |
139 /* Set the color in the anim-buffer too */ |
145 |
|
146 /* Set the color in the anim-buffer too, if we are rendering to the screen */ |
|
147 if (_screen_disable_anim) return; |
140 this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color; |
148 this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color; |
141 } |
149 } |
142 |
150 |
143 void Blitter_32bppAnim::SetPixelIfEmpty(void *video, int x, int y, uint8 color) |
151 void Blitter_32bppAnim::SetPixelIfEmpty(void *video, int x, int y, uint8 color) |
144 { |
152 { |
145 uint32 *dst = (uint32 *)video + x + y * _screen.pitch; |
153 uint32 *dst = (uint32 *)video + x + y * _screen.pitch; |
146 if (*dst == 0) { |
154 if (*dst == 0) { |
147 *dst = LookupColourInPalette(color); |
155 *dst = LookupColourInPalette(color); |
148 /* Set the color in the anim-buffer too */ |
156 /* Set the color in the anim-buffer too, if we are rendering to the screen */ |
|
157 if (_screen_disable_anim) return; |
149 this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color; |
158 this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color; |
150 } |
159 } |
151 } |
160 } |
152 |
161 |
153 void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 color) |
162 void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 color) |
154 { |
163 { |
|
164 if (_screen_disable_anim) { |
|
165 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */ |
|
166 Blitter_32bppOptimized::DrawRect(video, width, height, color); |
|
167 return; |
|
168 } |
|
169 |
155 uint32 color32 = LookupColourInPalette(color); |
170 uint32 color32 = LookupColourInPalette(color); |
156 uint8 *anim_line; |
171 uint8 *anim_line; |
157 |
172 |
158 anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; |
173 anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; |
159 |
174 |
173 } while (--height); |
188 } while (--height); |
174 } |
189 } |
175 |
190 |
176 void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height) |
191 void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height) |
177 { |
192 { |
|
193 assert(!_screen_disable_anim); |
178 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
194 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
179 uint32 *dst = (uint32 *)video; |
195 uint32 *dst = (uint32 *)video; |
180 uint32 *usrc = (uint32 *)src; |
196 uint32 *usrc = (uint32 *)src; |
181 uint8 *anim_line; |
197 uint8 *anim_line; |
182 |
198 |
196 this->PaletteAnimate(217, _use_dos_palette ? 38 : 28); |
212 this->PaletteAnimate(217, _use_dos_palette ? 38 : 28); |
197 } |
213 } |
198 |
214 |
199 void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height) |
215 void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height) |
200 { |
216 { |
|
217 assert(!_screen_disable_anim); |
201 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
218 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
202 uint32 *udst = (uint32 *)dst; |
219 uint32 *udst = (uint32 *)dst; |
203 uint32 *src = (uint32 *)video; |
220 uint32 *src = (uint32 *)video; |
204 uint8 *anim_line; |
221 uint8 *anim_line; |
205 |
222 |
218 } |
235 } |
219 } |
236 } |
220 |
237 |
221 void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) |
238 void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) |
222 { |
239 { |
|
240 assert(!_screen_disable_anim); |
|
241 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
223 uint8 *dst, *src; |
242 uint8 *dst, *src; |
224 |
243 |
225 /* We need to scroll the anim-buffer too */ |
244 /* We need to scroll the anim-buffer too */ |
226 if (scroll_y > 0) { |
245 if (scroll_y > 0) { |
227 dst = this->anim_buf + left + (top + height - 1) * this->anim_buf_width; |
246 dst = this->anim_buf + left + (top + height - 1) * this->anim_buf_width; |
266 return width * height * (sizeof(uint32) + sizeof(uint8)); |
285 return width * height * (sizeof(uint32) + sizeof(uint8)); |
267 } |
286 } |
268 |
287 |
269 void Blitter_32bppAnim::PaletteAnimate(uint start, uint count) |
288 void Blitter_32bppAnim::PaletteAnimate(uint start, uint count) |
270 { |
289 { |
|
290 assert(!_screen_disable_anim); |
271 uint8 *anim = this->anim_buf; |
291 uint8 *anim = this->anim_buf; |
272 |
292 |
273 /* Never repaint the transparency pixel */ |
293 /* Never repaint the transparency pixel */ |
274 if (start == 0) start++; |
294 if (start == 0) start++; |
275 |
295 |