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

Unified Diff: src/gpu/SkGpuDevice_drawTexture.cpp

Issue 1440763002: In SkGpuDevice;drawTextureAdjuster perform texture w/h divide in texture matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | 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 902aae0843d35f191e76d2765f962ccfa8564d22..6a8f1739b05a413f0248df4d57542f14876972db 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -120,8 +120,7 @@ void SkGpuDevice::drawTextureAdjusterImpl(GrTextureAdjuster* adjuster,
// by not baking anything about the srcRect, dstRect, or viewMatrix, into the texture FP. In
// the future this should be an opaque optimization enabled by the combination of batch/GP and
// FP.
- const SkMatrix* textureFPMatrix;
- SkMatrix tempMatrix;
+ SkMatrix textureFPMatrix;
const SkMaskFilter* mf = paint.getMaskFilter();
GrTexture* texture = adjuster->originalTexture();
// The shader expects proper local coords, so we can't replace local coords with texture coords
@@ -129,13 +128,12 @@ void SkGpuDevice::drawTextureAdjusterImpl(GrTextureAdjuster* adjuster,
// that is rendered.
bool canUseTextureCoordsAsLocalCoords = !use_shader(alphaTexture, paint) && !mf;
if (canUseTextureCoordsAsLocalCoords) {
- textureFPMatrix = &SkMatrix::I();
+ textureFPMatrix.setIDiv(texture->width(), texture->height());
} else {
- if (!srcToDstMatrix.invert(&tempMatrix)) {
+ if (!srcToDstMatrix.invert(&textureFPMatrix)) {
return;
}
- tempMatrix.postIDiv(texture->width(), texture->height());
- textureFPMatrix = &tempMatrix;
+ textureFPMatrix.postIDiv(texture->width(), texture->height());
}
bool doBicubic;
@@ -157,7 +155,7 @@ void SkGpuDevice::drawTextureAdjusterImpl(GrTextureAdjuster* adjuster,
bool coordsAllInsideSrcRect = !paint.isAntiAlias() && !mf;
SkAutoTUnref<const GrFragmentProcessor> fp(adjuster->createFragmentProcessor(
- *textureFPMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode));
+ textureFPMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode));
if (!fp) {
return;
}
@@ -169,12 +167,7 @@ void SkGpuDevice::drawTextureAdjusterImpl(GrTextureAdjuster* adjuster,
}
if (canUseTextureCoordsAsLocalCoords) {
- SkRect localRect;
- localRect.fLeft = clippedSrcRect.fLeft / texture->width();
- localRect.fBottom = clippedSrcRect.fBottom / texture->height();
- localRect.fRight = clippedSrcRect.fRight / texture->width();
- localRect.fTop = clippedSrcRect.fTop / texture->height();
- fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect, localRect);
+ fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect, clippedSrcRect);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698