| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 SkScalarRoundToInt(SkScalarClampMax(r, a)), | 74 SkScalarRoundToInt(SkScalarClampMax(r, a)), |
| 75 SkScalarRoundToInt(SkScalarClampMax(g, a)), | 75 SkScalarRoundToInt(SkScalarClampMax(g, a)), |
| 76 SkScalarRoundToInt(SkScalarClampMax(b, a))); | 76 SkScalarRoundToInt(SkScalarClampMax(b, a))); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool SkBicubicImageFilter::onFilterImage(Proxy* proxy, | 79 bool SkBicubicImageFilter::onFilterImage(Proxy* proxy, |
| 80 const SkBitmap& source, | 80 const SkBitmap& source, |
| 81 const SkMatrix& matrix, | 81 const SkMatrix& matrix, |
| 82 SkBitmap* result, | 82 SkBitmap* result, |
| 83 SkIPoint* loc) { | 83 SkIPoint* loc) { |
| 84 SkBitmap src = this->getInputResult(0, proxy, source, matrix, loc); | 84 SkBitmap src = source; |
| 85 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, lo
c)) { |
| 86 return false; |
| 87 } |
| 88 |
| 85 if (src.config() != SkBitmap::kARGB_8888_Config) { | 89 if (src.config() != SkBitmap::kARGB_8888_Config) { |
| 86 return false; | 90 return false; |
| 87 } | 91 } |
| 88 | 92 |
| 89 SkAutoLockPixels alp(src); | 93 SkAutoLockPixels alp(src); |
| 90 if (!src.getPixels()) { | 94 if (!src.getPixels()) { |
| 91 return false; | 95 return false; |
| 92 } | 96 } |
| 93 | 97 |
| 94 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca
le.fWidth), | 98 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca
le.fWidth), |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 GrPaint paint; | 367 GrPaint paint; |
| 364 paint.colorStage(0)->setEffect(GrBicubicEffect::Create(srcTexture, fCoeffici
ents))->unref(); | 368 paint.colorStage(0)->setEffect(GrBicubicEffect::Create(srcTexture, fCoeffici
ents))->unref(); |
| 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 |