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

Unified Diff: src/gpu/SkGpuDevice_drawTexture.cpp

Issue 1454933002: Initial implementation of GPU no filter NinePatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 1 month 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/gpu/SkGpuDevice.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice_drawTexture.cpp
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 534414548b793e3b85b23b42e287f745ee133551..6a43d37762bc705ec3c013800a8e66ba81607bdc 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -23,35 +23,6 @@ static inline bool use_shader(bool textureIsAlphaOnly, const SkPaint& paint) {
return textureIsAlphaOnly && paint.getShader();
}
-/** Determines how to combine the texture FP with the paint's color and SkShader, if any. */
-static const GrFragmentProcessor* mix_texture_fp_with_paint_color_and_shader(
- const GrFragmentProcessor* textureFP,
- bool textureIsAlphaOnly,
- GrContext* context,
- const SkMatrix& viewMatrix,
- const SkPaint& paint) {
- // According to the SkCanvas API, we only consider the shader if the bitmap or image being
- // rendered is alpha-only.
- if (textureIsAlphaOnly) {
- if (const SkShader* shader = paint.getShader()) {
- SkAutoTUnref<const GrFragmentProcessor> shaderFP(
- shader->asFragmentProcessor(context,
- viewMatrix,
- nullptr,
- paint.getFilterQuality()));
- if (!shaderFP) {
- return nullptr;
- }
- const GrFragmentProcessor* fpSeries[] = { shaderFP, textureFP };
- return GrFragmentProcessor::RunInSeries(fpSeries, 2);
- } else {
- return GrFragmentProcessor::MulOutputByInputUnpremulColor(textureFP);
- }
- } else {
- return GrFragmentProcessor::MulOutputByInputAlpha(textureFP);
- }
-}
-
//////////////////////////////////////////////////////////////////////////////
// Helper functions for dropping src rect constraint in bilerp mode.
@@ -231,10 +202,9 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
if (!fp) {
return;
}
- fp.reset(mix_texture_fp_with_paint_color_and_shader(fp, alphaTexture, this->context(),
- viewMatrix, paint));
+
GrPaint grPaint;
- if (!SkPaintToGrPaintReplaceShader(fContext, paint, fp, &grPaint)) {
+ if (!SkPaintToGrPaintWithTexture(fContext, paint, viewMatrix, fp, alphaTexture, &grPaint)) {
return;
}
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698