From 9adf6e9568eb793553a2b5059a1e4ac93b23e955 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 26 Jan 2024 02:04:12 -0800 Subject: [PATCH] srb2::Draw: add clip method, optionally switch between draw chain's cliprect or global cliprect --- src/v_draw.hpp | 7 +++++++ src/v_draw_setter.hpp | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/v_draw.hpp b/src/v_draw.hpp index 310a5d662..b7ec5e1d9 100644 --- a/src/v_draw.hpp +++ b/src/v_draw.hpp @@ -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); diff --git a/src/v_draw_setter.hpp b/src/v_draw_setter.hpp index d8e39d97a..3a21e691a 100644 --- a/src/v_draw_setter.hpp +++ b/src/v_draw_setter.hpp @@ -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;