zeiss-microscopy / libCZI

Open Source Cross-Platform C++ library to read CZI image files
GNU General Public License v3.0
71 stars 19 forks source link

Bitmap copy bug? #20

Closed stanleyycho closed 6 years ago

stanleyycho commented 6 years ago

Hello,

I have been developing reader using libCZI. When I used this function. I was wondering if it the CBitmapOperations::Copy function should be copying from PixelType::Bgr48 to PixelType::Bgr48 using Copy<PixelType::Bgr48, PixelType::Bgr48> instead of Copy<PixelType::Bgr24, PixelType::Bgr24>.

The current implementation only copies half of the buffer.

in libCZI/BitmapOperations.cpp at line 131

/*static*/void CBitmapOperations::Copy(libCZI::PixelType srcPixelType, const void* srcPtr, int srcStride, libCZI::PixelType dstPixelType, void* dstPtr, int dstStride, int width, int height, bool drawTileBorder)
{
/*
 ...
*/
        case PixelType::Bgr48:
        switch (dstPixelType)
        {
        case PixelType::Gray8:break;
        case PixelType::Gray16:break;
        case PixelType::Gray32Float:break;
        case PixelType::Bgr24:break;
        case PixelType::Bgr48:
                        // should be Bgr48
            Copy<PixelType::Bgr48, PixelType::Bgr48>(srcPtr, srcStride, dstPtr, dstStride, width, height, drawTileBorder); 
            return;
        default:break;
        }
        break;

    default:break;
    }
/*
 ...
*/
}
zeissmicroscopy commented 6 years ago

Yes, sure. Thanks for reporting!