| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 SkAutoLockPixels alp(src); | 93 SkAutoLockPixels alp(src); |
| 94 if (!src.getPixels()) { | 94 if (!src.getPixels()) { |
| 95 return false; | 95 return false; |
| 96 } | 96 } |
| 97 | 97 |
| 98 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca
le.fWidth), | 98 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca
le.fWidth), |
| 99 SkScalarMul(SkIntToScalar(src.height()), fSc
ale.fHeight)); | 99 SkScalarMul(SkIntToScalar(src.height()), fSc
ale.fHeight)); |
| 100 SkIRect dstIRect; | 100 SkIRect dstIRect; |
| 101 dstRect.roundOut(&dstIRect); | 101 dstRect.roundOut(&dstIRect); |
| 102 if (dstIRect.isEmpty()) { |
| 103 return false; |
| 104 } |
| 102 result->setConfig(src.config(), dstIRect.width(), dstIRect.height()); | 105 result->setConfig(src.config(), dstIRect.width(), dstIRect.height()); |
| 103 result->allocPixels(); | 106 result->allocPixels(); |
| 104 if (!result->getPixels()) { | 107 if (!result->getPixels()) { |
| 105 return false; | 108 return false; |
| 106 } | 109 } |
| 107 | 110 |
| 108 SkRect srcRect; | 111 SkRect srcRect; |
| 109 src.getBounds(&srcRect); | 112 src.getBounds(&srcRect); |
| 110 SkMatrix inverse; | 113 SkMatrix inverse; |
| 111 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); | 114 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 GrPaint paint; | 369 GrPaint paint; |
| 367 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un
ref(); | 370 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un
ref(); |
| 368 SkRect srcRect; | 371 SkRect srcRect; |
| 369 srcBM.getBounds(&srcRect); | 372 srcBM.getBounds(&srcRect); |
| 370 context->drawRectToRect(paint, dstRect, srcRect); | 373 context->drawRectToRect(paint, dstRect, srcRect); |
| 371 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul
t); | 374 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul
t); |
| 372 } | 375 } |
| 373 #endif | 376 #endif |
| 374 | 377 |
| 375 /////////////////////////////////////////////////////////////////////////////// | 378 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |