Mercurial > hg > openttd
annotate src/blitter/32bpp_optimized.hpp @ 20729:ea20edff1862 draft default tip master
(svn r25643) -Fix (r25480): [OSX] Define version constants before they're used
author | planetmaker <planetmaker@openttd.org> |
---|---|
date | Wed, 31 Jul 2013 18:50:01 +0000 |
parents | c3badc5af069 |
children |
rev | line source |
---|---|
7553
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12083
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12083
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12083
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12083
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12083
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12083
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12083
diff
changeset
|
9 |
9111
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
7553
diff
changeset
|
10 /** @file 32bpp_optimized.hpp Optimized 32 bpp blitter. */ |
7553
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
11 |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
12 #ifndef BLITTER_32BPP_OPTIMIZED_HPP |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
13 #define BLITTER_32BPP_OPTIMIZED_HPP |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
14 |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
15 #include "32bpp_simple.hpp" |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
16 |
17627
c3badc5af069
(svn r22397) -Document: some tidbits of the blitter code
rubidium <rubidium@openttd.org>
parents:
17152
diff
changeset
|
17 /** The optimised 32 bpp blitter (without palette animation). */ |
7553
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
18 class Blitter_32bppOptimized : public Blitter_32bppSimple { |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
19 public: |
17627
c3badc5af069
(svn r22397) -Document: some tidbits of the blitter code
rubidium <rubidium@openttd.org>
parents:
17152
diff
changeset
|
20 /** Data stored about a (single) sprite. */ |
9597
5c76c311cd7d
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz <smatz@openttd.org>
parents:
9486
diff
changeset
|
21 struct SpriteData { |
17627
c3badc5af069
(svn r22397) -Document: some tidbits of the blitter code
rubidium <rubidium@openttd.org>
parents:
17152
diff
changeset
|
22 uint32 offset[ZOOM_LVL_COUNT][2]; ///< Offsets (from .data) to streams for different zoom levels, and the normal and remap image information. |
c3badc5af069
(svn r22397) -Document: some tidbits of the blitter code
rubidium <rubidium@openttd.org>
parents:
17152
diff
changeset
|
23 byte data[]; ///< Data, all zoomlevels. |
9597
5c76c311cd7d
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz <smatz@openttd.org>
parents:
9486
diff
changeset
|
24 }; |
5c76c311cd7d
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz <smatz@openttd.org>
parents:
9486
diff
changeset
|
25 |
7553
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
26 /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom); |
17045
0f0760845f54
(svn r21782) -Codechange: Move declaration of AllocatorProc from Blitter:: to spritecache.h
frosch <frosch@openttd.org>
parents:
12778
diff
changeset
|
27 /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator); |
7553
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
28 |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
29 /* virtual */ const char *GetName() { return "32bpp-optimized"; } |
9486
66778a3336d0
(svn r13445) -Codechange: make 32bpp_optimized blitter ~10-20% faster in drawing (depends on architecture and compiler)
smatz <smatz@openttd.org>
parents:
9111
diff
changeset
|
30 |
9597
5c76c311cd7d
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz <smatz@openttd.org>
parents:
9486
diff
changeset
|
31 template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom); |
7553
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
32 }; |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
33 |
17627
c3badc5af069
(svn r22397) -Document: some tidbits of the blitter code
rubidium <rubidium@openttd.org>
parents:
17152
diff
changeset
|
34 /** Factory for the optimised 32 bpp blitter (without palette animation). */ |
7553
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
35 class FBlitter_32bppOptimized: public BlitterFactory<FBlitter_32bppOptimized> { |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
36 public: |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
37 /* virtual */ const char *GetName() { return "32bpp-optimized"; } |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
38 /* virtual */ const char *GetDescription() { return "32bpp Optimized Blitter (no palette animation)"; } |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
39 /* virtual */ Blitter *CreateInstance() { return new Blitter_32bppOptimized(); } |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
40 }; |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
41 |
b499a222a6c0
(svn r11078) -Add: added 32bpp-optimized, which is almost twice as fast as 32bpp-simple (based on the work of frosch)
truelight <truelight@openttd.org>
parents:
diff
changeset
|
42 #endif /* BLITTER_32BPP_OPTIMIZED_HPP */ |