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

Side by Side Diff: src/gpu/batches/GrCopySurfaceBatch.h

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrClearBatch.h ('k') | src/gpu/batches/GrDiscardBatch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrCopySurfaceBatch_DEFINED 8 #ifndef GrCopySurfaceBatch_DEFINED
9 #define GrCopySurfaceBatch_DEFINED 9 #define GrCopySurfaceBatch_DEFINED
10 10
11 #include "GrBatch.h" 11 #include "GrBatch.h"
12 #include "GrBatchFlushState.h" 12 #include "GrBatchFlushState.h"
13 #include "GrGpu.h" 13 #include "GrGpu.h"
14 #include "GrRenderTarget.h" 14 #include "GrRenderTarget.h"
15 15
16 class GrCopySurfaceBatch final : public GrBatch { 16 class GrCopySurfaceBatch final : public GrBatch {
17 public: 17 public:
18 DEFINE_BATCH_CLASS_ID 18 DEFINE_BATCH_CLASS_ID
19 19
20 static GrBatch* Create(GrSurface* dst, GrSurface* src, const SkIRect& srcRec t, 20 static GrBatch* Create(GrSurface* dst, GrSurface* src, const SkIRect& srcRec t,
21 const SkIPoint& dstPoint); 21 const SkIPoint& dstPoint);
22 22
23 const char* name() const override { return "CopySurface"; } 23 const char* name() const override { return "CopySurface"; }
24 24
25 uint32_t renderTargetUniqueID() const override { 25 uint32_t renderTargetUniqueID() const override {
26 GrRenderTarget* rt = fDst.get()->asRenderTarget(); 26 GrRenderTarget* rt = fDst.get()->asRenderTarget();
27 return rt ? rt->getUniqueID() : 0; 27 return rt ? rt->getUniqueID() : 0;
28 } 28 }
29 29
30 GrRenderTarget* rt2() const override { return fDst.get()->asRenderTarget(); }
31
30 SkString dumpInfo() const override { 32 SkString dumpInfo() const override {
31 SkString string; 33 SkString string;
32 string.printf("SRC: 0x%p, DST: 0x%p, SRECT: [L: %d, T: %d, R: %d, B: %d] , " 34 string.printf("SRC: 0x%p, DST: 0x%p, SRECT: [L: %d, T: %d, R: %d, B: %d] , "
33 "DPT:[X: %d, Y: %d]", 35 "DPT:[X: %d, Y: %d]",
34 fDst.get(), fSrc.get(), fSrcRect.fLeft, fSrcRect.fTop, fSr cRect.fRight, 36 fDst.get(), fSrc.get(), fSrcRect.fLeft, fSrcRect.fTop, fSr cRect.fRight,
35 fSrcRect.fBottom, fDstPoint.fX, fDstPoint.fY); 37 fSrcRect.fBottom, fDstPoint.fX, fDstPoint.fY);
36 return string; 38 return string;
37 } 39 }
38 40
39 private: 41 private:
40 GrCopySurfaceBatch(GrSurface* dst, GrSurface* src, const SkIRect& srcRect, 42 GrCopySurfaceBatch(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
41 const SkIPoint& dstPoint) 43 const SkIPoint& dstPoint)
42 : INHERITED(ClassID()) 44 : INHERITED(ClassID())
43 , fDst(dst) 45 , fDst(dst)
44 , fSrc(src) 46 , fSrc(src, dst)
45 , fSrcRect(srcRect) 47 , fSrcRect(srcRect)
46 , fDstPoint(dstPoint) { 48 , fDstPoint(dstPoint) {
47 fBounds = SkRect::MakeXYWH(SkIntToScalar(dstPoint.fX), SkIntToScalar(dst Point.fY), 49 fBounds = SkRect::MakeXYWH(SkIntToScalar(dstPoint.fX), SkIntToScalar(dst Point.fY),
48 SkIntToScalar(srcRect.width()), SkIntToScalar (srcRect.height())); 50 SkIntToScalar(srcRect.width()), SkIntToScalar (srcRect.height()));
49 } 51 }
50 52
51 bool onCombineIfPossible(GrBatch* that, const GrCaps& caps) override { retur n false; } 53 bool onCombineIfPossible(GrBatch* that, const GrCaps& caps) override { retur n false; }
52 54
53 void onPrepare(GrBatchFlushState*) override {} 55 void onPrepare(GrBatchFlushState*) override {}
54 56
55 void onDraw(GrBatchFlushState* state) override { 57 void onDraw(GrBatchFlushState* state) override {
56 state->gpu()->copySurface(fDst.get(), fSrc.get(), fSrcRect, fDstPoint); 58 state->gpu()->copySurface(fDst.get(), fSrc.get(), fSrcRect, fDstPoint);
57 } 59 }
58 60
59 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; 61 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst;
60 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; 62 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
61 SkIRect fSrcRect; 63 SkIRect fSrcRect;
62 SkIPoint fDstPoint; 64 SkIPoint fDstPoint;
63 65
64 typedef GrBatch INHERITED; 66 typedef GrBatch INHERITED;
65 }; 67 };
66 68
67 #endif 69 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrClearBatch.h ('k') | src/gpu/batches/GrDiscardBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698