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

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

Issue 92793002: Fixed bad bitmap size crashes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Changed getSize name to getAllocatedSizeInBytes Created 7 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 | Annotate | Revision Log
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 "SkMorphologyImageFilter.h" 8 #include "SkMorphologyImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return false; 181 return false;
182 } 182 }
183 183
184 SkAutoLockPixels alp(src); 184 SkAutoLockPixels alp(src);
185 if (!src.getPixels()) { 185 if (!src.getPixels()) {
186 return false; 186 return false;
187 } 187 }
188 188
189 dst->setConfig(src.config(), bounds.width(), bounds.height()); 189 dst->setConfig(src.config(), bounds.width(), bounds.height());
190 dst->allocPixels(); 190 dst->allocPixels();
191 if (!dst->getPixels()) {
192 return false;
193 }
191 194
192 int width = radius().width(); 195 int width = radius().width();
193 int height = radius().height(); 196 int height = radius().height();
194 197
195 if (width < 0 || height < 0) { 198 if (width < 0 || height < 0) {
196 return false; 199 return false;
197 } 200 }
198 201
199 if (width == 0 && height == 0) { 202 if (width == 0 && height == 0) {
200 src.extractSubset(dst, bounds); 203 src.extractSubset(dst, bounds);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return false; 243 return false;
241 } 244 }
242 245
243 SkAutoLockPixels alp(src); 246 SkAutoLockPixels alp(src);
244 if (!src.getPixels()) { 247 if (!src.getPixels()) {
245 return false; 248 return false;
246 } 249 }
247 250
248 dst->setConfig(src.config(), bounds.width(), bounds.height()); 251 dst->setConfig(src.config(), bounds.width(), bounds.height());
249 dst->allocPixels(); 252 dst->allocPixels();
253 if (!dst->getPixels()) {
254 return false;
255 }
250 256
251 int width = radius().width(); 257 int width = radius().width();
252 int height = radius().height(); 258 int height = radius().height();
253 259
254 if (width < 0 || height < 0) { 260 if (width < 0 || height < 0) {
255 return false; 261 return false;
256 } 262 }
257 263
258 if (width == 0 && height == 0) { 264 if (width == 0 && height == 0) {
259 src.extractSubset(dst, bounds); 265 src.extractSubset(dst, bounds);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 620
615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy pe, radius(), result)) { 621 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy pe, radius(), result)) {
616 return false; 622 return false;
617 } 623 }
618 offset->fX += bounds.left(); 624 offset->fX += bounds.left();
619 offset->fY += bounds.top(); 625 offset->fY += bounds.top();
620 return true; 626 return true;
621 } 627 }
622 628
623 #endif 629 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698