summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-04-17 21:45:02 +0200
committeraap <aap@papnet.eu>2020-04-17 21:45:02 +0200
commit886d73b123bcda23d4c6de1d5b3458278731de47 (patch)
tree38653f6e688f3f1c8a7e3ec3cb0d9067900a5c52
parentRemove CWorld from README (diff)
downloadre3-886d73b123bcda23d4c6de1d5b3458278731de47.tar
re3-886d73b123bcda23d4c6de1d5b3458278731de47.tar.gz
re3-886d73b123bcda23d4c6de1d5b3458278731de47.tar.bz2
re3-886d73b123bcda23d4c6de1d5b3458278731de47.tar.lz
re3-886d73b123bcda23d4c6de1d5b3458278731de47.tar.xz
re3-886d73b123bcda23d4c6de1d5b3458278731de47.tar.zst
re3-886d73b123bcda23d4c6de1d5b3458278731de47.zip
-rw-r--r--src/fakerw/fake.cpp39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 557318be..03df55e2 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -201,40 +201,9 @@ RwInt32 RwImageStreamGetSize(const RwImage * image);
RwImage *RwImageStreamRead(RwStream * stream);
const RwImage *RwImageStreamWrite(const RwImage * image, RwStream * stream);
-// TODO: this is kind hard...
RwImage *RwImageFindRasterFormat(RwImage *ipImage,RwInt32 nRasterType, RwInt32 *npWidth,RwInt32 *npHeight, RwInt32 *npDepth,RwInt32 *npFormat)
{
- // very dumb implementation for now
- // this is also platform specific
- if((nRasterType&rwRASTERTYPEMASK) != rwRASTERTYPETEXTURE){
- *npFormat = 0;
- return nil;
- }
- *npWidth = ipImage->width;
- *npHeight = ipImage->height;
- switch(ipImage->depth){
- case 4:
- case 8:
- *npDepth = 8;
- *npFormat = Raster::C8888 | Raster::PAL8;
- break;
- case 16:
- *npDepth = 16;
- *npFormat = Raster::C1555;
- break;
- case 24:
- *npDepth = 32;
- *npFormat = Raster::C888;
- break;
- case 32:
- *npDepth = 32;
- *npFormat = Raster::C8888;
- break;
- default:
- assert(0 && "invalid depth");
- return nil;
- }
- return ipImage;
+ return Raster::imageFindRasterFormat(ipImage, nRasterType, npWidth, npHeight, npDepth, npFormat) ? ipImage : nil;
}
@@ -269,11 +238,7 @@ RwInt32 RwRasterRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObj
RwInt32 RwRasterGetPluginOffset(RwUInt32 pluginID);
RwBool RwRasterValidatePlugins(const RwRaster * raster);
-// TODO: let's hope this works
-RwRaster *RwRasterSetFromImage(RwRaster *raster, RwImage *image) {
- engine->driver[raster->platform]->rasterFromImage(raster, image);
- return raster;
-}
+RwRaster *RwRasterSetFromImage(RwRaster *raster, RwImage *image) { return raster->setFromImage(image); }