diff options
author | 2012-06-04 19:07:41 +0000 | |
---|---|---|
committer | 2012-06-04 19:07:41 +0000 | |
commit | 7b6c19392cd980462908764b5ea17c4796610427 (patch) | |
tree | 9e0cac1213cd1d1c2a62e23adb0231711dee6367 /gm | |
parent | 4c8837867add05f8d25520f92f6ec52305dda02e (diff) |
remove mutable apis on SkColorMatrixFilter, must use constructor.
fix flattening to not write function-ptrs (no go for serialization), so we
store the raw float values now.
Slight change to GM/DRT images for GPU possible. Just rebaseline.
Review URL: https://codereview.appspot.com/6273052
git-svn-id: http://skia.googlecode.com/svn/trunk@4143 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/colormatrix.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp index cc5cfbc22a..518ccd0f50 100644 --- a/gm/colormatrix.cpp +++ b/gm/colormatrix.cpp @@ -27,6 +27,14 @@ private: mutable bool fOnce; }; +static void setColorMatrix(SkPaint* paint, const SkColorMatrix& matrix) { + paint->setColorFilter(SkNEW_ARGS(SkColorMatrixFilter, (matrix)))->unref(); +} + +static void setArray(SkPaint* paint, const SkScalar array[]) { + paint->setColorFilter(SkNEW_ARGS(SkColorMatrixFilter, (array)))->unref(); +} + namespace skiagm { class ColorMatrixGM : public GM { @@ -72,47 +80,45 @@ protected: SkPaint paint; SkColorMatrix matrix; - SkColorMatrixFilter* filter = new SkColorMatrixFilter(); - paint.setColorFilter(filter)->unref(); matrix.setIdentity(); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 0, 0, &paint); matrix.setRotate(SkColorMatrix::kR_Axis, 90); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 80, 0, &paint); matrix.setRotate(SkColorMatrix::kG_Axis, 90); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 160, 0, &paint); matrix.setRotate(SkColorMatrix::kB_Axis, 90); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 240, 0, &paint); matrix.setSaturation(SkFloatToScalar(0.0f)); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 0, 80, &paint); matrix.setSaturation(SkFloatToScalar(0.5f)); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 80, 80, &paint); matrix.setSaturation(SkFloatToScalar(1.0f)); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 160, 80, &paint); matrix.setSaturation(SkFloatToScalar(2.0f)); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 240, 80, &paint); matrix.setRGB2YUV(); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 0, 160, &paint); matrix.setYUV2RGB(); - filter->setMatrix(matrix); + setColorMatrix(&paint, matrix); canvas->drawBitmap(fBitmap, 80, 160, &paint); SkScalar s1 = SK_Scalar1; @@ -125,7 +131,7 @@ protected: s1, 0, 0, 0, 0, }; - filter->setArray(data); + setArray(&paint, data); canvas->drawBitmap(fBitmap, 160, 160, &paint); } |