diff options
| author | cosmic-linden <111533034+cosmic-linden@users.noreply.github.com> | 2024-03-20 08:58:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-20 08:58:58 -0700 |
| commit | 93231d4eed69f7b869d4d10855a7ce6809b4a033 (patch) | |
| tree | 671182f101d48e852d277f501c6adfe7964d3784 /indra/llimage/llimage.cpp | |
| parent | 052a8a78e8b024bda1db6e5359c0d091b2a72d06 (diff) | |
| parent | e2a3edf6daed276d82767ce070dbbaf1d42dc427 (diff) | |
Merge pull request #1019 from secondlife/vi-82
secondlife/viewer-issues#82: Don't allow transparent texture terrain
Diffstat (limited to 'indra/llimage/llimage.cpp')
| -rw-r--r-- | indra/llimage/llimage.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index acfc254b65..16609b60be 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -990,6 +990,28 @@ void LLImageRaw::verticalFlip() } +bool LLImageRaw::checkHasTransparentPixels() +{ + if (getComponents() != 4) + { + return false; + } + + U8* data = getData(); + U32 pixels = getWidth() * getHeight(); + + // check alpha channel for all 255 + for (U32 i = 0; i < pixels; ++i) + { + if (data[i * 4 + 3] != 255) + { + return true; + } + } + + return false; +} + bool LLImageRaw::optimizeAwayAlpha() { if (getComponents() == 4) |
