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

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

Issue 83343003: Adding more validation (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed comments 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
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkColorFilterImageFilter.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 2011 The Android Open Source Project 2 * Copyright 2011 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkFlattenableBuffers.h" 11 #include "SkFlattenableBuffers.h"
12 #include "SkGpuBlurUtils.h" 12 #include "SkGpuBlurUtils.h"
13 #include "SkBlurImage_opts.h" 13 #include "SkBlurImage_opts.h"
14 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "SkImageFilterUtils.h" 16 #include "SkImageFilterUtils.h"
17 #endif 17 #endif
18 18
19 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer) 19 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer)
20 : INHERITED(buffer) { 20 : INHERITED(1, buffer) {
21 fSigma.fWidth = buffer.readScalar(); 21 fSigma.fWidth = buffer.readScalar();
22 fSigma.fHeight = buffer.readScalar(); 22 fSigma.fHeight = buffer.readScalar();
23 buffer.validate(SkScalarIsFinite(fSigma.fWidth) && 23 buffer.validate(SkScalarIsFinite(fSigma.fWidth) &&
24 SkScalarIsFinite(fSigma.fHeight) && 24 SkScalarIsFinite(fSigma.fHeight) &&
25 (fSigma.fWidth >= 0) && 25 (fSigma.fWidth >= 0) &&
26 (fSigma.fHeight >= 0)); 26 (fSigma.fHeight >= 0));
27 } 27 }
28 28
29 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, 29 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX,
30 SkScalar sigmaY, 30 SkScalar sigmaY,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 fSigma.width(), 234 fSigma.width(),
235 fSigma.height())); 235 fSigma.height()));
236 offset->fX += rect.fLeft; 236 offset->fX += rect.fLeft;
237 offset->fY += rect.fTop; 237 offset->fY += rect.fTop;
238 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); 238 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult);
239 #else 239 #else
240 SkDEBUGFAIL("Should not call in GPU-less build"); 240 SkDEBUGFAIL("Should not call in GPU-less build");
241 return false; 241 return false;
242 #endif 242 #endif
243 } 243 }
OLDNEW
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698