mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
improve text texture RGB value on win32 (#1473)
* fix text texture RGB error on win32 * keep alpha value, no change
This commit is contained in:
@@ -535,10 +535,8 @@ private:
|
||||
GetDIBits(_DC, _bmp, 0, _bufferHeight, dataBuf,
|
||||
(LPBITMAPINFO)&bi, DIB_RGB_COLORS);
|
||||
|
||||
uint8_t r = _fillStyle.r * 255.0f;
|
||||
uint8_t g = _fillStyle.g * 255.0f;
|
||||
uint8_t b = _fillStyle.b * 255.0f;
|
||||
COLORREF textColor = (b << 16 | g << 8 | r) & 0x00ffffff;
|
||||
|
||||
uint8_t r, g, b;
|
||||
float alpha = 1.0f;
|
||||
COLORREF * pPixel = nullptr;
|
||||
for (int y = 0; y < _bufferHeight; ++y)
|
||||
@@ -551,6 +549,11 @@ private:
|
||||
// "dirtyValue > 0" means pixel was covered when drawing text
|
||||
if (dirtyValue > 0)
|
||||
{
|
||||
// r = _fillStyle.r * 255 * (dirtyValue / 255);
|
||||
r = _fillStyle.r * dirtyValue;
|
||||
g = _fillStyle.g * dirtyValue;
|
||||
b = _fillStyle.b * dirtyValue;
|
||||
COLORREF textColor = (b << 16 | g << 8 | r) & 0x00ffffff;
|
||||
clr = ((BYTE)(dirtyValue * alpha) << 24) | textColor;
|
||||
}
|
||||
++pPixel;
|
||||
|
||||
Reference in New Issue
Block a user