From fd6832cd3e4ef0329d0decf810fd6f6330dc0c7c Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 3 Oct 2021 17:47:26 +0100 Subject: [PATCH] Rename ImageIndex to VectorHandleImage, rename some variables --- osdopenvg.cc | 14 +++--- osdopenvg.h | 8 ++-- osdvector.cc | 118 +++++++++++++++++++++++------------------------ osdvector.h | 46 +++++++++--------- osdwinvector.cc | 8 ++-- osdwinvector.h | 6 +-- surfacevector.cc | 32 ++++++------- 7 files changed, 116 insertions(+), 116 deletions(-) diff --git a/osdopenvg.cc b/osdopenvg.cc index 795988d..7f2e491 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -615,21 +615,21 @@ void OsdOpenVG::purgeAllReferences() drawstyleHandlesRefCounts.clear(); // remove all references - map::iterator mitty=monobitmaps.begin(); + map::iterator mitty=monobitmaps.begin(); while (mitty!=monobitmaps.end()) { vgDestroyImage((VGImage)(*mitty).second); mitty++; } monobitmaps.clear(); - / *map::iterator jitty=jpegs.begin(); + / *map::iterator jitty=jpegs.begin(); while (jitty!=jpegs.end()) { vgDestroyImage((VGImage)(*jitty).second); jitty++; } jpegs.clear();* / - map::iterator titty=tvmedias.begin(); + map::iterator titty=tvmedias.begin(); while (titty!=tvmedias.end()) { vgDestroyImage((VGImage)(*titty).second); titty++; @@ -1583,11 +1583,11 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) return 0; } -void OsdOpenVG::destroyImageRef(ImageIndex index) +void OsdOpenVG::destroyImageRef(VectorHandleImage handle) { struct OpenVGCommand comm; comm.task = OVGdestroyImageRef; - comm.param1 = index; + comm.param1 = handle; putOpenVGCommand(comm, false); } @@ -1639,7 +1639,7 @@ bool OsdOpenVG::getEGLPicture(struct OsdVector::PictureInfo& info, EGLDisplay* d return putOpenVGCommand(comm, true); } -ImageIndex OsdOpenVG::createMonoBitmap(void* base, int width, int height) +VectorHandleImage OsdOpenVG::createMonoBitmap(void* base, int width, int height) { struct OpenVGCommand comm; comm.task = OVGcreateMonoBitmap; @@ -1649,7 +1649,7 @@ ImageIndex OsdOpenVG::createMonoBitmap(void* base, int width, int height) return putOpenVGCommand(comm, true); } -ImageIndex OsdOpenVG::createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) +VectorHandleImage OsdOpenVG::createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) { struct OpenVGCommand comm; comm.task = OVGcreateImagePalette; diff --git a/osdopenvg.h b/osdopenvg.h index 00d1ecf..da9acb2 100644 --- a/osdopenvg.h +++ b/osdopenvg.h @@ -108,10 +108,10 @@ class OsdOpenVG : public OsdVector void doRender(); /*osd vector implementation*/ - void destroyImageRef(ImageIndex index); - // ImageIndex createJpeg(const char* fileName, int *width,int *height); - ImageIndex createMonoBitmap(void* base, int width, int height); - ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data); + void destroyImageRef(VectorHandleImage handle); + // VectorHandleImage createJpeg(const char* fileName, int *width,int *height); + VectorHandleImage createMonoBitmap(void* base, int width, int height); + VectorHandleImage createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data); void createPicture(struct PictureInfo& pict_inf); void destroyDrawStyleHandle(VectorHandle index); VectorHandle createDrawStyleHandle(const DrawStyle& c); diff --git a/osdvector.cc b/osdvector.cc index 26072c2..90d9184 100644 --- a/osdvector.cc +++ b/osdvector.cc @@ -376,8 +376,8 @@ void OsdVector::decrementAllRefCounts(std::vector& commands) if (handle != 0) // command might not have a handle decrementDrawStyleHandleRefCount(handle); - ImageIndex ii = command.getImageIndex(); - if (ii) removeImageRef(ii); + VectorHandleImage imageHandle = command.getImageHandle(); + if (imageHandle) removeImageRef(imageHandle); LoadIndex li = command.getLoadIndex(); if (li) removeLoadIndexRef(li); @@ -392,29 +392,29 @@ void OsdVector::incrementAllRefCounts(std::vector& commands) if (handle != 0) // command might not have a handle incrementDrawStyleHandleRefCount(handle); - ImageIndex ii = command.getImageIndex(); - if (ii) incImageRef(ii); + VectorHandleImage imageHandle = command.getImageHandle(); + if (imageHandle) incImageRef(imageHandle); LoadIndex li = command.getLoadIndex(); if (li) incLoadIndexRef(li); } } -void OsdVector::incImageRef(ImageIndex index) +void OsdVector::incImageRef(VectorHandleImage handle) { - if (images_ref.find(index) == images_ref.end()) + if (images_ref.find(handle) == images_ref.end()) { - images_ref[index] = 1; + images_ref[handle] = 1; } else { - images_ref[index]++; + images_ref[handle]++; } } -void OsdVector::removeImageRef(const ImageIndex ref) +void OsdVector::removeImageRef(const VectorHandleImage handle) { - images_ref[ref]--; + images_ref[handle]--; } int OsdVector::getLoadIndexRef(LoadIndex index) @@ -452,7 +452,7 @@ void OsdVector::removeLoadIndexRef(const LoadIndex ref) if (loadindex_ref[ref] == 0) { //now check, if it is already loaded - std::map::iterator itty = tvmedias_loaded.find(ref); + std::map::iterator itty = tvmedias_loaded.find(ref); if ( itty != tvmedias_loaded.end()) { @@ -472,48 +472,48 @@ void OsdVector::cleanupOrphanedRefs() { // Do some garbage collection - std::map::iterator mitty = monobitmaps.begin(); + std::map::iterator mitty = monobitmaps.begin(); while (mitty != monobitmaps.end()) { - std::map::iterator curitty = images_ref.find((*mitty).second); + std::map::iterator curitty = images_ref.find((*mitty).second); int count = (*curitty).second; if (count == 0) { - ImageIndex ref = (*curitty).first; + VectorHandleImage handle = (*curitty).first; monobitmaps.erase(mitty++); images_ref.erase(curitty++); - destroyImageRef(ref); + destroyImageRef(handle); } else ++mitty; } - /*map::iterator jitty=jpegs.begin(); + /*map::iterator jitty=jpegs.begin(); while (jitty!=jpegs.end()) { - map::iterator curitty=images_ref.find((*jitty).second); + map::iterator curitty=images_ref.find((*jitty).second); int count=(*curitty).second; if (count==0) { - ImageIndex ref=(*curitty).first; + VectorHandleImage handle=(*curitty).first; jpegs.erase(jitty++); images_ref.erase(curitty++); - destroyImageRef(ref); + destroyImageRef(handle); } else ++jitty; }*/ - std::map::iterator titty = tvmedias.begin(); + std::map::iterator titty = tvmedias.begin(); while (titty != tvmedias.end()) { - std::map::iterator curitty = images_ref.find((*titty).second); + std::map::iterator curitty = images_ref.find((*titty).second); int count = (*curitty).second; if (count == 0) { - ImageIndex ref = (*curitty).first; + VectorHandleImage handle = (*curitty).first; tvmedias.erase(titty++); images_ref.erase(curitty); - destroyImageRef(ref); + destroyImageRef(handle); } else ++titty; } @@ -535,24 +535,24 @@ void OsdVector::cleanupOrphanedRefs() else ++litty; } - std::list::iterator pitty = palettepics.begin(); + std::list::iterator pitty = palettepics.begin(); while (pitty != palettepics.end()) { - std::map::iterator curitty = images_ref.find((*pitty)); + std::map::iterator curitty = images_ref.find((*pitty)); int count = (*curitty).second; if (count == 0) { - ImageIndex ref = (*curitty).first; + VectorHandleImage handle = (*curitty).first; palettepics.erase(pitty++); images_ref.erase(curitty++); - destroyImageRef(ref); + destroyImageRef(handle); } else ++pitty; } - std::map::iterator citty = images_ref.begin(); + std::map::iterator citty = images_ref.begin(); while (citty != images_ref.end()) { @@ -560,9 +560,9 @@ void OsdVector::cleanupOrphanedRefs() if (count == 0) { - ImageIndex ref = (*citty).first; + VectorHandleImage handle = (*citty).first; images_ref.erase(citty++); - destroyImageRef(ref); + destroyImageRef(handle); } else ++citty; } @@ -589,17 +589,17 @@ void OsdVector::cleanupOrphanedRefs() } } -int OsdVector::getImageRef(ImageIndex index) +int OsdVector::getImageRef(VectorHandleImage handle) { surfaces_mutex.lock(); - if (images_ref.find(index) == images_ref.end()) + if (images_ref.find(handle) == images_ref.end()) { return -1; } else { - return images_ref[index]; + return images_ref[handle]; } surfaces_mutex.unlock(); @@ -705,9 +705,9 @@ void OsdVector::dumpStyles() } #endif -LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image) +LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, VectorHandleImage& handle) { - ImageIndex image_handle = 0; + VectorHandleImage localHandle = 0; LoadIndex loadindex = 0; surfaces_mutex.lock(); @@ -715,25 +715,25 @@ LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image) { loadindex = loadTVMedia(tvmedia); } - else // if found, return a real imageIndex. incImageRef(image_handle). EXCEPT: If it's not found in images_ref (???) in which case do same as above. + else // if found, return a real imageIndex. incImageRef(localHandle). EXCEPT: If it's not found in images_ref (???) in which case do same as above. { - image_handle = tvmedias[tvmedia]; + localHandle = tvmedias[tvmedia]; - if (images_ref.find(image_handle) == images_ref.end()) + if (images_ref.find(localHandle) == images_ref.end()) { //invalid handle recreate loadindex = loadTVMedia(tvmedia); - image_handle = 0; + localHandle = 0; } else { - incImageRef(image_handle); + incImageRef(localHandle); } } /*tvmedias[tvmedia]=createTVMedia(tvmedia,width,height); - incImageRef(image_handle);*/ - image = image_handle; + incImageRef(localHandle);*/ + handle = localHandle; surfaces_mutex.unlock(); return loadindex; } @@ -787,33 +787,33 @@ LoadIndex OsdVector::loadTVMedia(TVMediaInfo& tvmedia) // insert a tvme return index; } -void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex) +void OsdVector::informPicture(LoadIndex index, VectorHandleImage handle) { //Beware for thread safety - ImageIndex image_index = 0; + VectorHandleImage localHandle = 0; - logger->debug(TAG, "TVMedia Picture for load-id {:#x} arrived index {:#x}", index, imageIndex); + logger->debug(TAG, "TVMedia Picture for load-id {:#x} arrived index {:#x}", index, handle); surfaces_mutex.lock(); TVMediaInfo tvmedia = tvmedias_load_inv[index]; - if (imageIndex) + if (handle) { std::map::iterator itty = loadindex_ref.find(index); - image_index = tvmedias[tvmedia] = imageIndex; - tvmedias_loaded[index] = image_index; + localHandle = tvmedias[tvmedia] = handle; + tvmedias_loaded[index] = localHandle; if (itty == loadindex_ref.end() || (*itty).second == 0) { // we do not want the picture anymore . Really... // fill images_ref in to not irritate the garbage collector - if (images_ref.find(image_index) == images_ref.end()) + if (images_ref.find(localHandle) == images_ref.end()) { - images_ref[image_index] = 0; + images_ref[localHandle] = 0; } } else { - incImageRef(image_index); // hold one index until all loadings refs are gone; + incImageRef(localHandle); // hold one index until all loadings refs are gone; } } @@ -827,22 +827,22 @@ void OsdVector::processMessage(Message* m) case Message::NEW_PICTURE: { //logger->debug(TAG, "TVMedia NEW_PICTURE"); - informPicture(m->tag, reinterpret_cast(m->data)); + informPicture(m->tag, reinterpret_cast(m->data)); break; } case Message::NEW_PICTURE_STATIC: { //logger->debug(TAG, "TVMedia NEW_PICTURE {:#x} {:#x}", m->tag, m->parameter); - informPicture(static_cast(m->tag) << 32LL, reinterpret_cast(m->data)); + informPicture(static_cast(m->tag) << 32LL, reinterpret_cast(m->data)); break; } } } /* -ImageIndex OsdVector::getJpegRef(const char* fileName, int *width,int *height) +VectorHandleImage OsdVector::getJpegRef(const char* fileName, int *width,int *height) { - ImageIndex image_handle=0; + VectorHandleImage image_handle=0; if (jpegs.find(fileName)==jpegs.end()) { image_handle=jpegs[fileName]=createJpeg(fileName,width,height); @@ -860,9 +860,9 @@ ImageIndex OsdVector::getJpegRef(const char* fileName, int *width,int *height) } */ -ImageIndex OsdVector::getMonoBitmapRef(void* base, int width, int height) +VectorHandleImage OsdVector::getMonoBitmapRef(void* base, int width, int height) { - ImageIndex image_handle; + VectorHandleImage image_handle; surfaces_mutex.lock(); if (monobitmaps.find(base) == monobitmaps.end()) @@ -891,9 +891,9 @@ ImageIndex OsdVector::getMonoBitmapRef(void* base, int width, int height) return image_handle; } -ImageIndex OsdVector::getImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) +VectorHandleImage OsdVector::getImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) { - ImageIndex image_handle; + VectorHandleImage image_handle; image_handle = createImagePalette(width, height, image_data, palette_data); surfaces_mutex.lock(); palettepics.push_back(image_handle); diff --git a/osdvector.h b/osdvector.h index d93cac9..f712ed4 100644 --- a/osdvector.h +++ b/osdvector.h @@ -70,7 +70,7 @@ enum Corner TopLeftLimited }; -typedef VectorHandle ImageIndex; +typedef VectorHandle VectorHandleImage; typedef unsigned long long LoadIndex; class SVGCommand @@ -103,7 +103,7 @@ class SVGCommand return nc; }; - inline static SVGCommand PaintImage(float ix, float iy, float iw, float ih, ImageIndex image_in, VectorHandle ref, Corner corner = TopLeft) + inline static SVGCommand PaintImage(float ix, float iy, float iw, float ih, VectorHandleImage handle, VectorHandle ref, Corner corner = TopLeft) { SVGCommand nc; nc.instr = DrawImage; @@ -111,7 +111,7 @@ class SVGCommand nc.y = iy; nc.w = iw; nc.h = ih; - nc.target.image = image_in; + nc.target.image = handle; nc.handle = ref; // can be 0 (no handle) or can be an Drawstyle nandle nc.corner = corner; return nc; @@ -175,7 +175,7 @@ class SVGCommand return handle; }; - ImageIndex getImageIndex() + VectorHandleImage getImageHandle() { if (instr != DrawImage) return 0; else return target.image; @@ -195,7 +195,7 @@ class SVGCommand { PathIndex path_index; wchar_t textchar; - ImageIndex image; + VectorHandleImage image; unsigned int ttchar; LoadIndex loadindex; } target; @@ -235,15 +235,15 @@ class OsdVector : public Osd, public MessageReceiver virtual float getCharWidth(wchar_t c) = 0; float* getCharWidthArray() {return byte_char_width;}; - //virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height); - virtual LoadIndex getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image); - virtual ImageIndex getMonoBitmapRef(void* base, int width, int height); - virtual ImageIndex getImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data); + //virtual VectorHandleImage getJpegRef(const char* fileName, int *width,int *height); + virtual LoadIndex getTVMediaRef(TVMediaInfo& tvmedia, VectorHandleImage& handle); + virtual VectorHandleImage getMonoBitmapRef(void* base, int width, int height); + virtual VectorHandleImage getImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data); virtual bool getStaticImageData(unsigned int static_id, UCHAR** userdata, ULONG* length) = 0; - void removeImageRef(const ImageIndex ref); + void removeImageRef(const VectorHandleImage ref); void removeLoadIndexRef(const LoadIndex ref); VectorHandle getDrawStyleHandle(const DrawStyle& c); virtual void decrementDrawStyleHandleRefCount(VectorHandle ref); @@ -251,7 +251,7 @@ class OsdVector : public Osd, public MessageReceiver virtual void getRealScreenSize(int& width, int& height) = 0; // should be only called from control thread - void informPicture(LoadIndex index, ImageIndex i_index); + void informPicture(LoadIndex index, VectorHandleImage handle); void processMessage(Message* m); @@ -346,15 +346,15 @@ class OsdVector : public Osd, public MessageReceiver PictureReader reader; - std::map images_ref; - std::map monobitmaps; - //map jpegs; - std::map tvmedias; - std::list palettepics; + std::map images_ref; + std::map monobitmaps; + //map jpegs; + std::map tvmedias; + std::list palettepics; std::map loadindex_ref; std::map tvmedias_load; std::map tvmedias_load_inv; - std::map tvmedias_loaded; + std::map tvmedias_loaded; std::map drawstyleHandles; std::map::iterator drawstyleHandles_lastit; @@ -371,15 +371,15 @@ class OsdVector : public Osd, public MessageReceiver float byte_char_width[256]{}; - void incImageRef(ImageIndex index); - int getImageRef(ImageIndex index); - virtual void destroyImageRef(ImageIndex index) = 0; + void incImageRef(VectorHandleImage handle); + int getImageRef(VectorHandleImage handle); + virtual void destroyImageRef(VectorHandleImage handle) = 0; void incLoadIndexRef(LoadIndex index); int getLoadIndexRef(LoadIndex index); - //virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0; - virtual ImageIndex createMonoBitmap(void* base, int width, int height) = 0; - virtual ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) = 0; + //virtual VectorHandleImage createJpeg(const char* fileName, int *width,int *height)=0; + virtual VectorHandleImage createMonoBitmap(void* base, int width, int height) = 0; + virtual VectorHandleImage createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) = 0; virtual void createPicture(struct PictureInfo& pict_inf) = 0; virtual LoadIndex loadTVMedia(TVMediaInfo& tvmedia); diff --git a/osdwinvector.cc b/osdwinvector.cc index 46b166b..51504eb 100644 --- a/osdwinvector.cc +++ b/osdwinvector.cc @@ -1206,9 +1206,9 @@ void OsdWinVector::getTextureCoordinates(FLOAT* x, FLOAT* y) -void OsdWinVector::destroyImageRef(ImageIndex index) +void OsdWinVector::destroyImageRef(VectorHandleImage handle) { - ID2D1Bitmap* bitmap = (ID2D1Bitmap*)index; + ID2D1Bitmap* bitmap = (ID2D1Bitmap*)handle; if (bitmap) bitmap->Release(); } @@ -1259,7 +1259,7 @@ void OsdWinVector::createPicture(struct PictureInfo& pict_inf) } -ImageIndex OsdWinVector::createMonoBitmap(void *base, int width, int height) +VectorHandleImage OsdWinVector::createMonoBitmap(void *base, int width, int height) { // First we have to convert it to 8 bit alpha, we could use WIC but actually writing this code is not hard to port from base class @@ -1307,7 +1307,7 @@ ImageIndex OsdWinVector::createMonoBitmap(void *base, int width, int height) } -ImageIndex OsdWinVector::createImagePalette(int width, int height, const unsigned char *image_data, const unsigned int*palette_data) +VectorHandleImage OsdWinVector::createImagePalette(int width, int height, const unsigned char *image_data, const unsigned int*palette_data) { // First we have to convert it to 32 bit RGBA, we could use WIC but actually writing this code is not hard to port from base class diff --git a/osdwinvector.h b/osdwinvector.h index b75e387..4c17c1e 100644 --- a/osdwinvector.h +++ b/osdwinvector.h @@ -69,9 +69,9 @@ protected: void getTextureCoordinates(FLOAT*, FLOAT*); /*osd vector implementation*/ - void destroyImageRef(ImageIndex index); - ImageIndex createMonoBitmap(void *base, int width, int height); - ImageIndex createImagePalette(int width, int height, const unsigned char *image_data, const unsigned int*palette_data); + void destroyImageRef(VectorHandleImage index); + VectorHandleImage createMonoBitmap(void *base, int width, int height); + VectorHandleImage createImagePalette(int width, int height, const unsigned char *image_data, const unsigned int*palette_data); void createPicture(struct PictureInfo& pict_inf); void destroyDrawStyleHandle(VectorHandle index); VectorHandle createDrawStyleHandle(const DrawStyle &c); diff --git a/surfacevector.cc b/surfacevector.cc index 2b0e133..1da632b 100644 --- a/surfacevector.cc +++ b/surfacevector.cc @@ -42,8 +42,8 @@ SurfaceVector::~SurfaceVector() { osd->decrementDrawStyleHandleRefCount(command.getHandle()); // We remove the Style reference, so that osd can free stuff // FIXME BUG BUG BUG - ImageIndex ii = command.getImageIndex(); - if (ii) osd->removeImageRef(ii); + VectorHandleImage handle = command.getImageHandle(); + if (handle) osd->removeImageRef(handle); LoadIndex li = command.getLoadIndex(); if (li) osd->removeLoadIndexRef(li); @@ -252,8 +252,8 @@ void SurfaceVector::drawJpeg(const char* fileName, int x, int y, int* width, int void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *height) { command_mutex.lock(); - ImageIndex image=osd->getJpegRef(fileName,width,height); - commands.push_back(SVGCommand::PaintImage(x,y,*width,*height,image,0)); + VectorHandleImage handle=osd->getJpegRef(fileName,width,height); + commands.push_back(SVGCommand::PaintImage(x,y,*width,*height,handle,0)); command_mutex.unlock(); } */ @@ -261,22 +261,22 @@ void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int * void SurfaceVector::drawTVMedia(TVMediaInfo& tvmedia, float x, float y, float width, float height, Corner corner) { command_mutex.lock(); - ImageIndex image = 0; - LoadIndex load_index = osd->getTVMediaRef(tvmedia, image); + VectorHandleImage handle = 0; + LoadIndex load_index = osd->getTVMediaRef(tvmedia, handle); if (width != 0 && height != 0) { removeCommands(x, y, width, height); } - if (image) + if (handle) { - logger->trace(TAG, "drawTVMedia: i=true, Add instr PaintImage load_index={} image={}", load_index, image); - commands.push_back(SVGCommand::PaintImage(x, y, width, height, image, 0, corner)); + logger->trace(TAG, "drawTVMedia: i=true, Add instr PaintImage load_index={} handle={}", load_index, handle); + commands.push_back(SVGCommand::PaintImage(x, y, width, height, handle, 0, corner)); } else { - logger->trace(TAG, "drawTVMedia: i=false, Add instr PaintImageLoading {} {}", load_index, image); + logger->trace(TAG, "drawTVMedia: i=false, Add instr PaintImageLoading {} {}", load_index, handle); commands.push_back(SVGCommand::PaintImageLoading(load_index, x, y, width, height, corner)); } @@ -339,7 +339,7 @@ void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm, const DisplayRegi data[i+j*bm.getHeight()]=bm.getColour(i,j); } }*/ - ImageIndex image = osd->getImagePalette(bm.getWidth(), bm.getHeight(), &(bm.rawData()[0]), + VectorHandleImage handle = osd->getImagePalette(bm.getWidth(), bm.getHeight(), &(bm.rawData()[0]), (const unsigned int*)&bm.palette.getColourVector()[0]); // data is freed by the OSD //free(data); float tx = x + region.windowx; @@ -353,7 +353,7 @@ void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm, const DisplayRegi ty *= scaley; tw *= scalex; th *= scaley; - SVGCommand temp = SVGCommand::PaintImage(tx, ty, tw, th, image, 0); + SVGCommand temp = SVGCommand::PaintImage(tx, ty, tw, th, handle, 0); removeCommands(tx, ty, tw, th); commands.push_back(temp); command_mutex.unlock(); @@ -372,10 +372,10 @@ void SurfaceVector::drawPoint(int x, int y, const DrawStyle& c, bool fastdraw) void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, const DrawStyle& nextColour) { command_mutex.lock(); - ImageIndex image = osd->getMonoBitmapRef(base, width, height); + VectorHandleImage handle = osd->getMonoBitmapRef(base, width, height); VectorHandle ref = osd->getDrawStyleHandle(nextColour); removeCommands(dx, dy, width, height); - commands.push_back(SVGCommand::PaintImage(dx, dy, height, width, image, ref)); // FIXME BUG height and width wrong way around? + commands.push_back(SVGCommand::PaintImage(dx, dy, height, width, handle, ref)); // FIXME BUG height and width wrong way around? command_mutex.unlock(); } @@ -400,9 +400,9 @@ int SurfaceVector::removeCommands(float x, float y, float width, float height) //Log::getInstance()->log("OSD", Log::DEBUG, "Remove command %d %g %g %g %g %d %d",(*itty).instr, //(*itty).x,(*itty).y,(*itty).w,(*itty).h,(*itty).handle,(*itty).target.image); osd->decrementDrawStyleHandleRefCount((*itty).getHandle()); // We remove the Style reference, so that osd can free stuff // FIXME BUG BUG BUG - ImageIndex ii = (*itty).getImageIndex(); + VectorHandleImage handle = (*itty).getImageHandle(); - if (ii) osd->removeImageRef(ii); + if (handle) osd->removeImageRef(handle); LoadIndex li = (*itty).getLoadIndex(); -- 2.39.5