From 60e8519544b9194d4a44db61fb5b0b10572282cc Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 11 Feb 2015 11:13:03 +0100 Subject: Solid and gradients in high color accuracy This patch updates the internal color precisions of solids and gradients to 16bit per color. This makes it possible to render at higher precision on non-premultiplied ARGB32, the RGB30 formats and any other hi-color formats if more are added. [ChangeLog][QtGui][Painting] Internal precision of solids and gradients is now up to 16bit per color. Change-Id: Ieae5468bd6de1f56adfa4cb9fa966faf2ed824fd Reviewed-by: Gunnar Sletta --- src/gui/painting/qrgba64.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/gui/painting/qrgba64.h') diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index 2ea09e6bd6..51ce4ab10d 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -88,6 +88,9 @@ public: return fromRgba(rgb >> 16, rgb >> 8, rgb, rgb >> 24); } + Q_DECL_CONSTEXPR bool isOpaque() const { return c.alpha == 0xffff; } + Q_DECL_CONSTEXPR bool isTransparent() const { return c.alpha == 0; } + Q_DECL_CONSTEXPR quint16 red() const { return c.red; } Q_DECL_CONSTEXPR quint16 green() const { return c.green; } Q_DECL_CONSTEXPR quint16 blue() const { return c.blue; } @@ -133,6 +136,12 @@ public: return rgba; } + QRgba64 operator=(quint64 _rgba) + { + rgba = _rgba; + return *this; + } + private: static Q_DECL_CONSTEXPR uint div_257_floor(uint x) { return (x - (x >> 8)) >> 8; } static Q_DECL_CONSTEXPR uint div_257(uint x) { return div_257_floor(x + 128); } -- cgit v1.2.3