Skip to content

Commit 685f172

Browse files
committed
Revert "[Nokia N-Gage] Fix alpha transparency in 4K color mode using BitBltMasked"
This reverts commit 2ef7944 due to unbearable performance issues.
1 parent a89a20a commit 685f172

File tree

2 files changed

+2
-61
lines changed

2 files changed

+2
-61
lines changed

src/render/ngage/SDL_render_ngage.cpp

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ void NGAGE_DestroyTextureData(NGAGE_TextureData *data)
6969
if (data) {
7070
delete data->bitmap;
7171
data->bitmap = NULL;
72-
delete data->mask;
73-
data->mask = NULL;
7472
}
7573
}
7674

@@ -352,29 +350,7 @@ bool CRenderer::Copy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rec
352350
if (phdata->bitmap) {
353351
TRect aSource(TPoint(srcrect->x, srcrect->y), TSize(srcrect->w, srcrect->h));
354352
TPoint aDest(dstrect->x, dstrect->y);
355-
356-
w = phdata->surface->w;
357-
pitch = phdata->surface->pitch;
358-
Uint16 *src = (Uint16 *)phdata->surface->pixels;
359-
Uint16 *mask = (Uint16 *)phdata->mask->DataAddress();
360-
361-
for (int y = 0; y < srcrect->h; ++y) {
362-
int src_y = srcrect->y + y;
363-
if (src_y < 0 || src_y >= phdata->surface->h) {
364-
continue;
365-
}
366-
for (int x = 0; x < srcrect->w; ++x) {
367-
int src_x = srcrect->x + x;
368-
if (src_x < 0 || src_x >= phdata->surface->w) {
369-
continue;
370-
}
371-
Uint16 pixel = src[src_y * (pitch / 2) + src_x];
372-
Uint8 alpha = (pixel & 0xF000) >> 12;
373-
mask[src_y * w + src_x] = (alpha == 0) ? 0x0000 : 0xFFFF;
374-
}
375-
}
376-
377-
iRenderer->Gc()->BitBltMasked(aDest, phdata->bitmap, aSource, phdata->mask, EFalse);
353+
iRenderer->Gc()->BitBlt(aDest, phdata->bitmap, aSource);
378354
}
379355

380356
return true;
@@ -440,29 +416,7 @@ bool CRenderer::CopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const NGAGE
440416
if (phdata->bitmap) {
441417
TRect aSource(TPoint(copydata->srcrect.x, copydata->srcrect.y), TSize(copydata->srcrect.w, copydata->srcrect.h));
442418
TPoint aDest(copydata->dstrect.x, copydata->dstrect.y);
443-
444-
w = phdata->surface->w;
445-
pitch = phdata->surface->pitch;
446-
Uint16 *src = (Uint16 *)phdata->surface->pixels;
447-
Uint16 *mask = (Uint16 *)phdata->mask->DataAddress();
448-
449-
for (int y = 0; y < copydata->srcrect.h; ++y) {
450-
int src_y = copydata->srcrect.y + y;
451-
if (src_y < 0 || src_y >= phdata->surface->h) {
452-
continue;
453-
}
454-
for (int x = 0; x < copydata->srcrect.w; ++x) {
455-
int src_x = copydata->srcrect.x + x;
456-
if (src_x < 0 || src_x >= phdata->surface->w) {
457-
continue;
458-
}
459-
Uint16 pixel = src[src_y * (pitch / 2) + src_x];
460-
Uint8 alpha = (pixel & 0xF000) >> 12;
461-
mask[src_y * w + src_x] = (alpha == 0) ? 0x0000 : 0xFFFF;
462-
}
463-
}
464-
465-
iRenderer->Gc()->BitBltMasked(aDest, phdata->bitmap, aSource, phdata->mask, EFalse);
419+
iRenderer->Gc()->BitBlt(aDest, phdata->bitmap, aSource);
466420
}
467421

468422
return true;
@@ -486,18 +440,6 @@ bool CRenderer::CreateTextureData(NGAGE_TextureData *aTextureData, const TInt aW
486440
return false;
487441
}
488442

489-
aTextureData->mask = new CFbsBitmap();
490-
if (!aTextureData->mask) {
491-
return false;
492-
}
493-
494-
error = aTextureData->mask->Create(TSize(aWidth, aHeight), EColor4K);
495-
if (error != KErrNone) {
496-
delete aTextureData->mask;
497-
aTextureData->mask = NULL;
498-
return false;
499-
}
500-
501443
return true;
502444
}
503445

src/render/ngage/SDL_render_ngage_c.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ typedef struct CFbsBitmap CFbsBitmap;
5858
typedef struct NGAGE_TextureData
5959
{
6060
CFbsBitmap *bitmap;
61-
CFbsBitmap *mask;
6261
SDL_Surface *surface;
6362

6463
} NGAGE_TextureData;

0 commit comments

Comments
 (0)