diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/cru/platform/graph/text_layout.hpp | 2 | ||||
-rw-r--r-- | include/cru/platform/graph_base.hpp | 5 | ||||
-rw-r--r-- | include/cru/win/graph/direct/text_layout.hpp | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/cru/platform/graph/text_layout.hpp b/include/cru/platform/graph/text_layout.hpp index 20009c0d..0d104742 100644 --- a/include/cru/platform/graph/text_layout.hpp +++ b/include/cru/platform/graph/text_layout.hpp @@ -17,7 +17,7 @@ struct ITextLayout : virtual IGraphResource { virtual Rect GetTextBounds() = 0; virtual std::vector<Rect> TextRangeRect(const TextRange& text_range) = 0; - virtual Point TextSingleRect(int position, bool trailing) = 0; + virtual Point TextSingleRect(gsl::index position, bool trailing) = 0; virtual TextHitTestResult HitTest(const Point& point) = 0; }; } // namespace cru::platform::graph diff --git a/include/cru/platform/graph_base.hpp b/include/cru/platform/graph_base.hpp index f25a7baf..0b997770 100644 --- a/include/cru/platform/graph_base.hpp +++ b/include/cru/platform/graph_base.hpp @@ -218,6 +218,11 @@ struct TextRange final { return TextRange(start, end - start); } + constexpr static TextRange FromTwoSides(gsl::index start, gsl::index end, + gsl::index offset) { + return TextRange(start + offset, end - start); + } + constexpr TextRange() = default; constexpr TextRange(const gsl::index position, const gsl::index count = 0) : position(position), count(count) {} diff --git a/include/cru/win/graph/direct/text_layout.hpp b/include/cru/win/graph/direct/text_layout.hpp index 462a5fd3..a9b89011 100644 --- a/include/cru/win/graph/direct/text_layout.hpp +++ b/include/cru/win/graph/direct/text_layout.hpp @@ -38,7 +38,7 @@ class DWriteTextLayout : public DirectGraphResource, Rect GetTextBounds() override; std::vector<Rect> TextRangeRect(const TextRange& text_range) override; - Point TextSingleRect(int position, bool trailing) override; + Point TextSingleRect(gsl::index position, bool trailing) override; TextHitTestResult HitTest(const Point& point) override; private: |