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

Side by Side Diff: src/core/SkImageFilter.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 | « include/effects/SkXfermodeImageFilter.h ('k') | src/effects/SkAlphaThresholdFilter.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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 14 matching lines...) Expand all
25 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR ect* cropRect) 25 SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR ect* cropRect)
26 : fInputCount(inputCount), 26 : fInputCount(inputCount),
27 fInputs(new SkImageFilter*[inputCount]), 27 fInputs(new SkImageFilter*[inputCount]),
28 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) { 28 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
29 for (int i = 0; i < inputCount; ++i) { 29 for (int i = 0; i < inputCount; ++i) {
30 fInputs[i] = inputs[i]; 30 fInputs[i] = inputs[i];
31 SkSafeRef(fInputs[i]); 31 SkSafeRef(fInputs[i]);
32 } 32 }
33 } 33 }
34 34
35 SkImageFilter::SkImageFilter(SkImageFilter* input, const CropRect* cropRect)
36 : fInputCount(1),
37 fInputs(new SkImageFilter*[1]),
38 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
39 fInputs[0] = input;
40 SkSafeRef(fInputs[0]);
41 }
42
43 SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect)
44 : fInputCount(2), fInputs(new SkImageFilter*[2]),
45 fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
46 fInputs[0] = input1;
47 fInputs[1] = input2;
48 SkSafeRef(fInputs[0]);
49 SkSafeRef(fInputs[1]);
50 }
51
52 SkImageFilter::~SkImageFilter() { 35 SkImageFilter::~SkImageFilter() {
53 for (int i = 0; i < fInputCount; i++) { 36 for (int i = 0; i < fInputCount; i++) {
54 SkSafeUnref(fInputs[i]); 37 SkSafeUnref(fInputs[i]);
55 } 38 }
56 delete[] fInputs; 39 delete[] fInputs;
57 } 40 }
58 41
59 SkImageFilter::SkImageFilter(int inputCount, SkReadBuffer& buffer) { 42 SkImageFilter::SkImageFilter(int inputCount, SkReadBuffer& buffer) {
60 fInputCount = buffer.readInt(); 43 fInputCount = buffer.readInt();
61 if (buffer.validate((fInputCount >= 0) && ((inputCount < 0) || (fInputCount == inputCount)))) { 44 if (buffer.validate((fInputCount >= 0) && ((inputCount < 0) || (fInputCount == inputCount)))) {
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 421
439 CacheImpl::~CacheImpl() { 422 CacheImpl::~CacheImpl() {
440 SkTDynamicHash<Value, Key>::Iter iter(&fData); 423 SkTDynamicHash<Value, Key>::Iter iter(&fData);
441 424
442 while (!iter.done()) { 425 while (!iter.done()) {
443 Value* v = &*iter; 426 Value* v = &*iter;
444 ++iter; 427 ++iter;
445 delete v; 428 delete v;
446 } 429 }
447 } 430 }
OLDNEW
« no previous file with comments | « include/effects/SkXfermodeImageFilter.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698