OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 return NULL; | 21 return NULL; |
22 } | 22 } |
23 | 23 |
24 SkColorFilter* inputCF; | 24 SkColorFilter* inputCF; |
25 if (input && input->isColorFilterNode(&inputCF)) { | 25 if (input && input->isColorFilterNode(&inputCF)) { |
26 // This is an optimization, as it collapses the hierarchy by just combin
ing the two | 26 // This is an optimization, as it collapses the hierarchy by just combin
ing the two |
27 // colorfilters into a single one, which the new imagefilter will wrap. | 27 // colorfilters into a single one, which the new imagefilter will wrap. |
28 SkAutoUnref autoUnref(inputCF); | 28 SkAutoUnref autoUnref(inputCF); |
29 SkAutoTUnref<SkColorFilter> newCF(SkColorFilter::CreateComposeFilter(cf,
inputCF)); | 29 SkAutoTUnref<SkColorFilter> newCF(SkColorFilter::CreateComposeFilter(cf,
inputCF)); |
30 if (newCF) { | 30 if (newCF) { |
31 return SkNEW_ARGS(SkColorFilterImageFilter, (newCF, input->getInput(
0), cropRect)); | 31 return new SkColorFilterImageFilter(newCF, input->getInput(0), cropR
ect); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 return SkNEW_ARGS(SkColorFilterImageFilter, (cf, input, cropRect)); | 35 return new SkColorFilterImageFilter(cf, input, cropRect); |
36 } | 36 } |
37 | 37 |
38 SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf, | 38 SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf, |
39 SkImageFilter* input, const CropRect* cropRect) | 39 SkImageFilter* input, const CropRect* cropRect) |
40 : INHERITED(1, &input, cropRect), fColorFilter(SkRef(cf)) { | 40 : INHERITED(1, &input, cropRect), fColorFilter(SkRef(cf)) { |
41 } | 41 } |
42 | 42 |
43 SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) { | 43 SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) { |
44 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 44 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
45 SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter()); | 45 SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (this->getInput(0)) { | 111 if (this->getInput(0)) { |
112 this->getInput(0)->toString(str); | 112 this->getInput(0)->toString(str); |
113 } | 113 } |
114 | 114 |
115 str->appendf(") color filter: "); | 115 str->appendf(") color filter: "); |
116 fColorFilter->toString(str); | 116 fColorFilter->toString(str); |
117 | 117 |
118 str->append(")"); | 118 str->append(")"); |
119 } | 119 } |
120 #endif | 120 #endif |
OLD | NEW |