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

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

Issue 461253007: fix leak in new createproc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 86 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
87 SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer) 87 SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer)
88 : INHERITED(1, buffer) { 88 : INHERITED(1, buffer) {
89 fColorFilter = buffer.readColorFilter(); 89 fColorFilter = buffer.readColorFilter();
90 } 90 }
91 #endif 91 #endif
92 92
93 SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) { 93 SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) {
94 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 94 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
95 return Create(buffer.readColorFilter(), common.getInput(0), &common.cropRect ()); 95 SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter());
96 return Create(cf, common.getInput(0), &common.cropRect());
96 } 97 }
97 98
98 void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const { 99 void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const {
99 this->INHERITED::flatten(buffer); 100 this->INHERITED::flatten(buffer);
100 buffer.writeFlattenable(fColorFilter); 101 buffer.writeFlattenable(fColorFilter);
101 } 102 }
102 103
103 SkColorFilterImageFilter::~SkColorFilterImageFilter() { 104 SkColorFilterImageFilter::~SkColorFilterImageFilter() {
104 SkSafeUnref(fColorFilter); 105 SkSafeUnref(fColorFilter);
105 } 106 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { 140 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const {
140 if (!cropRectIsSet()) { 141 if (!cropRectIsSet()) {
141 if (filter) { 142 if (filter) {
142 *filter = fColorFilter; 143 *filter = fColorFilter;
143 fColorFilter->ref(); 144 fColorFilter->ref();
144 } 145 }
145 return true; 146 return true;
146 } 147 }
147 return false; 148 return false;
148 } 149 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698