Updated DccDecoderTest to new Dcc spec

Implemented Dcc release for each refCnt
Updated pixelCodeAndDisplacementBitStream assertion message
This commit is contained in:
Collin Smith
2021-11-10 16:46:36 -08:00
parent 6151379853
commit 5187976ccf
2 changed files with 13 additions and 4 deletions

View File

@ -25,10 +25,10 @@ public final class DccDecoder {
final Bitmap bmp = new Bitmap();
public void decode(Dcc dcc, int d) {
decode(dcc, dcc.directions[d]);
decode(dcc, d, dcc.directions[d]);
}
void decode(Dcc dcc, DccDirection dir) {
void decode(Dcc dcc, int d, DccDirection dir) {
directionBuffer.clear(dir);
pixelBuffer.clear(directionBuffer.size);
decodeFrames(dir, dcc.numFrames);
@ -40,7 +40,9 @@ public final class DccDecoder {
assert dir.pixelMaskBitStream.bitsRemaining() == 0;
assert dir.encodingTypeBitStream.bitsRemaining() == 0;
assert dir.rawPixelCodesBitStream.bitsRemaining() == 0;
assert dir.pixelCodeAndDisplacementBitStream.bytesRemaining() == 0 : dir.pixelCodeAndDisplacementBitStream.bytesRemaining();
assert dir.pixelCodeAndDisplacementBitStream.bytesRemaining() == 0 :
String.format("dcc: %s, dir: %d, bytesRemaining: %d",
dcc.handle, d, dir.pixelCodeAndDisplacementBitStream.bytesRemaining());
}
/**

View File

@ -145,6 +145,8 @@ public class DccDecoderTest {
"data\\global\\chars\\ba\\hd\\bahdbhma11hs.dcc",
"data\\global\\chars\\ba\\lg\\balglittnhth.dcc",
"data\\global\\chars\\ba\\hd\\bahdlittnhth.dcc",
"data\\global\\chars\\ba\\s2\\bas2littnhth.dcc",
"data\\global\\chars\\so\\s2\\sos2medtnhth.dcc",
})
void draw_pixmaps(String dccName) throws Exception {
FileHandle testHome = InstallationFinder.getInstance().defaultHomeDir();
@ -226,7 +228,10 @@ public class DccDecoderTest {
@Override
public void dispose() {
dcc.dispose(); // also releases dccHandle reference
// also releases dccHandle reference
// release twice, once for header, again for direction
ReferenceCountUtil.release(dcc);
ReferenceCountUtil.release(dcc);
AssetUtils.dispose(paletteTexture);
AssetUtils.dispose(shader);
AssetUtils.dispose(batch);
@ -243,6 +248,8 @@ public class DccDecoderTest {
"data\\global\\chars\\ba\\hd\\bahdbhma11hs.dcc",
"data\\global\\chars\\ba\\lg\\balglittnhth.dcc",
"data\\global\\chars\\ba\\hd\\bahdlittnhth.dcc",
"data\\global\\chars\\ba\\s2\\bas2littnhth.dcc",
"data\\global\\chars\\so\\s2\\sos2medtnhth.dcc",
})
void draw_pixmaps2(String dccName) throws Exception {
FileHandle testHome = InstallationFinder.getInstance().defaultHomeDir();