| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), | 39 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), |
| 40 }; | 40 }; |
| 41 return SkNEW_ARGS(SkBicubicImageFilter, (scale, coefficients, input)); | 41 return SkNEW_ARGS(SkBicubicImageFilter, (scale, coefficients, input)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 SkBicubicImageFilter::SkBicubicImageFilter(SkFlattenableReadBuffer& buffer) : IN
HERITED(buffer) { | 44 SkBicubicImageFilter::SkBicubicImageFilter(SkFlattenableReadBuffer& buffer) : IN
HERITED(buffer) { |
| 45 SkDEBUGCODE(uint32_t readSize =) buffer.readScalarArray(fCoefficients); | 45 SkDEBUGCODE(uint32_t readSize =) buffer.readScalarArray(fCoefficients); |
| 46 SkASSERT(readSize == 16); | 46 SkASSERT(readSize == 16); |
| 47 fScale.fWidth = buffer.readScalar(); | 47 fScale.fWidth = buffer.readScalar(); |
| 48 fScale.fHeight = buffer.readScalar(); | 48 fScale.fHeight = buffer.readScalar(); |
| 49 buffer.validateData(SkScalarIsFinite(fScale.fWidth) && |
| 50 SkScalarIsFinite(fScale.fHeight) && |
| 51 (fScale.fWidth >= 0) && |
| 52 (fScale.fHeight >= 0)); |
| 49 } | 53 } |
| 50 | 54 |
| 51 void SkBicubicImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 55 void SkBicubicImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
| 52 this->INHERITED::flatten(buffer); | 56 this->INHERITED::flatten(buffer); |
| 53 buffer.writeScalarArray(fCoefficients, 16); | 57 buffer.writeScalarArray(fCoefficients, 16); |
| 54 buffer.writeScalar(fScale.fWidth); | 58 buffer.writeScalar(fScale.fWidth); |
| 55 buffer.writeScalar(fScale.fHeight); | 59 buffer.writeScalar(fScale.fHeight); |
| 56 } | 60 } |
| 57 | 61 |
| 58 SkBicubicImageFilter::~SkBicubicImageFilter() { | 62 SkBicubicImageFilter::~SkBicubicImageFilter() { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 GrPaint paint; | 367 GrPaint paint; |
| 364 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un
ref(); | 368 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un
ref(); |
| 365 SkRect srcRect; | 369 SkRect srcRect; |
| 366 srcBM.getBounds(&srcRect); | 370 srcBM.getBounds(&srcRect); |
| 367 context->drawRectToRect(paint, dstRect, srcRect); | 371 context->drawRectToRect(paint, dstRect, srcRect); |
| 368 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul
t); | 372 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul
t); |
| 369 } | 373 } |
| 370 #endif | 374 #endif |
| 371 | 375 |
| 372 /////////////////////////////////////////////////////////////////////////////// | 376 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |