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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: New SkSecureReadBuffer class Created 7 years, 3 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 | Annotate | Revision Log
« src/core/SkWriter32.cpp ('K') | « src/core/SkWriter32.cpp ('k') | 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 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 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 #include "GrContext.h" 14 #include "GrContext.h"
15 #include "SkImageFilterUtils.h" 15 #include "SkImageFilterUtils.h"
16 #endif 16 #endif
17 17
18 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer) 18 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer)
19 : INHERITED(buffer) { 19 : INHERITED(buffer) {
20 fSigma.fWidth = buffer.readScalar(); 20 fSigma.fWidth = buffer.readScalar();
21 fSigma.fHeight = buffer.readScalar(); 21 fSigma.fHeight = buffer.readScalar();
22 if (!SkScalarIsFinite(fSigma.fWidth) ||
23 !SkScalarIsFinite(fSigma.fHeight) ||
24 (fSigma.fWidth < 0) ||
25 (fSigma.fHeight < 0)) {
26 buffer.setError();
reed1 2013/08/29 19:08:22 Might add a helper for this pattern (now or later)
sugoi1 2013/08/29 19:39:40 Done. Called it validateData() for now.
27 }
22 } 28 }
23 29
24 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, 30 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX,
25 SkScalar sigmaY, 31 SkScalar sigmaY,
26 SkImageFilter* input, 32 SkImageFilter* input,
27 const SkIRect* cropRect) 33 const SkIRect* cropRect)
28 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { 34 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) {
29 SkASSERT(sigmaX >= 0 && sigmaY >= 0); 35 SkASSERT(sigmaX >= 0 && sigmaY >= 0);
30 } 36 }
31 37
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 fSigma.width(), 233 fSigma.width(),
228 fSigma.height())); 234 fSigma.height()));
229 offset->fX += rect.fLeft; 235 offset->fX += rect.fLeft;
230 offset->fY += rect.fTop; 236 offset->fY += rect.fTop;
231 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); 237 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult);
232 #else 238 #else
233 SkDEBUGFAIL("Should not call in GPU-less build"); 239 SkDEBUGFAIL("Should not call in GPU-less build");
234 return false; 240 return false;
235 #endif 241 #endif
236 } 242 }
OLDNEW
« src/core/SkWriter32.cpp ('K') | « src/core/SkWriter32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698