Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sprite: rewrite IsPixelTransparent

simply compare the alpha from GetPixel.
possibly slighty less efficient, but much less code.
  • Loading branch information...
commit 951ca22d44e7550215f9ffbe06e345599a339c81 1 parent 2ff4b35
@bradallred bradallred authored
Showing with 2 additions and 32 deletions.
  1. +2 −32 gemrb/core/Sprite2D.cpp
View
34 gemrb/core/Sprite2D.cpp
@@ -44,38 +44,8 @@ Sprite2D::~Sprite2D()
bool Sprite2D::IsPixelTransparent(unsigned short x, unsigned short y) const
{
- if (x >= Width || y >= Height) return true;
-
- if (!BAM) {
- return core->GetVideoDriver()->GetPixel(vptr, x, y)==0;
- }
-
- Sprite2D_BAM_Internal* data = (Sprite2D_BAM_Internal*)vptr;
-
- if (data->flip_ver)
- y = Height - y - 1;
- if (data->flip_hor)
- x = Width - x - 1;
-
- int skipcount = y * Width + x;
-
- const ieByte* rle = (const ieByte*)pixels;
- if (data->RLE) {
- while (skipcount > 0) {
- if (*rle++ == data->transindex)
- skipcount -= (*rle++)+1;
- else
- skipcount--;
- }
- } else {
- // uncompressed
- rle += skipcount;
- skipcount = 0;
- }
- if (skipcount < 0 || *rle == data->transindex)
- return true;
-
- return false;
+ // TODO: this wont work for non-bam sprites, but it isn't used for any currently.
+ return GetPixel(x, y).a == 0;
}
/** Get the Palette of a Sprite */
Please sign in to comment.
Something went wrong with that request. Please try again.