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

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

Issue 1962243002: Separate user and raw stencil settings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrStencilAndCoverPathRenderer.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('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 GrStencilPathBatch_DEFINED 8 #ifndef GrStencilPathBatch_DEFINED
9 #define GrStencilPathBatch_DEFINED 9 #define GrStencilPathBatch_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 "GrPath.h" 14 #include "GrPath.h"
15 #include "GrPathRendering.h" 15 #include "GrPathRendering.h"
16 #include "GrRenderTarget.h" 16 #include "GrRenderTarget.h"
17 17
18 class GrStencilPathBatch final : public GrBatch { 18 class GrStencilPathBatch final : public GrBatch {
19 public: 19 public:
20 DEFINE_BATCH_CLASS_ID 20 DEFINE_BATCH_CLASS_ID
21 21
22 static GrBatch* Create(const SkMatrix& viewMatrix, 22 static GrBatch* Create(const SkMatrix& viewMatrix,
23 bool useHWAA, 23 bool useHWAA,
24 const GrStencilSettings& stencil, 24 const GrUserStencilSettings& userStencil,
25 bool hasStencilClip,
26 int numStencilBits,
25 const GrScissorState& scissor, 27 const GrScissorState& scissor,
26 GrRenderTarget* renderTarget, 28 GrRenderTarget* renderTarget,
27 const GrPath* path) { 29 const GrPath* path) {
28 return new GrStencilPathBatch(viewMatrix, useHWAA, stencil, scissor, ren derTarget, path); 30 return new GrStencilPathBatch(viewMatrix, useHWAA, userStencil, hasStenc ilClip,
31 numStencilBits, scissor, renderTarget, pat h);
29 } 32 }
30 33
31 const char* name() const override { return "StencilPath"; } 34 const char* name() const override { return "StencilPath"; }
32 35
33 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); } 36 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); }
34 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); } 37 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
35 38
36 SkString dumpInfo() const override { 39 SkString dumpInfo() const override {
37 SkString string; 40 SkString string;
38 string.printf("PATH: 0x%p, AA:%d", fPath.get(), fUseHWAA); 41 string.printf("PATH: 0x%p, AA:%d", fPath.get(), fUseHWAA);
39 return string; 42 return string;
40 } 43 }
41 44
42 private: 45 private:
43 GrStencilPathBatch(const SkMatrix& viewMatrix, 46 GrStencilPathBatch(const SkMatrix& viewMatrix,
44 bool useHWAA, 47 bool useHWAA,
45 const GrStencilSettings& stencil, 48 const GrUserStencilSettings& userStencil,
49 bool hasStencilClip,
50 int numStencilBits,
46 const GrScissorState& scissor, 51 const GrScissorState& scissor,
47 GrRenderTarget* renderTarget, 52 GrRenderTarget* renderTarget,
48 const GrPath* path) 53 const GrPath* path)
49 : INHERITED(ClassID()) 54 : INHERITED(ClassID())
50 , fViewMatrix(viewMatrix) 55 , fViewMatrix(viewMatrix)
51 , fUseHWAA(useHWAA) 56 , fUseHWAA(useHWAA)
52 , fStencil(stencil) 57 , fStencil(userStencil, hasStencilClip, numStencilBits)
53 , fScissor(scissor) 58 , fScissor(scissor)
54 , fRenderTarget(renderTarget) 59 , fRenderTarget(renderTarget)
55 , fPath(path) { 60 , fPath(path) {
56 fBounds = path->getBounds(); 61 fBounds = path->getBounds();
57 } 62 }
58 63
59 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f alse; } 64 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f alse; }
60 65
61 void onPrepare(GrBatchFlushState*) override {} 66 void onPrepare(GrBatchFlushState*) override {}
62 67
63 void onDraw(GrBatchFlushState* state) override { 68 void onDraw(GrBatchFlushState* state) override {
64 GrPathRendering::StencilPathArgs args(fUseHWAA, fRenderTarget.get(), &fV iewMatrix, 69 GrPathRendering::StencilPathArgs args(fUseHWAA, fRenderTarget.get(), &fV iewMatrix,
65 &fScissor, &fStencil); 70 &fScissor, &fStencil);
66 state->gpu()->pathRendering()->stencilPath(args, fPath.get()); 71 state->gpu()->pathRendering()->stencilPath(args, fPath.get());
67 } 72 }
68 73
69 SkMatrix fViewMatrix; 74 SkMatrix fViewMatrix;
70 bool fUseHWAA; 75 bool fUseHWAA;
71 GrStencilSettings fStencil; 76 GrStencilSettings fStencil;
72 GrScissorState fScissor; 77 GrScissorState fScissor;
73 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; 78 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
74 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; 79 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
75 80
76 typedef GrBatch INHERITED; 81 typedef GrBatch INHERITED;
77 }; 82 };
78 83
79 #endif 84 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrStencilAndCoverPathRenderer.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698