Remove Graphics::SetClipRect
This commit is contained in:
parent
9b9b0b794a
commit
aa2fa9ed8c
@ -459,16 +459,6 @@ void Graphics::SwapClipRect(Rect<int> &rect)
|
|||||||
clipRect &= video.Size().OriginRect();
|
clipRect &= video.Size().OriginRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::SetClipRect(int &x, int &y, int &w, int &h)
|
|
||||||
{
|
|
||||||
Rect<int> rect = RectSized(Vec2(x, y), Vec2(w, h));
|
|
||||||
SwapClipRect(rect);
|
|
||||||
x = rect.TopLeft.X;
|
|
||||||
y = rect.TopLeft.Y;
|
|
||||||
w = rect.Size().X;
|
|
||||||
h = rect.Size().Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Graphics::GradientStop::operator <(const GradientStop &other) const
|
bool Graphics::GradientStop::operator <(const GradientStop &other) const
|
||||||
{
|
{
|
||||||
return point < other.point;
|
return point < other.point;
|
||||||
|
@ -104,6 +104,4 @@ public:
|
|||||||
Graphics();
|
Graphics();
|
||||||
|
|
||||||
void SwapClipRect(Rect<int> &);
|
void SwapClipRect(Rect<int> &);
|
||||||
[[deprecated("Use SwapClipRect")]]
|
|
||||||
void SetClipRect(int &x, int &y, int &w, int &h);
|
|
||||||
};
|
};
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
typedef uint32_t pixel;
|
typedef uint32_t pixel;
|
||||||
|
|
||||||
constexpr int PIXELCHANNELS = 3;
|
constexpr int PIXELCHANNELS = 3;
|
||||||
[[deprecated("Avoid manipulating pixel* as char*")]]
|
|
||||||
constexpr int PIXELSIZE = 4;
|
|
||||||
|
|
||||||
// Least significant byte is blue, then green, then red, then alpha.
|
// Least significant byte is blue, then green, then red, then alpha.
|
||||||
// Use sparingly, e.g. when passing packed data to a third party library.
|
// Use sparingly, e.g. when passing packed data to a third party library.
|
||||||
|
@ -573,10 +573,7 @@ void GameView::NotifyToolListChanged(GameModel * sender)
|
|||||||
else
|
else
|
||||||
tempButton = new ToolButton(ui::Point(currentX, YRES+1), ui::Point(30, 18), tool->Name, tool->Identifier, tool->Description);
|
tempButton = new ToolButton(ui::Point(currentX, YRES+1), ui::Point(30, 18), tool->Name, tool->Identifier, tool->Description);
|
||||||
|
|
||||||
tempButton->clipRectX = 1;
|
tempButton->ClipRect = RectSized(Vec2(1, RES.Y + 1), Vec2(RES.X - 1, 18));
|
||||||
tempButton->clipRectY = YRES + 1;
|
|
||||||
tempButton->clipRectW = XRES - 1;
|
|
||||||
tempButton->clipRectH = 18;
|
|
||||||
|
|
||||||
//currentY -= 17;
|
//currentY -= 17;
|
||||||
currentX -= 31;
|
currentX -= 31;
|
||||||
@ -1848,11 +1845,8 @@ void GameView::DoDraw()
|
|||||||
|
|
||||||
c->Tick();
|
c->Tick();
|
||||||
{
|
{
|
||||||
int x = 0;
|
auto rect = g->Size().OriginRect();
|
||||||
int y = 0;
|
g->SwapClipRect(rect); // reset any nonsense cliprect Lua left configured
|
||||||
int w = WINDOWW;
|
|
||||||
int h = WINDOWH;
|
|
||||||
g->SetClipRect(x, y, w, h); // reset any nonsense cliprect Lua left configured
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,14 +45,10 @@ void ToolButton::OnMouseUp(int x, int y, unsigned int button)
|
|||||||
void ToolButton::Draw(const ui::Point& screenPos)
|
void ToolButton::Draw(const ui::Point& screenPos)
|
||||||
{
|
{
|
||||||
Graphics * g = GetGraphics();
|
Graphics * g = GetGraphics();
|
||||||
int x = clipRectX;
|
auto rect = ClipRect;
|
||||||
int y = clipRectY;
|
if (ClipRect.Size().X && ClipRect.Size().Y)
|
||||||
int w = clipRectW;
|
g->SwapClipRect(rect); // old cliprect is now in rect
|
||||||
int h = clipRectH;
|
|
||||||
if (clipRectW && clipRectH)
|
|
||||||
{
|
|
||||||
g->SetClipRect(x, y, w, h); // old cliprect is now in x, y, w, h
|
|
||||||
}
|
|
||||||
int totalColour = Appearance.BackgroundInactive.Blue + (3*Appearance.BackgroundInactive.Green) + (2*Appearance.BackgroundInactive.Red);
|
int totalColour = Appearance.BackgroundInactive.Blue + (3*Appearance.BackgroundInactive.Green) + (2*Appearance.BackgroundInactive.Red);
|
||||||
|
|
||||||
if (Appearance.GetTexture())
|
if (Appearance.GetTexture())
|
||||||
@ -85,10 +81,9 @@ void ToolButton::Draw(const ui::Point& screenPos)
|
|||||||
{
|
{
|
||||||
g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText, 0, 0, 0, 255);
|
g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText, 0, 0, 0, 255);
|
||||||
}
|
}
|
||||||
if (clipRectW && clipRectH)
|
|
||||||
{
|
if (ClipRect.Size().X && ClipRect.Size().Y)
|
||||||
g->SetClipRect(x, y, w, h); // apply old clip rect
|
g->SwapClipRect(rect); // apply old clip rect
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolButton::SetSelectionState(int state)
|
void ToolButton::SetSelectionState(int state)
|
||||||
|
@ -16,8 +16,5 @@ public:
|
|||||||
void SetSelectionState(int state);
|
void SetSelectionState(int state);
|
||||||
int GetSelectionState();
|
int GetSelectionState();
|
||||||
Tool *tool;
|
Tool *tool;
|
||||||
int clipRectX = 0;
|
Rect<int> ClipRect = RectSized(Vec2<int>::Zero, Vec2<int>::Zero);
|
||||||
int clipRectY = 0;
|
|
||||||
int clipRectW = 0;
|
|
||||||
int clipRectH = 0;
|
|
||||||
};
|
};
|
||||||
|
@ -3901,11 +3901,12 @@ int LuaScriptInterface::graphics_setClipRect(lua_State * l)
|
|||||||
int y = luaL_optinteger(l, 2, 0);
|
int y = luaL_optinteger(l, 2, 0);
|
||||||
int w = luaL_optinteger(l, 3, WINDOWW);
|
int w = luaL_optinteger(l, 3, WINDOWW);
|
||||||
int h = luaL_optinteger(l, 4, WINDOWH);
|
int h = luaL_optinteger(l, 4, WINDOWH);
|
||||||
luacon_g->SetClipRect(x, y, w, h);
|
auto rect = RectSized(Vec2(x, y), Vec2(w, h));
|
||||||
lua_pushinteger(l, x);
|
luacon_g->SwapClipRect(rect);
|
||||||
lua_pushinteger(l, y);
|
lua_pushinteger(l, rect.TopLeft.X);
|
||||||
lua_pushinteger(l, w);
|
lua_pushinteger(l, rect.TopLeft.Y);
|
||||||
lua_pushinteger(l, h);
|
lua_pushinteger(l, rect.Size().X);
|
||||||
|
lua_pushinteger(l, rect.Size().Y);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user