[Scummvm-cvs-logs] SF.net SVN: scummvm: [25642] scummvm/trunk/engines/scumm/bomp.cpp
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Sat Feb 17 02:20:42 CET 2007
Revision: 25642
http://scummvm.svn.sourceforge.net/scummvm/?rev=25642&view=rev
Author: cyx
Date: 2007-02-16 17:20:41 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
get rid of bitCount table (count occurences of bit 0 directly in the main loop)
Modified Paths:
--------------
scummvm/trunk/engines/scumm/bomp.cpp
Modified: scummvm/trunk/engines/scumm/bomp.cpp
===================================================================
--- scummvm/trunk/engines/scumm/bomp.cpp 2007-02-17 01:12:37 UTC (rev 25641)
+++ scummvm/trunk/engines/scumm/bomp.cpp 2007-02-17 01:20:41 UTC (rev 25642)
@@ -211,7 +211,6 @@
byte bomp_scaling_x[64];
byte bomp_scaling_y[64];
-
if (bd.x < 0) {
clip.left = -bd.x;
} else {
@@ -331,32 +330,13 @@
}
}
-static const byte bitCount[] = {
- 8, 7, 7, 6, 7, 6, 6, 5, 7, 6, 6, 5, 6, 5, 5, 4,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
- 4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0,
-};
-
int32 setupBompScale(byte *scaling, int32 size, byte scale) {
byte tmp;
int32 count;
const byte *tmp_ptr;
byte *tmp_scaling = scaling;
byte a = 0;
- byte ret_value = 0;
+ byte bitsCount = 0;
const int offsets[8] = { 3, 2, 1, 0, 7, 6, 5, 4 };
count = (256 - size / 2);
@@ -371,23 +351,24 @@
a <<= 1;
if (scale < tmp) {
a |= 1;
+ } else {
+ bitsCount++;
}
}
tmp_ptr += 8;
*tmp_scaling++ = a;
}
- if ((size & 7) != 0) {
- *(tmp_scaling - 1) |= revBitMask(size & 7);
+ size &= 7;
+ if (size != 0) {
+ --tmp_scaling;
+ if ((*tmp_scaling & revBitMask(size)) == 0) {
+ *tmp_scaling |= revBitMask(size);
+ bitsCount--;
+ }
}
- count = (size + 7) / 8;
- while (count--) {
- tmp = *scaling++;
- ret_value += bitCount[tmp];
- }
-
- return ret_value;
+ return bitsCount;
}
} // End of namespace Scumm
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list