diff options
author | Jason Sams <rjsams@android.com> | 2010-01-19 17:53:54 -0800 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-01-19 17:53:54 -0800 |
commit | e20e3b41db0bc8bb68f40e8a60b351933028ffd6 (patch) | |
tree | ccefcc3fe0b359c08a862a83ae96d2419aac6d78 /libs/rs | |
parent | fc35343cfe29e32301df941c3a3dfd5458e32395 (diff) | |
download | frameworks_base-e20e3b41db0bc8bb68f40e8a60b351933028ffd6.zip frameworks_base-e20e3b41db0bc8bb68f40e8a60b351933028ffd6.tar.gz frameworks_base-e20e3b41db0bc8bb68f40e8a60b351933028ffd6.tar.bz2 |
Fix RS mipmap generation for 8 bit alpha textures.
Diffstat (limited to 'libs/rs')
-rw-r--r-- | libs/rs/rsAllocation.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index b4ec1a2..1ae2317 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -366,6 +366,25 @@ static void mip8888(const Adapter2D &out, const Adapter2D &in) } } +static void mip8(const Adapter2D &out, const Adapter2D &in) +{ + uint32_t w = out.getDimX(); + uint32_t h = out.getDimY(); + + for (uint32_t y=0; y < h; y++) { + uint8_t *oPtr = static_cast<uint8_t *>(out.getElement(0, y)); + const uint8_t *i1 = static_cast<uint8_t *>(in.getElement(0, y*2)); + const uint8_t *i2 = static_cast<uint8_t *>(in.getElement(0, y*2+1)); + + for (uint32_t x=0; x < w; x++) { + *oPtr = (uint8_t)(((uint32_t)i1[0] + i1[1] + i2[0] + i2[1]) * 0.25f); + oPtr ++; + i1 += 2; + i2 += 2; + } + } +} + static void mip(const Adapter2D &out, const Adapter2D &in) { switch(out.getBaseType()->getElement()->getSizeBits()) { @@ -375,6 +394,9 @@ static void mip(const Adapter2D &out, const Adapter2D &in) case 16: mip565(out, in); break; + case 8: + mip8(out, in); + break; } |