| OLD | NEW |
| 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 /** This should not really be exposed as Create() will apply this clipping,
but there is |
| 21 * currently a workaround in GrContext::copySurface() for non-render target
dsts that relies |
| 22 * on it. */ |
| 23 static bool ClipSrcRectAndDstPoint(const GrSurface* dst, |
| 24 const GrSurface* src, |
| 25 const SkIRect& srcRect, |
| 26 const SkIPoint& dstPoint, |
| 27 SkIRect* clippedSrcRect, |
| 28 SkIPoint* clippedDstPoint); |
| 29 |
| 20 static GrBatch* Create(GrSurface* dst, GrSurface* src, const SkIRect& srcRec
t, | 30 static GrBatch* Create(GrSurface* dst, GrSurface* src, const SkIRect& srcRec
t, |
| 21 const SkIPoint& dstPoint); | 31 const SkIPoint& dstPoint); |
| 22 | 32 |
| 23 const char* name() const override { return "CopySurface"; } | 33 const char* name() const override { return "CopySurface"; } |
| 24 | 34 |
| 25 uint32_t renderTargetUniqueID() const override { | 35 uint32_t renderTargetUniqueID() const override { |
| 26 GrRenderTarget* rt = fDst.get()->asRenderTarget(); | 36 GrRenderTarget* rt = fDst.get()->asRenderTarget(); |
| 27 return rt ? rt->getUniqueID() : 0; | 37 return rt ? rt->getUniqueID() : 0; |
| 28 } | 38 } |
| 29 GrRenderTarget* renderTarget() const override { return fDst.get()->asRenderT
arget(); } | 39 GrRenderTarget* renderTarget() const override { return fDst.get()->asRenderT
arget(); } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 59 | 69 |
| 60 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; | 70 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; |
| 61 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; | 71 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; |
| 62 SkIRect fSrcRect; | 72 SkIRect fSrcRect; |
| 63 SkIPoint fDstPoint; | 73 SkIPoint fDstPoint; |
| 64 | 74 |
| 65 typedef GrBatch INHERITED; | 75 typedef GrBatch INHERITED; |
| 66 }; | 76 }; |
| 67 | 77 |
| 68 #endif | 78 #endif |
| OLD | NEW |