| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 SkAutoLockPixels alp(src); | 92 SkAutoLockPixels alp(src); |
| 93 if (!src.getPixels()) { | 93 if (!src.getPixels()) { |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| 96 | 96 |
| 97 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca
le.fWidth), | 97 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca
le.fWidth), |
| 98 SkScalarMul(SkIntToScalar(src.height()), fSc
ale.fHeight)); | 98 SkScalarMul(SkIntToScalar(src.height()), fSc
ale.fHeight)); |
| 99 SkIRect dstIRect; | 99 SkIRect dstIRect; |
| 100 dstRect.roundOut(&dstIRect); | 100 dstRect.roundOut(&dstIRect); |
| 101 if (dstIRect.isEmpty()) { |
| 102 return false; |
| 103 } |
| 101 result->setConfig(src.config(), dstIRect.width(), dstIRect.height()); | 104 result->setConfig(src.config(), dstIRect.width(), dstIRect.height()); |
| 102 result->allocPixels(); | 105 result->allocPixels(); |
| 103 if (!result->getPixels()) { | 106 if (!result->getPixels()) { |
| 104 return false; | 107 return false; |
| 105 } | 108 } |
| 106 | 109 |
| 107 SkRect srcRect; | 110 SkRect srcRect; |
| 108 src.getBounds(&srcRect); | 111 src.getBounds(&srcRect); |
| 109 SkMatrix inverse; | 112 SkMatrix inverse; |
| 110 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); | 113 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 GrPaint paint; | 187 GrPaint paint; |
| 185 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un
ref(); | 188 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un
ref(); |
| 186 SkRect srcRect; | 189 SkRect srcRect; |
| 187 srcBM.getBounds(&srcRect); | 190 srcBM.getBounds(&srcRect); |
| 188 context->drawRectToRect(paint, dstRect, srcRect); | 191 context->drawRectToRect(paint, dstRect, srcRect); |
| 189 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul
t); | 192 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul
t); |
| 190 } | 193 } |
| 191 #endif | 194 #endif |
| 192 | 195 |
| 193 /////////////////////////////////////////////////////////////////////////////// | 196 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |