Skip to content

Commit

Permalink
Fix tinted, rotated software alpha bitmap rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Mar 26, 2024
1 parent 729a0b4 commit 42263c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
5 changes: 0 additions & 5 deletions project/src/software-renderer/BitmapFill.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class BitmapFillerBase : public Filler
mMapped = false;
mPerspective = false;
mBilinearAdjust = 0;
mTint = ARGB(0xffffffff);
}


Expand All @@ -53,9 +52,6 @@ class BitmapFillerBase : public Filler
mDPyDX = (int)(mMapper.m10 * (1<<16)+ 0.5);
}

void SetTint(ARGB inTint) { mTint = inTint; }


void SetMapping(const UserPoint *inVertex, const float *inUVT,int inComponents)
{
mMapped = true;
Expand Down Expand Up @@ -181,7 +177,6 @@ class BitmapFillerBase : public Filler
double mTX, mTY, mTW;
double mBilinearAdjust;
Matrix mMapper;
ARGB mTint;
GraphicsBitmapFill *mBitmap;
};

Expand Down
25 changes: 10 additions & 15 deletions project/src/software-renderer/TileRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class TileRenderer : public Renderer
continue;

Rect alpha_rect(visible_pixels);
bool offscreen_buffer = mBlendMode!=bmNormal;
bool offscreen_buffer = mBlendMode!=bmNormal || (s->Format()==pfAlpha && (data.mHasColour || data.mHasTrans));
if (offscreen_buffer)
{
for(int i=0;i<4;i++)
Expand Down Expand Up @@ -333,24 +333,25 @@ class TileRenderer : public Renderer
// Can render straight to surface ....
if (!offscreen_buffer)
{
if (s->Format()==pfAlpha)
// Rotated text...
if (s->Format()==pfAlpha && just_alpha)
{
if (data.mHasColour)
{
ARGB col = inState.mColourTransform->Transform(data.mColour|0xff000000);
mFiller->SetTint(col);
}
mFiller->Fill(*alpha,0,0,inTarget,inState);
}
else if (data.mHasTrans && !just_alpha)
else if ( (data.mHasTrans || data.mHasColour) && !just_alpha)
{
ColorTransform buf;
RenderState col_state(inState);
ColorTransform tint;
tint.redMultiplier = ((data.mColour) & 0xff) * one_on_255;
tint.greenMultiplier = ((data.mColour>>8) & 0xff) * one_on_255;
tint.blueMultiplier = ((data.mColour>>16) & 0xff) * one_on_255;

tint.redMultiplier = 0;
tint.greenMultiplier = 1;
tint.blueMultiplier = 0;
col_state.CombineColourTransform(inState, &tint, &buf);

mFiller->Fill(*alpha,0,0,inTarget,col_state);
}
else
Expand All @@ -366,13 +367,6 @@ class TileRenderer : public Renderer
AutoSurfaceRender tmp_render(tmp);
const RenderTarget &target = tmp_render.Target();

if (s->Format()==pfAlpha && data.mHasColour)
{
ARGB col = inState.mColourTransform->Transform(data.mColour|0xff000000);
mFiller->SetTint(col);
}


mFiller->Fill(*alpha,0,0,target,inState);
}

Expand All @@ -388,6 +382,7 @@ class TileRenderer : public Renderer
}
else if (s->Format()==pfAlpha && mBlendMode==bmNormal && data.mHasColour /* integer co-ordinate?*/ )
{
// Normal, aligned text
if (mIsFixed)
pos -= data.mOffset;
//blits++;
Expand Down

0 comments on commit 42263c7

Please sign in to comment.