MCPcopy Create free account
hub / github.com/ddnet/ddnet / IsImageSubFullyTransparent

Method IsImageSubFullyTransparent

src/engine/client/graphics_threaded.cpp:350–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350bool CGraphics_Threaded::IsImageSubFullyTransparent(const CImageInfo &FromImageInfo, int x, int y, int w, int h)
351{
352 if(FromImageInfo.m_Format == CImageInfo::FORMAT_R || FromImageInfo.m_Format == CImageInfo::FORMAT_RA || FromImageInfo.m_Format == CImageInfo::FORMAT_RGBA)
353 {
354 const uint8_t *pImgData = FromImageInfo.m_pData;
355 const size_t PixelSize = FromImageInfo.PixelSize();
356 for(int iy = 0; iy < h; ++iy)
357 {
358 for(int ix = 0; ix < w; ++ix)
359 {
360 const size_t RealOffset = (x + ix) * PixelSize + (y + iy) * PixelSize * FromImageInfo.m_Width;
361 if(pImgData[RealOffset + (PixelSize - 1)] > 0)
362 return false;
363 }
364 }
365
366 return true;
367 }
368 return false;
369}
370
371bool CGraphics_Threaded::IsSpriteTextureFullyTransparent(const CImageInfo &FromImageInfo, const CDataSprite *pSprite)
372{

Callers

nothing calls this directly

Calls 1

PixelSizeMethod · 0.45

Tested by

no test coverage detected