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

Side by Side Diff: src/effects/SkBicubicImageFilter.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/core/SkImageFilter.cpp ('k') | src/effects/SkBitmapSource.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 2013 The Android Open Source Project 2 * Copyright 2013 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 "SkBicubicImageFilter.h" 8 #include "SkBicubicImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 22 matching lines...) Expand all
33 : INHERITED(input), 33 : INHERITED(input),
34 fScale(scale) { 34 fScale(scale) {
35 memcpy(fCoefficients, coefficients, sizeof(fCoefficients)); 35 memcpy(fCoefficients, coefficients, sizeof(fCoefficients));
36 } 36 }
37 37
38 SkBicubicImageFilter* SkBicubicImageFilter::CreateMitchell(const SkSize& scale, 38 SkBicubicImageFilter* SkBicubicImageFilter::CreateMitchell(const SkSize& scale,
39 SkImageFilter* input) { 39 SkImageFilter* input) {
40 return SkNEW_ARGS(SkBicubicImageFilter, (scale, gMitchellCoefficients, input )); 40 return SkNEW_ARGS(SkBicubicImageFilter, (scale, gMitchellCoefficients, input ));
41 } 41 }
42 42
43 SkBicubicImageFilter::SkBicubicImageFilter(SkFlattenableReadBuffer& buffer) : IN HERITED(buffer) { 43 SkBicubicImageFilter::SkBicubicImageFilter(SkFlattenableReadBuffer& buffer)
44 : INHERITED(1, buffer) {
44 SkDEBUGCODE(bool success =) buffer.readScalarArray(fCoefficients, 16); 45 SkDEBUGCODE(bool success =) buffer.readScalarArray(fCoefficients, 16);
45 SkASSERT(success); 46 SkASSERT(success);
46 fScale.fWidth = buffer.readScalar(); 47 fScale.fWidth = buffer.readScalar();
47 fScale.fHeight = buffer.readScalar(); 48 fScale.fHeight = buffer.readScalar();
48 buffer.validate(SkScalarIsFinite(fScale.fWidth) && 49 buffer.validate(SkScalarIsFinite(fScale.fWidth) &&
49 SkScalarIsFinite(fScale.fHeight) && 50 SkScalarIsFinite(fScale.fHeight) &&
50 (fScale.fWidth >= 0) && 51 (fScale.fWidth >= 0) &&
51 (fScale.fHeight >= 0)); 52 (fScale.fHeight >= 0));
52 } 53 }
53 54
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 GrPaint paint; 192 GrPaint paint;
192 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); 193 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref();
193 SkRect srcRect; 194 SkRect srcRect;
194 srcBM.getBounds(&srcRect); 195 srcBM.getBounds(&srcRect);
195 context->drawRectToRect(paint, dstRect, srcRect); 196 context->drawRectToRect(paint, dstRect, srcRect);
196 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t); 197 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t);
197 } 198 }
198 #endif 199 #endif
199 200
200 /////////////////////////////////////////////////////////////////////////////// 201 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkBitmapSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698