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

Side by Side Diff: src/effects/SkBicubicImageFilter.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/core/SkValidationUtils.h ('k') | src/effects/SkBlurImageFilter.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 27 matching lines...) Expand all
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) : IN HERITED(buffer) {
44 SkDEBUGCODE(uint32_t readSize =) buffer.readScalarArray(fCoefficients); 44 SkDEBUGCODE(uint32_t readSize =) buffer.readScalarArray(fCoefficients);
45 SkASSERT(readSize == 16); 45 SkASSERT(readSize == 16);
46 fScale.fWidth = buffer.readScalar(); 46 fScale.fWidth = buffer.readScalar();
47 fScale.fHeight = buffer.readScalar(); 47 fScale.fHeight = buffer.readScalar();
48 buffer.validate(SkScalarIsFinite(fScale.fWidth) &&
49 SkScalarIsFinite(fScale.fHeight) &&
50 (fScale.fWidth >= 0) &&
51 (fScale.fHeight >= 0));
48 } 52 }
49 53
50 void SkBicubicImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 54 void SkBicubicImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
51 this->INHERITED::flatten(buffer); 55 this->INHERITED::flatten(buffer);
52 buffer.writeScalarArray(fCoefficients, 16); 56 buffer.writeScalarArray(fCoefficients, 16);
53 buffer.writeScalar(fScale.fWidth); 57 buffer.writeScalar(fScale.fWidth);
54 buffer.writeScalar(fScale.fHeight); 58 buffer.writeScalar(fScale.fHeight);
55 } 59 }
56 60
57 SkBicubicImageFilter::~SkBicubicImageFilter() { 61 SkBicubicImageFilter::~SkBicubicImageFilter() {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 GrPaint paint; 191 GrPaint paint;
188 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); 192 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref();
189 SkRect srcRect; 193 SkRect srcRect;
190 srcBM.getBounds(&srcRect); 194 srcBM.getBounds(&srcRect);
191 context->drawRectToRect(paint, dstRect, srcRect); 195 context->drawRectToRect(paint, dstRect, srcRect);
192 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t); 196 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t);
193 } 197 }
194 #endif 198 #endif
195 199
196 /////////////////////////////////////////////////////////////////////////////// 200 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkValidationUtils.h ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698