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

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 1316513002: Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: Address comments, fix roll(?) Created 5 years, 4 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
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkColorShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index e382d09c9977ce5d01623809920bd15a1398fe16..c3b10184f4429981d69d18ce888b4af1bb61f609 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -15,6 +15,7 @@
#if SK_SUPPORT_GPU
#include "effects/GrBicubicEffect.h"
+#include "effects/GrExtractAlphaFragmentProcessor.h"
#include "effects/GrSimpleTextureEffect.h"
#endif
@@ -353,22 +354,21 @@ void SkBitmapProcShader::toString(SkString* str) const {
#include "SkGr.h"
#include "effects/GrSimpleTextureEffect.h"
-bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint& paint,
- const SkMatrix& viewM,
- const SkMatrix* localMatrix, GrColor* paintColor,
- GrProcessorDataManager* procDataManager,
- GrFragmentProcessor** fp) const {
+const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* context,
+ const SkMatrix& viewM, const SkMatrix* localMatrix,
+ SkFilterQuality filterQuality,
+ GrProcessorDataManager* procDataManager) const {
SkMatrix matrix;
matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height());
SkMatrix lmInverse;
if (!this->getLocalMatrix().invert(&lmInverse)) {
- return false;
+ return nullptr;
}
if (localMatrix) {
SkMatrix inv;
if (!localMatrix->invert(&inv)) {
- return false;
+ return nullptr;
}
lmInverse.postConcat(inv);
}
@@ -385,7 +385,7 @@ bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint&
// are provided by the caller.
bool doBicubic;
GrTextureParams::FilterMode textureFilterMode =
- GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewM, this->getLocalMatrix(),
+ GrSkFilterQualityToGrFilterMode(filterQuality, viewM, this->getLocalMatrix(),
&doBicubic);
GrTextureParams params(tm, textureFilterMode);
SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap, &params));
@@ -393,29 +393,20 @@ bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint&
if (!texture) {
SkErrorInternals::SetError( kInternalError_SkError,
"Couldn't convert bitmap to texture.");
- return false;
+ return nullptr;
}
- *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ?
- SkColor2GrColor(paint.getColor()) :
- SkColor2GrColorJustAlpha(paint.getColor());
-
+ SkAutoTUnref<GrFragmentProcessor> inner;
if (doBicubic) {
- *fp = GrBicubicEffect::Create(procDataManager, texture, matrix, tm);
+ inner.reset(GrBicubicEffect::Create(procDataManager, texture, matrix, tm));
} else {
- *fp = GrSimpleTextureEffect::Create(procDataManager, texture, matrix, params);
+ inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matrix, params));
}
- return true;
-}
-
-#else
-
-bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&,
- const SkMatrix*, GrColor*, GrProcessorDataManager*,
- GrFragmentProcessor**) const {
- SkDEBUGFAIL("Should not call in GPU-less build");
- return false;
+ if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
+ return SkRef(inner.get());
+ }
+ return GrExtractAlphaFragmentProcessor::Create(inner);
}
#endif
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkColorShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698