Mercurial > otakunoraifu
comparison window/render.cc @ 65:4416cfac86ae
Convert EUC-JP files to UTF8
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 26 Nov 2010 10:53:15 +0100 |
parents | e16e13d8cd68 |
children |
comparison
equal
deleted
inserted
replaced
64:045ca45f9610 | 65:4416cfac86ae |
---|---|
170 void DSurfaceMove(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o) { | 170 void DSurfaceMove(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o) { |
171 | 171 |
172 SDL_Surface* dst = (SDL_Surface*)dst_o; | 172 SDL_Surface* dst = (SDL_Surface*)dst_o; |
173 SDL_Surface* src = (SDL_Surface*)src_o; | 173 SDL_Surface* src = (SDL_Surface*)src_o; |
174 | 174 |
175 if (dst->format->BytesPerPixel != src->format->BytesPerPixel) return; // RGB変換はできない | 175 if (dst->format->BytesPerPixel != src->format->BytesPerPixel) return; // RGB紊с |
176 | 176 |
177 Rect srcrect(srcrect_o), dstrect(dstrect_o); | 177 Rect srcrect(srcrect_o), dstrect(dstrect_o); |
178 clip_rect(srcrect, dstrect, dst); | 178 clip_rect(srcrect, dstrect, dst); |
179 | 179 |
180 SDL_LockSurface(dst); SDL_LockSurface(src); | 180 SDL_LockSurface(dst); SDL_LockSurface(src); |
186 char* smem = src_o->mem(srcrect); | 186 char* smem = src_o->mem(srcrect); |
187 char* dmem = dst_o->mem(dstrect); | 187 char* dmem = dst_o->mem(dstrect); |
188 char* smem_end = src_o->mem_end(srcrect); | 188 char* smem_end = src_o->mem_end(srcrect); |
189 char* dmem_end = dst_o->mem_end(dstrect); | 189 char* dmem_end = dst_o->mem_end(dstrect); |
190 | 190 |
191 // メモリに重なりがあり、src が上位側の場合、コピー方向を逆転する | 191 // <≪src 筝篏眼翫潟惹劫荵≪ |
192 if (smem < dmem && dmem < smem_end) { | 192 if (smem < dmem && dmem < smem_end) { |
193 int i,j; | 193 int i,j; |
194 for (i=0; i<height; i++) { | 194 for (i=0; i<height; i++) { |
195 char* s = smem_end; char* d = dmem_end; | 195 char* s = smem_end; char* d = dmem_end; |
196 for (j=0; j<width; j++) | 196 for (j=0; j<width; j++) |
219 int ashift = dst->format->Ashift - dst->format->Aloss; | 219 int ashift = dst->format->Ashift - dst->format->Aloss; |
220 | 220 |
221 char* dmem = (char*)(dst->pixels) + rect.ty*dbpl + rect.lx*bpp; | 221 char* dmem = (char*)(dst->pixels) + rect.ty*dbpl + rect.lx*bpp; |
222 unsigned int pixel = SDL_MapRGBA(dst->format, r, g, b, 0); | 222 unsigned int pixel = SDL_MapRGBA(dst->format, r, g, b, 0); |
223 unsigned int pixela = SDL_MapRGBA(dst->format, r, g, b, a); | 223 unsigned int pixela = SDL_MapRGBA(dst->format, r, g, b, a); |
224 a += a>>7; /* 0-256 にする */ | 224 a += a>>7; /* 0-256 */ |
225 int i, j; | 225 int i, j; |
226 for (i=0; i<height; i++) { | 226 for (i=0; i<height; i++) { |
227 char* d = dmem; | 227 char* d = dmem; |
228 if (bpp == 4) { | 228 if (bpp == 4) { |
229 for (j=0; j<width; j++) { | 229 for (j=0; j<width; j++) { |
279 | 279 |
280 static void blit_line(Uint32* dest, Uint32* src, const unsigned char* alpha,int ax0, int ax1, int awidth, int aj0, int aj1, bool use_srcalpha) { | 280 static void blit_line(Uint32* dest, Uint32* src, const unsigned char* alpha,int ax0, int ax1, int awidth, int aj0, int aj1, bool use_srcalpha) { |
281 int j; | 281 int j; |
282 int ax = ax0; | 282 int ax = ax0; |
283 const unsigned char* a = alpha + ax0; | 283 const unsigned char* a = alpha + ax0; |
284 if (awidth == 1) { // わりとよくあるので最適化 | 284 if (awidth == 1) { // ф |
285 for (j=aj0; j < aj1; j++) { | 285 for (j=aj0; j < aj1; j++) { |
286 blit_pixel(dest++, src++, alpha, use_srcalpha); | 286 blit_pixel(dest++, src++, alpha, use_srcalpha); |
287 } | 287 } |
288 } | 288 } |
289 else | 289 else |
355 | 355 |
356 void DSurfaceBlitAdd(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o, unsigned char alpha) { | 356 void DSurfaceBlitAdd(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o, unsigned char alpha) { |
357 SDL_Surface* dst = (SDL_Surface*)dst_o; | 357 SDL_Surface* dst = (SDL_Surface*)dst_o; |
358 SDL_Surface* src = (SDL_Surface*)src_o; | 358 SDL_Surface* src = (SDL_Surface*)src_o; |
359 | 359 |
360 if (dst->format->BytesPerPixel != src->format->BytesPerPixel) return; // RGB変換はできない | 360 if (dst->format->BytesPerPixel != src->format->BytesPerPixel) return; // RGB紊с |
361 | 361 |
362 Rect srcrect(srcrect_o), dstrect(dstrect_o); | 362 Rect srcrect(srcrect_o), dstrect(dstrect_o); |
363 clip_rect(srcrect, dstrect, dst); | 363 clip_rect(srcrect, dstrect, dst); |
364 | 364 |
365 SDL_LockSurface(dst); SDL_LockSurface(src); | 365 SDL_LockSurface(dst); SDL_LockSurface(src); |
435 int height = srcrect.height(); | 435 int height = srcrect.height(); |
436 char* dmem = dst_o->mem(dstrect); | 436 char* dmem = dst_o->mem(dstrect); |
437 char* smem = src_o->mem(srcrect); | 437 char* smem = src_o->mem(srcrect); |
438 | 438 |
439 SDL_PixelFormat& fmt = *dst->format; | 439 SDL_PixelFormat& fmt = *dst->format; |
440 /* dst の 0-255 を 0-pixel に変換する(積算) */ | 440 /* dst 0-255 0-pixel 紊鐚腥膊鐚 */ |
441 int i; | 441 int i; |
442 int table1[256], table2[256], table3[256]; | 442 int table1[256], table2[256], table3[256]; |
443 Uint32 src_pixel = *(Uint32*)smem; | 443 Uint32 src_pixel = *(Uint32*)smem; |
444 src_pixel |= 0xff000000; | 444 src_pixel |= 0xff000000; |
445 int c1=src_pixel&255, c2=(src_pixel>>8)&255, c3=(src_pixel>>16)&255; | 445 int c1=src_pixel&255, c2=(src_pixel>>8)&255, c3=(src_pixel>>16)&255; |