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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Adapting code to sk_once changes Created 7 years, 1 month 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/SkLightingImageFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkMagnifierImageFilter.h" 9 #include "SkMagnifierImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkFlattenableBuffers.h" 11 #include "SkFlattenableBuffers.h"
12 #include "SkValidationUtils.h"
12 13
13 //////////////////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////////////////
14 #if SK_SUPPORT_GPU 15 #if SK_SUPPORT_GPU
15 #include "effects/GrSingleTextureEffect.h" 16 #include "effects/GrSingleTextureEffect.h"
16 #include "gl/GrGLEffect.h" 17 #include "gl/GrGLEffect.h"
17 #include "gl/GrGLSL.h" 18 #include "gl/GrGLSL.h"
18 #include "gl/GrGLTexture.h" 19 #include "gl/GrGLTexture.h"
19 #include "GrTBackendEffectFactory.h" 20 #include "GrTBackendEffectFactory.h"
20 21
21 class GrGLMagnifierEffect; 22 class GrGLMagnifierEffect;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 232
232 //////////////////////////////////////////////////////////////////////////////// 233 ////////////////////////////////////////////////////////////////////////////////
233 SkMagnifierImageFilter::SkMagnifierImageFilter(SkFlattenableReadBuffer& buffer) 234 SkMagnifierImageFilter::SkMagnifierImageFilter(SkFlattenableReadBuffer& buffer)
234 : INHERITED(buffer) { 235 : INHERITED(buffer) {
235 float x = buffer.readScalar(); 236 float x = buffer.readScalar();
236 float y = buffer.readScalar(); 237 float y = buffer.readScalar();
237 float width = buffer.readScalar(); 238 float width = buffer.readScalar();
238 float height = buffer.readScalar(); 239 float height = buffer.readScalar();
239 fSrcRect = SkRect::MakeXYWH(x, y, width, height); 240 fSrcRect = SkRect::MakeXYWH(x, y, width, height);
240 fInset = buffer.readScalar(); 241 fInset = buffer.readScalar();
242
243 buffer.validate(SkIsValidRect(fSrcRect) && SkScalarIsFinite(fInset));
241 } 244 }
242 245
243 // FIXME: implement single-input semantics 246 // FIXME: implement single-input semantics
244 SkMagnifierImageFilter::SkMagnifierImageFilter(SkRect srcRect, SkScalar inset) 247 SkMagnifierImageFilter::SkMagnifierImageFilter(SkRect srcRect, SkScalar inset)
245 : INHERITED(0), fSrcRect(srcRect), fInset(inset) { 248 : INHERITED(0), fSrcRect(srcRect), fInset(inset) {
246 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); 249 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0);
247 } 250 }
248 251
249 #if SK_SUPPORT_GPU 252 #if SK_SUPPORT_GPU
250 bool SkMagnifierImageFilter::asNewEffect(GrEffectRef** effect, GrTexture* textur e, const SkMatrix&, const SkIRect&) const { 253 bool SkMagnifierImageFilter::asNewEffect(GrEffectRef** effect, GrTexture* textur e, const SkMatrix&, const SkIRect&) const {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 334
332 int x_val = SkMin32(SkScalarFloorToInt(x_interp), width - 1); 335 int x_val = SkMin32(SkScalarFloorToInt(x_interp), width - 1);
333 int y_val = SkMin32(SkScalarFloorToInt(y_interp), height - 1); 336 int y_val = SkMin32(SkScalarFloorToInt(y_interp), height - 1);
334 337
335 *dptr = sptr[y_val * width + x_val]; 338 *dptr = sptr[y_val * width + x_val];
336 dptr++; 339 dptr++;
337 } 340 }
338 } 341 }
339 return true; 342 return true;
340 } 343 }
OLDNEW
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698