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()) { | |
Stephen White
2013/08/21 20:49:26
In the belt-and-suspenders department, we should a
sugoi
2013/08/21 21:12:09
Isn't returning false enough ? It's pretty much th
Stephen White
2013/08/21 21:23:00
OK, maybe I'm confused. I thought you said at one
sugoi
2013/08/21 21:34:01
Ah, ok, I see what you mean. Since the size is 0 x
| |
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 GrPaint paint; | 371 GrPaint paint; |
369 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); | 372 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); |
370 SkRect srcRect; | 373 SkRect srcRect; |
371 srcBM.getBounds(&srcRect); | 374 srcBM.getBounds(&srcRect); |
372 context->drawRectToRect(paint, dstRect, srcRect); | 375 context->drawRectToRect(paint, dstRect, srcRect); |
373 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t); | 376 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t); |
374 } | 377 } |
375 #endif | 378 #endif |
376 | 379 |
377 /////////////////////////////////////////////////////////////////////////////// | 380 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |