author | truelight |
Wed, 13 Jun 2007 10:31:40 +0000 | |
changeset 6889 | 2160bf28040b |
permissions | -rw-r--r-- |
6889
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
2 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
3 |
/** @file 32bpp.hpp */ |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
4 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
5 |
#ifndef RENDERER_32BPP_HPP |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
6 |
#define RENDERER_32BPP_HPP |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
7 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
8 |
#include "renderer.hpp" |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
9 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
10 |
class Renderer_32bpp : public Renderer { |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
11 |
public: |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
12 |
/* virtual */ void *MoveTo(const void *video, int x, int y); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
13 |
/* virtual */ void SetPixel(void *video, int x, int y, uint8 color); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
14 |
/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
15 |
/* virtual */ void SetHorizontalLine(void *video, int width, uint8 color); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
16 |
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
17 |
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
18 |
/* virtual */ void MoveBuffer(void *video_dst, const void *video_src, int width, int height); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
19 |
/* virtual */ int BufferSize(int width, int height); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
20 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
21 |
static inline uint32 LookupColourInPalette(uint8 index) { |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
22 |
#define ARGB(a, r, g, b) ((((a) << 24) & 0xFF000000) | (((r) << 16) & 0x00FF0000) | (((g) << 8) & 0x0000FF00) | ((b) & 0x000000FF)) |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
23 |
if (index == 0) return 0x00000000; |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
24 |
return ARGB(0xFF, _cur_palette[index].r, _cur_palette[index].g, _cur_palette[index].b); |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
25 |
} |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
26 |
}; |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
27 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
28 |
class FRenderer_32bpp: public RendererFactory<FRenderer_32bpp> { |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
29 |
public: |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
30 |
/* virtual */ const char *GetName() { return "32bpp"; } |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
31 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
32 |
/* virtual */ Renderer *CreateInstance() { return new Renderer_32bpp(); } |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
33 |
}; |
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
34 |
|
2160bf28040b
(svn r10132) -Codechange: split out the last direct video-buffer read access to the blitter-layer
truelight
parents:
diff
changeset
|
35 |
#endif /* RENDERER_32BPP_HPP */ |