aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/colormatrix.cpp
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-05 16:59:27 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-05 16:59:27 +0000
commitc3e159a325892e5a271c06285631c2f5a2277617 (patch)
treeb78a1e201fcff61e402ee1b558ce0fee37ee675e /gm/colormatrix.cpp
parentdc9a695a62ffe0f18e2835bffd325b60b64b547b (diff)
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
Diffstat (limited to 'gm/colormatrix.cpp')
-rw-r--r--gm/colormatrix.cpp13
1 files changed, 13 insertions, 0 deletions
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: