diff options
-rw-r--r-- | bench/ColorFilterBench.cpp | 4 | ||||
-rw-r--r-- | gm/colorfilterimagefilter.cpp | 4 | ||||
-rw-r--r-- | gm/colormatrix.cpp | 4 | ||||
-rw-r--r-- | gm/imagefiltersgraph.cpp | 6 | ||||
-rw-r--r-- | include/effects/SkColorMatrixFilter.h | 14 | ||||
-rwxr-xr-x | src/effects/SkColorFilterImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkColorFilters.cpp | 2 | ||||
-rw-r--r-- | tests/GLProgramsTest.cpp | 2 | ||||
-rw-r--r-- | tests/ImageFilterTest.cpp | 4 |
9 files changed, 26 insertions, 16 deletions
diff --git a/bench/ColorFilterBench.cpp b/bench/ColorFilterBench.cpp index 9fec587b5c..3d9515477c 100644 --- a/bench/ColorFilterBench.cpp +++ b/bench/ColorFilterBench.cpp @@ -33,7 +33,7 @@ protected: 0, 1, 0, 0, amount255, 0, 0, 1, 0, amount255, 0, 0, 0, 1, 0 }; - SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix)); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); return SkColorFilterImageFilter::Create(filter, input); } @@ -44,7 +44,7 @@ protected: matrix[1] = matrix[6] = matrix[11] = 0.7152f; matrix[2] = matrix[7] = matrix[12] = 0.0722f; matrix[18] = 1.0f; - SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix)); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); return SkColorFilterImageFilter::Create(filter, input); } diff --git a/gm/colorfilterimagefilter.cpp b/gm/colorfilterimagefilter.cpp index 3227dfba17..f2f46fd888 100644 --- a/gm/colorfilterimagefilter.cpp +++ b/gm/colorfilterimagefilter.cpp @@ -28,7 +28,7 @@ static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL) 0, 1, 0, 0, amount255, 0, 0, 1, 0, amount255, 0, 0, 0, 1, 0 }; - SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix)); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); return SkColorFilterImageFilter::Create(filter, input); } @@ -39,7 +39,7 @@ static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) { matrix[1] = matrix[6] = matrix[11] = 0.7152f; matrix[2] = matrix[7] = matrix[12] = 0.0722f; matrix[18] = 1.0f; - SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix)); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); return SkColorFilterImageFilter::Create(filter, input); } diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp index e0dcfaf72e..862bdf9d51 100644 --- a/gm/colormatrix.cpp +++ b/gm/colormatrix.cpp @@ -29,11 +29,11 @@ private: }; static void setColorMatrix(SkPaint* paint, const SkColorMatrix& matrix) { - paint->setColorFilter(SkNEW_ARGS(SkColorMatrixFilter, (matrix)))->unref(); + paint->setColorFilter(SkColorMatrixFilter::Create(matrix))->unref(); } static void setArray(SkPaint* paint, const SkScalar array[]) { - paint->setColorFilter(SkNEW_ARGS(SkColorMatrixFilter, (array)))->unref(); + paint->setColorFilter(SkColorMatrixFilter::Create(array))->unref(); } namespace skiagm { diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp index 882918cb7b..f97072e443 100644 --- a/gm/imagefiltersgraph.cpp +++ b/gm/imagefiltersgraph.cpp @@ -142,7 +142,7 @@ protected: 0, 0, SK_Scalar1, 0, 0, 0, 0, 0, 0.5f, 0 }; - SkAutoTUnref<SkColorFilter> matrixFilter(new SkColorMatrixFilter(matrix)); + SkAutoTUnref<SkColorFilter> matrixFilter(SkColorMatrixFilter::Create(matrix)); SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Create(matrixFilter, morph)); SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode)); SkAutoTUnref<SkImageFilter> blendColor(new SkXfermodeImageFilter(mode, colorMorph)); @@ -157,8 +157,8 @@ protected: 0, SK_Scalar1, 0, 0, 0, 0, 0, SK_Scalar1, 0, 0, 0, 0, 0, 0.5f, 0 }; - SkColorMatrixFilter matrixCF(matrix); - SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::Create(&matrixCF)); + SkAutoTUnref<SkColorMatrixFilter> matrixCF(SkColorMatrixFilter::Create(matrix)); + SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::Create(matrixCF)); SimpleOffsetFilter offsetFilter(SkIntToScalar(10), SkIntToScalar(10), matrixFilter); SkAutoTUnref<SkXfermode> arith(SkArithmeticMode::Create(0, SK_Scalar1, SK_Scalar1, 0)); diff --git a/include/effects/SkColorMatrixFilter.h b/include/effects/SkColorMatrixFilter.h index a4144e1717..785d682c99 100644 --- a/include/effects/SkColorMatrixFilter.h +++ b/include/effects/SkColorMatrixFilter.h @@ -13,8 +13,12 @@ class SK_API SkColorMatrixFilter : public SkColorFilter { public: - explicit SkColorMatrixFilter(const SkColorMatrix&); - SkColorMatrixFilter(const SkScalar array[20]); + static SkColorMatrixFilter* Create(const SkColorMatrix& cm) { + return SkNEW_ARGS(SkColorMatrixFilter, (cm)); + } + static SkColorMatrixFilter* Create(const SkScalar array[20]) { + return SkNEW_ARGS(SkColorMatrixFilter, (array)); + } // overrides from SkColorFilter virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE; @@ -38,6 +42,12 @@ protected: SkColorMatrixFilter(SkReadBuffer& buffer); virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; +#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS +public: +#endif + explicit SkColorMatrixFilter(const SkColorMatrix&); + SkColorMatrixFilter(const SkScalar array[20]); + private: SkColorMatrix fMatrix; diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp index 1f92d1683d..c8256919dc 100755 --- a/src/effects/SkColorFilterImageFilter.cpp +++ b/src/effects/SkColorFilterImageFilter.cpp @@ -69,7 +69,7 @@ SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf, if (inputColorFilter->asColorMatrix(inputMatrix) && !matrix_needs_clamping(inputMatrix)) { SkScalar combinedMatrix[20]; mult_color_matrix(inputMatrix, colorMatrix, combinedMatrix); - SkAutoTUnref<SkColorFilter> newCF(SkNEW_ARGS(SkColorMatrixFilter, (combinedMatrix))); + SkAutoTUnref<SkColorFilter> newCF(SkColorMatrixFilter::Create(combinedMatrix)); return SkNEW_ARGS(SkColorFilterImageFilter, (newCF, input->getInput(0), cropRect)); } } diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp index ab32bc6636..bd5ecacdce 100644 --- a/src/effects/SkColorFilters.cpp +++ b/src/effects/SkColorFilters.cpp @@ -557,7 +557,7 @@ SkColorFilter* SkColorFilter::CreateLightingFilter(SkColor mul, SkColor add) { SkIntToScalar(SkColorGetG(add)), SkIntToScalar(SkColorGetB(add)), 0); - return SkNEW_ARGS(SkColorMatrixFilter, (matrix)); + return SkColorMatrixFilter::Create(matrix); } SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter) diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 24312eed8d..552574c5a9 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -263,7 +263,7 @@ void forceLinking() { GrConfigConversionEffect::kNone_PMConversion, SkMatrix::I()); SkScalar matrix[20]; - SkColorMatrixFilter cmf(matrix); + SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); } #endif diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 41af243782..96dc959950 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -108,7 +108,7 @@ static SkImageFilter* make_scale(float amount, SkImageFilter* input = NULL) { 0, s, 0, 0, 0, 0, 0, s, 0, 0, 0, 0, 0, s, 0 }; - SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix)); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); return SkColorFilterImageFilter::Create(filter, input); } @@ -119,7 +119,7 @@ static SkImageFilter* make_grayscale(SkImageFilter* input = NULL, const SkImageF matrix[1] = matrix[6] = matrix[11] = 0.7152f; matrix[2] = matrix[7] = matrix[12] = 0.0722f; matrix[18] = 1.0f; - SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix)); + SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); return SkColorFilterImageFilter::Create(filter, input, cropRect); } |