Mercurial > otakunoraifu
diff window/render.cc @ 52:15a18fbe6f21
* Known bugs added to the README
* Code cleaning (0 -> NULL when needed, indentation, spaces, ...)
author | thib |
---|---|
date | Sat, 18 Apr 2009 18:35:39 +0000 |
parents | 223b71206888 |
children | c7bcc0ec2267 |
line wrap: on
line diff
--- a/window/render.cc +++ b/window/render.cc @@ -25,12 +25,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include"font/font.h" -#include"font/text.h" -#include"rect.h" -#include"SDL.h" -#include"surface.h" -#include<stdio.h> +#include "font/font.h" +#include "font/text.h" +#include "rect.h" +#include "SDL.h" +#include "surface.h" +#include <stdio.h> Rect DSurfaceRenderText(TextGlyphStream::iterator start, TextGlyphStream::iterator end, const Rect& srcrect, Surface* dst, const Rect& dstrect); // 文字描画 @@ -58,9 +58,11 @@ Rect::Rect(const class Surface& so) { lx = 0; ty = 0; rx = s->w; by = s->h; } + inline Rect _Rect(const SDL_Rect& r) { return Rect(r.x, r.y, r.x+r.w, r.y+r.h); -}; +} + inline SDL_Rect SDLed(const Rect& rect) { SDL_Rect r; r.x = rect.lx; @@ -151,11 +153,11 @@ Rect DSurfaceRenderText(TextGlyphStream: drawn_rect.rmove(dif_x, dif_y); return drawn_rect; } + void DSurfaceFill(Surface* src_o, const Rect& rect, int r, int g, int b, int a) { SDL_Rect sr = SDLed(rect); SDL_Surface* src = (SDL_Surface*)src_o; SDL_FillRect( src, &sr, SDL_MapRGBA(src->format, r, g, b, a)); - return; } static void clip_rect(Rect& srcrect, Rect& dstrect, SDL_Surface* dstsurf) { @@ -212,7 +214,6 @@ void DSurfaceMove(Surface* src_o, const } SDL_UnlockSurface(dst); SDL_UnlockSurface(src); - return; } void DSurfaceFillA(Surface* dsto, const Rect& rect, int r, int g, int b, int a) { @@ -229,7 +230,7 @@ void DSurfaceFillA(Surface* dsto, const unsigned int pixel = SDL_MapRGBA(dst->format, r, g, b, 0); unsigned int pixela = SDL_MapRGBA(dst->format, r, g, b, a); a += a>>7; /* 0-256 にする */ - int i,j; + int i, j; for (i=0; i<height; i++) { char* d = dmem; if (bpp == 4) { @@ -252,7 +253,6 @@ void DSurfaceFillA(Surface* dsto, const dmem += dbpl; } SDL_UnlockSurface( dst); - return; } #define ASHIFT 24 @@ -279,6 +279,7 @@ inline void blit_pixel(Uint32* dmem, Uin d = (d + (((s-d) * as) >> 8)) & CMASK2; *dmem = d1 | d | 0xff000000; } + static void blit_line(Uint32* dmem, Uint32* smem, const unsigned char* amem,int ax0, int ax1, int awidth, int aj0, int aj1, bool use_srcalpha) { int j; int ax = ax0; @@ -351,8 +352,8 @@ void DSurfaceBlitAlpha(Surface* src_o, c } SDL_UnlockSurface(src); SDL_UnlockSurface(dst); - return; } + void DSurfaceBlitSaturate(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o, unsigned char alpha) { SDL_Surface* dst = (SDL_Surface*)dst_o; SDL_Surface* src = (SDL_Surface*)src_o; @@ -407,8 +408,8 @@ void DSurfaceBlitSaturate(Surface* src_o } SDL_UnlockSurface(src); SDL_UnlockSurface(dst); - return; } + void DSurfaceBlitMultiply(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o) { SDL_Surface* dst = (SDL_Surface*)dst_o; SDL_Surface* src = (SDL_Surface*)src_o; @@ -470,5 +471,4 @@ void DSurfaceBlitMultiply(Surface* src_o } SDL_UnlockSurface(dst); SDL_UnlockSurface(src); - return; }