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

Side by Side Diff: src/gpu/GrClipMaskManager.h

Issue 2138083002: skip call to clip::apply when clip is wide open Base URL: https://chromium.googlesource.com/skia.git@llist
Patch Set: rm gcmm Created 4 years, 5 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/GrClip.cpp ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 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 #ifndef GrClipMaskManager_DEFINED
8 #define GrClipMaskManager_DEFINED
9
10 #include "GrReducedClip.h"
11 #include "SkClipStack.h"
12 #include "SkTypes.h"
13
14 class GrAppliedClip;
15 class GrClipStackClip;
16 class GrContext;
17 class GrDrawContext;
18 class GrFixedClip;
19 class GrPathRenderer;
20 class GrPathRendererChain;
21 class GrPipelineBuilder;
22 class GrResourceProvider;
23 class GrTexture;
24 class GrTextureProvider;
25 class GrUniqueKey;
26 struct GrUserStencilSettings;
27
28
29 /**
30 * The clip mask creator handles the generation of the clip mask. If anti
31 * aliasing is requested it will (in the future) generate a single channel
32 * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit
33 * mask in the stencil buffer. In the non anti-aliasing case, if the clip
34 * mask can be represented as a rectangle then scissoring is used. In all
35 * cases scissoring is used to bound the range of the clip mask.
36 */
37 // This has to remain a class, for now, so it can be friended (by GrDrawContext & GrContext)
38 class GrClipMaskManager {
39 public:
40 /**
41 * Creates a clip mask if necessary as a stencil buffer or alpha texture
42 * and sets the GrGpu's scissor and stencil state. If the return is false
43 * then the draw can be skipped. devBounds is optional but can help optimize
44 * clipping.
45 */
46 static bool SetupClipping(GrContext*, const GrPipelineBuilder&, GrDrawContex t*,
47 const GrClipStackClip&, const SkRect* devBounds, G rAppliedClip*);
48
49 private:
50 static bool PathNeedsSWRenderer(GrContext* context,
51 bool hasUserStencilSettings,
52 const GrDrawContext*,
53 const SkMatrix& viewMatrix,
54 const SkClipStack::Element* element,
55 GrPathRenderer** prOut,
56 bool needsStencil);
57
58 // Draws the clip into the stencil buffer
59 static bool CreateStencilClipMask(GrContext*,
60 GrDrawContext*,
61 int32_t elementsGenID,
62 GrReducedClip::InitialState initialState,
63 const GrReducedClip::ElementList& elements ,
64 const SkIRect& clipSpaceIBounds,
65 const SkIPoint& clipSpaceToStencilOffset);
66
67 // Creates an alpha mask of the clip. The mask is a rasterization of element s through the
68 // rect specified by clipSpaceIBounds.
69 static sk_sp<GrTexture> CreateAlphaClipMask(GrContext*,
70 int32_t elementsGenID,
71 GrReducedClip::InitialState init ialState,
72 const GrReducedClip::ElementList & elements,
73 const SkVector& clipToMaskOffset ,
74 const SkIRect& clipSpaceIBounds) ;
75
76 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the result texture.
77 static sk_sp<GrTexture> CreateSoftwareClipMask(GrTextureProvider*,
78 int32_t elementsGenID,
79 GrReducedClip::InitialState i nitialState,
80 const GrReducedClip::ElementL ist& elements,
81 const SkVector& clipToMaskOff set,
82 const SkIRect& clipSpaceIBoun ds);
83
84 static bool UseSWOnlyPath(GrContext*,
85 const GrPipelineBuilder&,
86 const GrDrawContext*,
87 const SkVector& clipToMaskOffset,
88 const GrReducedClip::ElementList& elements);
89
90 static GrTexture* CreateCachedMask(int width, int height, const GrUniqueKey& key,
91 bool renderTarget);
92 };
93
94 #endif // GrClipMaskManager_DEFINED
OLDNEW
« no previous file with comments | « src/gpu/GrClip.cpp ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698