Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: src/effects/SkColorFilterImageFilter.cpp

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorFilters.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkColorFilterImageFilter.h" 8 #include "SkColorFilterImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 } 78 }
79 return SkNEW_ARGS(SkColorFilterImageFilter, (cf, input, cropRect, uniqueID)) ; 79 return SkNEW_ARGS(SkColorFilterImageFilter, (cf, input, cropRect, uniqueID)) ;
80 } 80 }
81 81
82 SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf, 82 SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
83 SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID) 83 SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID)
84 : INHERITED(1, &input, cropRect, uniqueID), fColorFilter(SkRef(cf)) { 84 : INHERITED(1, &input, cropRect, uniqueID), fColorFilter(SkRef(cf)) {
85 } 85 }
86 86
87 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
88 SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer) : INHER ITED(1, buffer) {
89 fColorFilter = buffer.readColorFilter();
90 // we aren't prepared for this to be NULL, and it can't ever be when we're N OT supporting
91 // SK_SUPPORT_LEGACY_DEEPFLATTENING, as we always go through a factory which can detect
92 // NULL. However, since here we're in the legacy code, we assign a dummy fil ter so we
93 // don't crash with a null-ptr.
94 if (NULL == fColorFilter) {
95 // colormatrix identity is effectively a no-op
96 fColorFilter = SkColorMatrixFilter::Create(SkColorMatrix());
97 SkASSERT(fColorFilter);
98 }
99 }
100 #endif
101
87 SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) { 102 SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) {
88 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 103 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
89 SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter()); 104 SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter());
90 return Create(cf, common.getInput(0), &common.cropRect(), common.uniqueID()) ; 105 return Create(cf, common.getInput(0), &common.cropRect(), common.uniqueID()) ;
91 } 106 }
92 107
93 void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const { 108 void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const {
94 this->INHERITED::flatten(buffer); 109 this->INHERITED::flatten(buffer);
95 buffer.writeFlattenable(fColorFilter); 110 buffer.writeFlattenable(fColorFilter);
96 } 111 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { 149 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const {
135 if (!cropRectIsSet()) { 150 if (!cropRectIsSet()) {
136 if (filter) { 151 if (filter) {
137 *filter = fColorFilter; 152 *filter = fColorFilter;
138 fColorFilter->ref(); 153 fColorFilter->ref();
139 } 154 }
140 return true; 155 return true;
141 } 156 }
142 return false; 157 return false;
143 } 158 }
OLDNEW
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorFilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698