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

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

Issue 376953003: Clean up SkImageFilter constructors. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed 100-col issues Created 6 years, 5 months 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/SkMatrixImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.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 "SkMergeImageFilter.h" 8 #include "SkMergeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 22 matching lines...) Expand all
33 this->initAllocModes(); 33 this->initAllocModes();
34 int inputCount = countInputs(); 34 int inputCount = countInputs();
35 for (int i = 0; i < inputCount; ++i) { 35 for (int i = 0; i < inputCount; ++i) {
36 fModes[i] = SkToU8(modes[i]); 36 fModes[i] = SkToU8(modes[i]);
37 } 37 }
38 } else { 38 } else {
39 fModes = NULL; 39 fModes = NULL;
40 } 40 }
41 } 41 }
42 42
43 SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* seco nd,
44 SkXfermode::Mode mode,
45 const CropRect* cropRect) : INHERITED(fir st, second, cropRect) {
46 if (SkXfermode::kSrcOver_Mode != mode) {
47 SkXfermode::Mode modes[] = { mode, mode };
48 this->initModes(modes);
49 } else {
50 fModes = NULL;
51 }
52 }
53
54 SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count, 43 SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count,
55 const SkXfermode::Mode modes[], 44 const SkXfermode::Mode modes[],
56 const CropRect* cropRect) : INHERITED(cou nt, filters, cropRect) { 45 const CropRect* cropRect) : INHERITED(cou nt, filters, cropRect) {
57 SkASSERT(count >= 0); 46 SkASSERT(count >= 0);
58 this->initModes(modes); 47 this->initModes(modes);
59 } 48 }
60 49
61 SkMergeImageFilter::~SkMergeImageFilter() { 50 SkMergeImageFilter::~SkMergeImageFilter() {
62 51
63 if (fModes != SkTCast<uint8_t*>(fStorage)) { 52 if (fModes != SkTCast<uint8_t*>(fStorage)) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (buffer.validate(buffer.getArrayCount() == size) && 125 if (buffer.validate(buffer.getArrayCount() == size) &&
137 buffer.readByteArray(fModes, size)) { 126 buffer.readByteArray(fModes, size)) {
138 for (int i = 0; i < nbInputs; ++i) { 127 for (int i = 0; i < nbInputs; ++i) {
139 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i])); 128 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i]));
140 } 129 }
141 } 130 }
142 } else { 131 } else {
143 fModes = 0; 132 fModes = 0;
144 } 133 }
145 } 134 }
OLDNEW
« no previous file with comments | « src/effects/SkMatrixImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698