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

Unified Diff: src/gpu/GrContext.cpp

Issue 1262473004: Make GrGpu read/write pixels take GrSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments 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
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b7f8ac19c2946ae3bed947856a82d38bbcc41a5d..fd788cbd93b89d33d020b845ac5b350c191d7fc8 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -416,9 +416,9 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
buffer = tmpPixels.get();
applyPremulToSrc = false;
}
- if (!fGpu->writeTexturePixels(tempTexture, 0, 0, width, height,
- tempDrawInfo.fTempSurfaceDesc.fConfig, buffer,
- rowBytes)) {
+ if (!fGpu->writePixels(tempTexture, 0, 0, width, height,
+ tempDrawInfo.fTempSurfaceDesc.fConfig, buffer,
+ rowBytes)) {
return false;
}
SkMatrix matrix;
@@ -437,7 +437,6 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
}
}
if (!tempTexture) {
- SkASSERT(surface->asTexture());
if (applyPremulToSrc) {
size_t tmpRowBytes = 4 * width;
tmpPixels.reset(width * height);
@@ -449,8 +448,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
buffer = tmpPixels.get();
applyPremulToSrc = false;
}
- return fGpu->writeTexturePixels(surface->asTexture(), left, top, width, height, srcConfig,
- buffer, rowBytes);
+ return fGpu->writePixels(surface, left, top, width, height, srcConfig, buffer, rowBytes);
}
return true;
}
@@ -494,7 +492,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
return false;
}
- SkAutoTUnref<GrRenderTarget> rtToRead(SkSafeRef(src->asRenderTarget()));
+ SkAutoTUnref<GrSurface> surfaceToRead(SkRef(src));
bool didTempDraw = false;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
GrTextureProvider::ScratchTexMatch match = GrTextureProvider::kApprox_ScratchTexMatch;
@@ -537,7 +535,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
GrDrawContext* drawContext = this->drawContext();
drawContext->drawRect(temp->asRenderTarget(), GrClip::WideOpen(), paint,
SkMatrix::I(), rect, NULL);
- rtToRead.reset(SkRef(temp->asRenderTarget()));
+ surfaceToRead.reset(SkRef(temp.get()));
left = 0;
top = 0;
didTempDraw = true;
@@ -550,13 +548,14 @@ bool GrContext::readSurfacePixels(GrSurface* src,
}
GrPixelConfig configToRead = dstConfig;
if (didTempDraw) {
- this->flushSurfaceWrites(rtToRead);
+ this->flushSurfaceWrites(surfaceToRead);
// We swapped R and B while doing the temp draw. Swap back on the read.
if (tempDrawInfo.fSwapRAndB) {
configToRead = GrPixelConfigSwapRAndB(dstConfig);
}
}
- if (!fGpu->readPixels(rtToRead, left, top, width, height, configToRead, buffer, rowBytes)) {
+ if (!fGpu->readPixels(surfaceToRead, left, top, width, height, configToRead, buffer,
+ rowBytes)) {
return false;
}
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698