| 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 27 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |