From 27e2143172bf04fe763d5aad0bc3aee236be4d2a Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 4 Jun 2020 16:52:04 +0000 Subject: [PATCH] Draw: Image::IsOpaque, ScanOpaque(Image&), iml now using ScanOpaque git-svn-id: svn://ultimatepp.org/upp/trunk@14549 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/Image.h | 1 + uppsrc/Draw/ImageOp.cpp | 7 +++++++ uppsrc/Draw/ImageOp.h | 2 ++ uppsrc/Draw/Iml.cpp | 1 + 4 files changed, 11 insertions(+) diff --git a/uppsrc/Draw/Image.h b/uppsrc/Draw/Image.h index 141e60c09..85884d084 100644 --- a/uppsrc/Draw/Image.h +++ b/uppsrc/Draw/Image.h @@ -186,6 +186,7 @@ public: int GetKindNoScan() const; int GetKind() const; int GetResolution() const; + bool IsOpaque() const { return GetKind() == IMAGE_OPAQUE; } const RGBA *Begin() const { return data ? ~data->buffer : NULL; } const RGBA *begin() const { return Begin(); } diff --git a/uppsrc/Draw/ImageOp.cpp b/uppsrc/Draw/ImageOp.cpp index 34017c06a..1db8446b5 100644 --- a/uppsrc/Draw/ImageOp.cpp +++ b/uppsrc/Draw/ImageOp.cpp @@ -61,6 +61,13 @@ Image CreateImage(Size sz, Color color) return CreateImage(sz, (RGBA)color); } +void ScanOpaque(Image& m) +{ + ImageBuffer ib(m); + ib.SetKind(ib.ScanKind()); + m = ib; +} + force_inline Size DstSrc(ImageBuffer& dest, Point& p, const Image& src, Rect& sr) { if(p.x < 0) { diff --git a/uppsrc/Draw/ImageOp.h b/uppsrc/Draw/ImageOp.h index ab2d8965d..631e3d1cb 100644 --- a/uppsrc/Draw/ImageOp.h +++ b/uppsrc/Draw/ImageOp.h @@ -11,6 +11,8 @@ void SetResolution(Image& m, int res); Image WithResolution(const Image& m, int res); Image WithResolution(const Image& m, const Image& res); +void ScanOpaque(Image& m); + void Over(ImageBuffer& dest, Point p, const Image& src, const Rect& srect); void Over(Image& dest, const Image& src); void Copy(ImageBuffer& dest, Point p, const Image& src, const Rect& srect); diff --git a/uppsrc/Draw/Iml.cpp b/uppsrc/Draw/Iml.cpp index 9827d497d..f6342571c 100644 --- a/uppsrc/Draw/Iml.cpp +++ b/uppsrc/Draw/Iml.cpp @@ -134,6 +134,7 @@ Image Iml::Get(int i) } if(!IsNull(m.image) && (mode & GUI_MODE_UHD)) // this is to support legacy code mostly SetResolution(m.image, IMAGE_RESOLUTION_UHD); + ScanOpaque(m.image); } m.loaded = true; }