diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-21 18:46:30 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-21 18:46:30 +0000 |
commit | 727a352f7412753d2a3e4d30eab6500a1a4de135 (patch) | |
tree | ca4bee87d3a35d583ddae5d90f1b123e0f18b036 /src | |
parent | a3baf3be0e2a3128fb73bd41d40d130f75a4dc86 (diff) |
Factory methods for heap-allocated SkColorFilter objects.
This is part of an effort to ensure that all SkPaint effects can only be
allocated on the heap.
This patch makes the constructors of SkColorFilter and its subclasses non-public
and instead provides factory methods for creating these objects on the heap. We
temporarily keep constructor of publicly visible classes public behind a flag.
BUG=skia:2187
R=scroggo@google.com, mtklein@google.com, reed@google.com
Author: dominikg@chromium.org
Review URL: https://codereview.chromium.org/175293002
git-svn-id: http://skia.googlecode.com/svn/trunk@13539 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rwxr-xr-x | src/effects/SkColorFilterImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkColorFilters.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
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) |