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

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

Issue 37803002: Adding size parameter to read array functions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed comments 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
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 23 matching lines...) Expand all
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) : IN HERITED(buffer) {
44 SkDEBUGCODE(uint32_t readSize =) buffer.readScalarArray(fCoefficients); 44 SkDEBUGCODE(bool success =) buffer.readScalarArray(fCoefficients, 16);
45 SkASSERT(readSize == 16); 45 SkASSERT(success);
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) && 48 buffer.validate(SkScalarIsFinite(fScale.fWidth) &&
49 SkScalarIsFinite(fScale.fHeight) && 49 SkScalarIsFinite(fScale.fHeight) &&
50 (fScale.fWidth >= 0) && 50 (fScale.fWidth >= 0) &&
51 (fScale.fHeight >= 0)); 51 (fScale.fHeight >= 0));
52 } 52 }
53 53
54 void SkBicubicImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 54 void SkBicubicImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
55 this->INHERITED::flatten(buffer); 55 this->INHERITED::flatten(buffer);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 GrPaint paint; 191 GrPaint paint;
192 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); 192 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref();
193 SkRect srcRect; 193 SkRect srcRect;
194 srcBM.getBounds(&srcRect); 194 srcBM.getBounds(&srcRect);
195 context->drawRectToRect(paint, dstRect, srcRect); 195 context->drawRectToRect(paint, dstRect, srcRect);
196 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t); 196 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t);
197 } 197 }
198 #endif 198 #endif
199 199
200 /////////////////////////////////////////////////////////////////////////////// 200 ///////////////////////////////////////////////////////////////////////////////
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698