From c3e159a325892e5a271c06285631c2f5a2277617 Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Thu, 5 Jan 2012 16:59:27 +0000 Subject: When applying a color matrix, unpremultiply the source, and premultiply the result. Review URL: http://codereview.appspot.com/5520046/ git-svn-id: http://skia.googlecode.com/svn/trunk@2969 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/colormatrix.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gm/colormatrix.cpp') diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp index 7d57b3278b..0a4acfd84f 100644 --- a/gm/colormatrix.cpp +++ b/gm/colormatrix.cpp @@ -90,6 +90,19 @@ protected: matrix.setYUV2RGB(); filter->setMatrix(matrix); canvas->drawBitmap(fBitmap, 80, 160, &paint); + + SkScalar s1 = SK_Scalar1; + SkScalar s255 = SkIntToScalar(255); + // Move red into alpha, set color to white + SkScalar data[20] = { + 0, 0, 0, 0, s255, + 0, 0, 0, 0, s255, + 0, 0, 0, 0, s255, + s1, 0, 0, 0, 0, + }; + + filter->setArray(data); + canvas->drawBitmap(fBitmap, 160, 160, &paint); } private: -- cgit v1.2.3