OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef GrStencilPathBatch_DEFINED |
| 9 #define GrStencilPathBatch_DEFINED |
| 10 |
| 11 #include "GrBatch.h" |
| 12 #include "GrBatchFlushState.h" |
| 13 #include "GrGpu.h" |
| 14 #include "GrPath.h" |
| 15 #include "GrPathRendering.h" |
| 16 #include "GrRenderTarget.h" |
| 17 |
| 18 class GrStencilPathBatch final : public GrBatch { |
| 19 public: |
| 20 static GrBatch* Create(const SkMatrix& viewMatrix, |
| 21 bool useHWAA, |
| 22 const GrStencilSettings& stencil, |
| 23 const GrScissorState& scissor, |
| 24 GrRenderTarget* renderTarget, |
| 25 const GrPath* path) { |
| 26 return SkNEW_ARGS(GrStencilPathBatch, (viewMatrix, useHWAA, stencil, sci
ssor, renderTarget, |
| 27 path)); |
| 28 } |
| 29 |
| 30 const char* name() const override { return "StencilPath"; } |
| 31 |
| 32 uint32_t renderTargetUniqueID() const { return fRenderTarget.get()->getUniqu
eID(); } |
| 33 |
| 34 SkString dumpInfo() const override { |
| 35 SkString string; |
| 36 string.printf("PATH: 0x%p, AA:%d", fPath.get(), fUseHWAA); |
| 37 return string; |
| 38 } |
| 39 |
| 40 private: |
| 41 GrStencilPathBatch(const SkMatrix& viewMatrix, |
| 42 bool useHWAA, |
| 43 const GrStencilSettings& stencil, |
| 44 const GrScissorState& scissor, |
| 45 GrRenderTarget* renderTarget, |
| 46 const GrPath* path) |
| 47 : fViewMatrix(viewMatrix) |
| 48 , fUseHWAA(useHWAA) |
| 49 , fStencil(stencil) |
| 50 , fScissor(scissor) |
| 51 , fRenderTarget(renderTarget) |
| 52 , fPath(path) {} |
| 53 |
| 54 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
| 55 |
| 56 void onPrepare(GrBatchFlushState*) override {} |
| 57 |
| 58 void onDraw(GrBatchFlushState* state) override { |
| 59 GrPathRendering::StencilPathArgs args(fUseHWAA, fRenderTarget.get(), &fV
iewMatrix, |
| 60 &fScissor, &fStencil); |
| 61 state->gpu()->pathRendering()->stencilPath(args, fPath.get()); |
| 62 } |
| 63 |
| 64 SkMatrix fViewMatrix; |
| 65 bool fUseHWAA; |
| 66 GrStencilSettings fStencil; |
| 67 GrScissorState fScissor; |
| 68 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 69 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; |
| 70 }; |
| 71 |
| 72 #endif |
OLD | NEW |