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

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 13581003: Make GrIODB record and play back copySurface. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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
« src/gpu/GrDrawTarget.cpp ('K') | « src/gpu/GrInOrderDrawBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
===================================================================
--- src/gpu/GrInOrderDrawBuffer.cpp (revision 8526)
+++ src/gpu/GrInOrderDrawBuffer.cpp (working copy)
@@ -422,6 +422,7 @@
fIndexPool.reset();
fClips.reset();
fClipOrigins.reset();
+ fCopySurfaces.reset();
fClipSet = true;
}
@@ -456,6 +457,7 @@
int currClear = 0;
int currDraw = 0;
int currStencilPath = 0;
+ int currCopySurface = 0;
for (int c = 0; c < numCmds; ++c) {
switch (fCmds[c]) {
@@ -492,6 +494,13 @@
fClears[currClear].fRenderTarget);
++currClear;
break;
+ case kCopySurface_Cmd:
+ fDstGpu->copySurface(fCopySurfaces[currCopySurface].fDst.get(),
+ fCopySurfaces[currCopySurface].fSrc.get(),
+ fCopySurfaces[currCopySurface].fSrcRect,
+ fCopySurfaces[currCopySurface].fDstPoint);
+ ++currCopySurface;
+ break;
}
}
// we should have consumed all the states, clips, etc.
@@ -500,6 +509,7 @@
GrAssert(fClipOrigins.count() == currClip);
GrAssert(fClears.count() == currClear);
GrAssert(fDraws.count() == currDraw);
+ GrAssert(fCopySurfaces.count() == currCopySurface);
fDstGpu->setDrawState(prevDrawState);
prevDrawState->unref();
@@ -507,6 +517,29 @@
return true;
}
+bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
+ if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) {
+ CopySurface* cs = this->recordCopySurface();
+ cs->fDst.reset(SkRef(dst));
+ cs->fSrc.reset(SkRef(src));
+ cs->fSrcRect = srcRect;
+ cs->fDstPoint = dstPoint;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool GrInOrderDrawBuffer::onCanCopySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
+ return fDstGpu->canCopySurface(dst, src, srcRect, dstPoint);
+}
+
void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(
int vertexCount,
int indexCount) {
@@ -756,6 +789,12 @@
return &fClears.push_back();
}
+GrInOrderDrawBuffer::CopySurface* GrInOrderDrawBuffer::recordCopySurface() {
+ fCmds.push_back(kCopySurface_Cmd);
+ return &fCopySurfaces.push_back();
+}
+
+
void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) {
INHERITED::clipWillBeSet(newClipData);
fClipSet = true;
« src/gpu/GrDrawTarget.cpp ('K') | « src/gpu/GrInOrderDrawBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698