srb2::Draw: add clip method, optionally switch between draw chain's cliprect or global cliprect

This commit is contained in:
James R 2024-01-26 02:04:12 -08:00
parent 510c82ca6d
commit 9adf6e9568
2 changed files with 13 additions and 0 deletions

View file

@ -154,6 +154,12 @@ public:
Chain& clipx() { return clipx(x_, x_ + width_); }
Chain& clipy() { return clipy(y_, y_ + height_); }
// True to use internal clipping state
// False to use global state (default)
// Changing the clipping dimensions implicitly sets
// this to true
Chain& clip(bool yes);
Chain& colormap(const UINT8* colormap);
Chain& colormap(UINT16 color);
Chain& colormap(INT32 skin, UINT16 color);
@ -255,6 +261,7 @@ public:
METHOD(stretch);
METHOD(clipx);
METHOD(clipy);
METHOD(clip);
METHOD(colormap);
METHOD(colorize);

View file

@ -99,6 +99,12 @@ inline Draw::Chain& Draw::Chain::clipy(float top, float bottom)
return *this;
}
inline Draw::Chain& Draw::Chain::clip(bool yes)
{
clip_ = yes;
return *this;
}
inline Draw::Chain& Draw::Chain::colormap(const UINT8* colormap)
{
colormap_ = colormap;