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

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 1313573005: Revert of Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: 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 c3b10184f4429981d69d18ce888b4af1bb61f609..e382d09c9977ce5d01623809920bd15a1398fe16 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -15,7 +15,6 @@
#if SK_SUPPORT_GPU
#include "effects/GrBicubicEffect.h"
-#include "effects/GrExtractAlphaFragmentProcessor.h"
#include "effects/GrSimpleTextureEffect.h"
#endif
@@ -354,21 +353,22 @@
#include "SkGr.h"
#include "effects/GrSimpleTextureEffect.h"
-const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* context,
- const SkMatrix& viewM, const SkMatrix* localMatrix,
- SkFilterQuality filterQuality,
- GrProcessorDataManager* procDataManager) const {
+bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint& paint,
+ const SkMatrix& viewM,
+ const SkMatrix* localMatrix, GrColor* paintColor,
+ GrProcessorDataManager* procDataManager,
+ GrFragmentProcessor** fp) const {
SkMatrix matrix;
matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height());
SkMatrix lmInverse;
if (!this->getLocalMatrix().invert(&lmInverse)) {
- return nullptr;
+ return false;
}
if (localMatrix) {
SkMatrix inv;
if (!localMatrix->invert(&inv)) {
- return nullptr;
+ return false;
}
lmInverse.postConcat(inv);
}
@@ -385,7 +385,7 @@
// are provided by the caller.
bool doBicubic;
GrTextureParams::FilterMode textureFilterMode =
- GrSkFilterQualityToGrFilterMode(filterQuality, viewM, this->getLocalMatrix(),
+ GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewM, this->getLocalMatrix(),
&doBicubic);
GrTextureParams params(tm, textureFilterMode);
SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap, &params));
@@ -393,20 +393,29 @@
if (!texture) {
SkErrorInternals::SetError( kInternalError_SkError,
"Couldn't convert bitmap to texture.");
- return nullptr;
- }
-
- SkAutoTUnref<GrFragmentProcessor> inner;
+ return false;
+ }
+
+ *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ?
+ SkColor2GrColor(paint.getColor()) :
+ SkColor2GrColorJustAlpha(paint.getColor());
+
if (doBicubic) {
- inner.reset(GrBicubicEffect::Create(procDataManager, texture, matrix, tm));
+ *fp = GrBicubicEffect::Create(procDataManager, texture, matrix, tm);
} else {
- inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matrix, params));
- }
-
- if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
- return SkRef(inner.get());
- }
- return GrExtractAlphaFragmentProcessor::Create(inner);
-}
-
-#endif
+ *fp = 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;
+}
+
+#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