mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-28 22:23:43 +00:00
Bugfix: Rounded squares at low resolutions were not drawn.
Cleanup. svn-id: r33179
This commit is contained in:
parent
0883615a23
commit
c7b624d91e
@ -84,6 +84,87 @@ void VectorRenderer::textStep(const Common::String &text, const Common::Rect &ar
|
||||
!step.hasAlign ? GUI::Theme::kTextAlignVTop : step.alignVertical);
|
||||
}
|
||||
|
||||
int VectorRenderer::stepGetRadius(const DrawStep &step, const Common::Rect &area) {
|
||||
int radius = 0;
|
||||
|
||||
if (step.radius == 0xFF)
|
||||
radius = MIN(area.width(), area.height()) / 2;
|
||||
else
|
||||
radius = step.radius;
|
||||
|
||||
if (step.scale != (1 << 16) && step.scale != 0)
|
||||
radius = (radius * step.scale) >> 16;
|
||||
|
||||
return radius;
|
||||
}
|
||||
|
||||
void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h) {
|
||||
if (!step.autoWidth) {
|
||||
in_w = step.w == -1 ? area.height() : step.w;
|
||||
|
||||
switch(step.xAlign) {
|
||||
case Graphics::DrawStep::kVectorAlignManual:
|
||||
if (step.x >= 0) in_x = area.left + step.x;
|
||||
else in_x = area.left + area.width() + step.x; // value relative to the opposite corner.
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignCenter:
|
||||
in_x = area.left + (area.width() / 2) - (in_w / 2);
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignLeft:
|
||||
in_x = area.left;
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignRight:
|
||||
in_x = area.left + area.width() - in_w;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Vertical alignment in horizontal data.");
|
||||
}
|
||||
} else {
|
||||
in_x = area.left;
|
||||
in_w = area.width();
|
||||
}
|
||||
|
||||
if (!step.autoHeight) {
|
||||
in_h = step.h == -1 ? area.width() : step.h;
|
||||
|
||||
switch(step.yAlign) {
|
||||
case Graphics::DrawStep::kVectorAlignManual:
|
||||
if (step.y >= 0) in_y = area.top + step.y;
|
||||
else in_y = area.top + area.height() + step.y; // relative
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignCenter:
|
||||
in_y = area.top + (area.height() / 2) - (in_h / 2);
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignTop:
|
||||
in_y = area.top;
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignBottom:
|
||||
in_y = area.top + area.height() - in_h;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Horizontal alignment in vertical data.");
|
||||
}
|
||||
} else {
|
||||
in_y = area.top;
|
||||
in_h = area.height();
|
||||
}
|
||||
|
||||
if (step.scale != (1 << 16) && step.scale != 0) {
|
||||
in_x = (in_x * step.scale) >> 16;
|
||||
in_y = (in_y * step.scale) >> 16;
|
||||
in_w = (in_w * step.scale) >> 16;
|
||||
in_h = (in_h * step.scale) >> 16;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* MISCELANEOUS functions
|
||||
********************************************************************/
|
||||
@ -356,8 +437,11 @@ template<typename PixelType, typename PixelFormat>
|
||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||
drawRoundedSquare(int x, int y, int r, int w, int h) {
|
||||
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h ||
|
||||
w <= 0 || h <= 0 || x < 0 || y < 0 || (r << 1) > w || (r << 1) > h)
|
||||
w <= 0 || h <= 0 || x < 0 || y < 0)
|
||||
return;
|
||||
|
||||
while ((r << 1) > w || (r << 1) > h)
|
||||
r <<= 1;
|
||||
|
||||
if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
|
||||
&& x + w + Base::_shadowOffset < Base::_activeSurface->w
|
||||
|
@ -338,86 +338,9 @@ public:
|
||||
_gradientFactor = factor;
|
||||
}
|
||||
|
||||
void stepGetPositions(const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h) {
|
||||
if (!step.autoWidth) {
|
||||
in_w = step.w == -1 ? area.height() : step.w;
|
||||
|
||||
switch(step.xAlign) {
|
||||
case Graphics::DrawStep::kVectorAlignManual:
|
||||
if (step.x >= 0) in_x = area.left + step.x;
|
||||
else in_x = area.left + area.width() + step.x; // value relative to the opposite corner.
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignCenter:
|
||||
in_x = area.left + (area.width() / 2) - (in_w / 2);
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignLeft:
|
||||
in_x = area.left;
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignRight:
|
||||
in_x = area.left + area.width() - in_w;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Vertical alignment in horizontal data.");
|
||||
}
|
||||
} else {
|
||||
in_x = area.left;
|
||||
in_w = area.width();
|
||||
}
|
||||
|
||||
if (!step.autoHeight) {
|
||||
in_h = step.h == -1 ? area.width() : step.h;
|
||||
|
||||
switch(step.yAlign) {
|
||||
case Graphics::DrawStep::kVectorAlignManual:
|
||||
if (step.y >= 0) in_y = area.top + step.y;
|
||||
else in_y = area.top + area.height() + step.y; // relative
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignCenter:
|
||||
in_y = area.top + (area.height() / 2) - (in_h / 2);
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignTop:
|
||||
in_y = area.top;
|
||||
break;
|
||||
|
||||
case Graphics::DrawStep::kVectorAlignBottom:
|
||||
in_y = area.top + area.height() - in_h;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Horizontal alignment in vertical data.");
|
||||
}
|
||||
} else {
|
||||
in_y = area.top;
|
||||
in_h = area.height();
|
||||
}
|
||||
void stepGetPositions(const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h);
|
||||
|
||||
if (step.scale != (1 << 16) && step.scale != 0) {
|
||||
in_x = (in_x * step.scale) >> 16;
|
||||
in_y = (in_y * step.scale) >> 16;
|
||||
in_w = (in_w * step.scale) >> 16;
|
||||
in_h = (in_h * step.scale) >> 16;
|
||||
}
|
||||
}
|
||||
|
||||
int stepGetRadius(const DrawStep &step, const Common::Rect &area) {
|
||||
int radius = 0;
|
||||
|
||||
if (step.radius == 0xFF)
|
||||
radius = MIN(area.width(), area.height()) / 2;
|
||||
else
|
||||
radius = step.radius;
|
||||
|
||||
if (step.scale != (1 << 16) && step.scale != 0)
|
||||
radius = (radius * step.scale) >> 16;
|
||||
|
||||
return radius;
|
||||
}
|
||||
int stepGetRadius(const DrawStep &step, const Common::Rect &area);
|
||||
|
||||
/**
|
||||
* DrawStep callback functions for each drawing feature
|
||||
|
@ -223,7 +223,10 @@ public:
|
||||
|
||||
/** Since the rendering pipeline changes, closing all dialogs causes no effect
|
||||
TODO: remove this from the original GUI::Theme API */
|
||||
void closeAllDialogs() {}
|
||||
void closeAllDialogs() {
|
||||
memset(_backBuffer->pixels, 0, _backBuffer->w * _backBuffer->h * _backBuffer->bytesPerPixel);
|
||||
|
||||
}
|
||||
|
||||
/** Drawing area has been removed: it was too hackish. A workaround is on the works.
|
||||
TODO: finish the workaround for the credits dialog
|
||||
|
Loading…
x
Reference in New Issue
Block a user