mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Fixed a slight but annoying rendering issue for the menu selector bar.
This commit is contained in:
parent
d05f42b3b8
commit
0a9ae5b8ec
|
@ -181,9 +181,9 @@ void ComponentList::render(const Transform4x4f& parentTrans)
|
||||||
// Clip everything to be inside our bounds.
|
// Clip everything to be inside our bounds.
|
||||||
Vector3f dim(mSize.x(), mSize.y(), 0);
|
Vector3f dim(mSize.x(), mSize.y(), 0);
|
||||||
dim = trans * dim - trans.translation();
|
dim = trans * dim - trans.translation();
|
||||||
Renderer::pushClipRect(Vector2i(static_cast<int>(trans.translation().x()),
|
Renderer::pushClipRect(Vector2i(static_cast<int>(std::round(trans.translation().x())),
|
||||||
static_cast<int>(trans.translation().y())), Vector2i(static_cast<int>(
|
static_cast<int>(std::round(trans.translation().y()))), Vector2i(static_cast<int>(
|
||||||
std::round(dim.x())), static_cast<int>(std::round(dim.y() + 1))));
|
std::round(dim.x())), static_cast<int>(std::round(dim.y()))));
|
||||||
|
|
||||||
// Scroll the camera.
|
// Scroll the camera.
|
||||||
trans.translate(Vector3f(0, -std::round(mCameraOffset), 0));
|
trans.translate(Vector3f(0, -std::round(mCameraOffset), 0));
|
||||||
|
@ -216,18 +216,6 @@ void ComponentList::render(const Transform4x4f& parentTrans)
|
||||||
it->component->render(trans);
|
it->component->render(trans);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Note: I've disabled this code as it's overly complicated,
|
|
||||||
// instead we're now using simple constants which should be
|
|
||||||
// good enough. Let's keep the code though if needed in the
|
|
||||||
// future for some reason.
|
|
||||||
// // If there is a hue, average the brightness values to make
|
|
||||||
// // an equivalent gray value before inverting.
|
|
||||||
// // This is not the proper way to do a BW conversion as the RGB values
|
|
||||||
// // should not be evenly distributed, but it's definitely good enough
|
|
||||||
// // for this situation.
|
|
||||||
// unsigned char byteAverage = (byteRed + byteGreen + byteBlue) / 3;
|
|
||||||
// unsigned int averageColor = byteAverage << 24 | byteAverage << 16 |
|
|
||||||
// byteAverage << 8 | 0xFF;
|
|
||||||
if (isTextComponent)
|
if (isTextComponent)
|
||||||
it->component->setColor(DEFAULT_INVERTED_TEXTCOLOR);
|
it->component->setColor(DEFAULT_INVERTED_TEXTCOLOR);
|
||||||
else
|
else
|
||||||
|
@ -266,18 +254,13 @@ void ComponentList::render(const Transform4x4f& parentTrans)
|
||||||
const float selectedRowHeight = getRowHeight(mEntries.at(mCursor).data);
|
const float selectedRowHeight = getRowHeight(mEntries.at(mCursor).data);
|
||||||
|
|
||||||
if (opacity == 1) {
|
if (opacity == 1) {
|
||||||
Renderer::drawRect(0.0f, mSelectorBarOffset, mSize.x(), selectedRowHeight,
|
Renderer::drawRect(0.0f, mSelectorBarOffset, mSize.x(),
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, false, opacity, trans,
|
selectedRowHeight, 0xFFFFFFFF, 0xFFFFFFFF, false, opacity, trans,
|
||||||
Renderer::Blend::ONE_MINUS_DST_COLOR, Renderer::Blend::ZERO);
|
Renderer::Blend::ONE_MINUS_DST_COLOR, Renderer::Blend::ZERO);
|
||||||
|
|
||||||
Renderer::drawRect(0.0f, mSelectorBarOffset, mSize.x(), selectedRowHeight,
|
Renderer::drawRect(0.0f, mSelectorBarOffset, mSize.x(),
|
||||||
0x777777FF, 0x777777FF, false, opacity, trans,
|
selectedRowHeight, 0x777777FF, 0x777777FF, false, opacity, trans,
|
||||||
Renderer::Blend::ONE, Renderer::Blend::ONE);
|
Renderer::Blend::ONE, Renderer::Blend::ONE);
|
||||||
// Hack to draw 2px dark on left/right of the bar.
|
|
||||||
Renderer::drawRect(0.0f, mSelectorBarOffset, 2.0f, selectedRowHeight,
|
|
||||||
0x878787FF, 0x878787FF, false, opacity, trans);
|
|
||||||
Renderer::drawRect(mSize.x() - 2.0f, mSelectorBarOffset, 2.0f, selectedRowHeight,
|
|
||||||
0x878787FF, 0x878787FF, false, opacity, trans);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto it = drawAfterCursor.cbegin(); it != drawAfterCursor.cend(); it++)
|
for (auto it = drawAfterCursor.cbegin(); it != drawAfterCursor.cend(); it++)
|
||||||
|
|
Loading…
Reference in a new issue