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

Unified Diff: src/gpu/GrContext.cpp

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 years, 5 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/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index fd788cbd93b89d33d020b845ac5b350c191d7fc8..9f83fed191cd72518b2e1d69a275b3605a9ad46f 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -365,8 +365,8 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
SkAutoTUnref<GrTexture> tempTexture;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
- tempTexture.reset(this->textureProvider()->refScratchTexture(
- tempDrawInfo.fTempSurfaceDesc, GrTextureProvider::kApprox_ScratchTexMatch));
+ tempTexture.reset(
+ this->textureProvider()->createApproxTexture(tempDrawInfo.fTempSurfaceDesc));
if (!tempTexture && GrGpu::kRequireDraw_DrawPreference == drawPreference) {
return false;
}
@@ -495,17 +495,19 @@ bool GrContext::readSurfacePixels(GrSurface* src,
SkAutoTUnref<GrSurface> surfaceToRead(SkRef(src));
bool didTempDraw = false;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
- GrTextureProvider::ScratchTexMatch match = GrTextureProvider::kApprox_ScratchTexMatch;
if (tempDrawInfo.fUseExactScratch) {
// We only respect this when the entire src is being read. Otherwise we can trigger too
// many odd ball texture sizes and trash the cache.
- if (width == src->width() && height == src->height()) {
- match = GrTextureProvider::kExact_ScratchTexMatch;
+ if (width != src->width() || height != src->height()) {
+ tempDrawInfo.fUseExactScratch = false;
}
}
SkAutoTUnref<GrTexture> temp;
- temp.reset(this->textureProvider()->refScratchTexture(tempDrawInfo.fTempSurfaceDesc,
- match));
+ if (tempDrawInfo.fUseExactScratch) {
+ temp.reset(this->textureProvider()->createTexture(tempDrawInfo.fTempSurfaceDesc, true));
+ } else {
+ temp.reset(this->textureProvider()->createApproxTexture(tempDrawInfo.fTempSurfaceDesc));
+ }
if (temp) {
SkMatrix textureMatrix;
textureMatrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));

Powered by Google App Engine
This is Rietveld 408576698