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

Unified Diff: src/gpu/batches/GrCopySurfaceBatch.h

Issue 1289673004: GrCopySurfaceBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@cs
Patch Set: Created 5 years, 4 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/GrImmediateDrawTarget.cpp ('k') | src/gpu/batches/GrCopySurfaceBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrCopySurfaceBatch.h
diff --git a/src/gpu/batches/GrCopySurfaceBatch.h b/src/gpu/batches/GrCopySurfaceBatch.h
new file mode 100644
index 0000000000000000000000000000000000000000..584bbab5d7b805d656b68f992db30b2ae54da13f
--- /dev/null
+++ b/src/gpu/batches/GrCopySurfaceBatch.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrCopySurfaceBatch_DEFINED
+#define GrCopySurfaceBatch_DEFINED
+
+#include "GrBatch.h"
+#include "GrBatchFlushState.h"
+#include "GrGpu.h"
+#include "GrRenderTarget.h"
+
+class GrCopySurfaceBatch final : public GrBatch {
+public:
+ static GrBatch* Create(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
+
+ const char* name() const override { return "CopySurface"; }
+
+ uint32_t renderTargetUniqueID() const override {
+ GrRenderTarget* rt = fDst.get()->asRenderTarget();
+ return rt ? rt->getUniqueID() : 0;
+ }
+
+ SkString dumpInfo() const override {
+ SkString string;
+ string.printf("SRC: 0x%p, DST: 0x%p, SRECT: [L: %d, T: %d, R: %d, B: %d], "
+ "DPT:[X: %d, Y: %d]",
+ fDst.get(), fSrc.get(), fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight,
+ fSrcRect.fBottom, fDstPoint.fX, fDstPoint.fY);
+ return string;
+ }
+
+private:
+ GrCopySurfaceBatch(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint)
+ : fDst(dst)
+ , fSrc(src)
+ , fSrcRect(srcRect)
+ , fDstPoint(dstPoint) {
+ this->initClassID<GrCopySurfaceBatch>();
+ fBounds = SkRect::MakeXYWH(SkIntToScalar(dstPoint.fX), SkIntToScalar(dstPoint.fY),
+ SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height()));
+ }
+
+ bool onCombineIfPossible(GrBatch* that, const GrCaps& caps) override { return false; }
+
+ void onPrepare(GrBatchFlushState*) override {}
+
+ void onDraw(GrBatchFlushState* state) override {
+ state->gpu()->copySurface(fDst.get(), fSrc.get(), fSrcRect, fDstPoint);
+ }
+
+ GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst;
+ GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
+ SkIRect fSrcRect;
+ SkIPoint fDstPoint;
+};
+
+#endif
« no previous file with comments | « src/gpu/GrImmediateDrawTarget.cpp ('k') | src/gpu/batches/GrCopySurfaceBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698