Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 318923005: SkShader::asNewEffect Refactoring (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkColorShader refactor and fix Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 8e25530cee5dabe85cbfde36638fc0fe84533096..b73a71b72f60b72d8f72685ebaeb4145c6370f4b 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -382,19 +382,22 @@ void SkBitmapProcShader::toString(SkString* str) const {
#include "effects/GrSimpleTextureEffect.h"
#include "SkGr.h"
-GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint,
- const SkMatrix* localMatrix) const {
+bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint,
+ const SkMatrix* localMatrix, GrColor* grColor,
+ GrEffectRef** grEffect) const {
+ *grColor = this->getColorAsAlpha(paint);
bsalomon 2014/06/09 14:11:30 It can be a follow on CL but I think you'd fix an
dandov 2014/06/09 19:10:55 I fixed the bug, do I need to do something else to
+
SkMatrix matrix;
matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height());
SkMatrix lmInverse;
if (!this->getLocalMatrix().invert(&lmInverse)) {
- return NULL;
+ return false;
}
if (localMatrix) {
SkMatrix inv;
if (!localMatrix->invert(&inv)) {
- return NULL;
+ return false;
}
lmInverse.postConcat(inv);
}
@@ -450,16 +453,16 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint&
if (NULL == texture) {
SkErrorInternals::SetError( kInternalError_SkError,
"Couldn't convert bitmap to texture.");
- return NULL;
+ return false;
}
- GrEffectRef* effect = NULL;
if (useBicubic) {
- effect = GrBicubicEffect::Create(texture, matrix, tm);
+ *grEffect = GrBicubicEffect::Create(texture, matrix, tm);
} else {
- effect = GrSimpleTextureEffect::Create(texture, matrix, params);
+ *grEffect = GrSimpleTextureEffect::Create(texture, matrix, params);
}
GrUnlockAndUnrefCachedBitmapTexture(texture);
- return effect;
+
+ return NULL != *grEffect;
dandov 2014/06/06 21:50:44 check if it will return NULL or a valid GrEffectRe
}
#endif

Powered by Google App Engine
This is Rietveld 408576698