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

Side by Side Diff: src/gpu/GrClipStackClip.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/GrClipMaskManager.cpp ('k') | src/gpu/GrClipStackClip.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 2016 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 GrClipStackClip_DEFINED
9 #define GrClipStackClip_DEFINED
10
11 #include "GrClip.h"
12 #include "GrReducedClip.h"
13 #include "GrTypesPriv.h"
14 #include "SkClipStack.h"
15
16 class GrDrawContext;
17 class GrPathRenderer;
18
19 /**
20 * GrClipStackClip can apply a generic SkClipStack to the draw state. It may gen erate clip masks or
21 * write to the stencil buffer during apply().
22 */
23 class GrClipStackClip final : public GrClip {
24 public:
25 GrClipStackClip(const SkClipStack* stack = nullptr, const SkIPoint* origin = nullptr)
26 : INHERITED(!stack || stack->isWideOpen()) {
27 this->reset(stack, origin);
28 }
29
30 void reset(const SkClipStack* stack = nullptr, const SkIPoint* origin = null ptr) {
31 fIsWideOpen = !stack || stack->isWideOpen();
32 fOrigin = origin ? *origin : SkIPoint::Make(0, 0);
33 fStack.reset(SkSafeRef(stack));
34 }
35
36 const SkIPoint& origin() const { return fOrigin; }
37 const SkClipStack* clipStack() const { return fStack; }
38
39 bool quickContains(const SkRect&) const final;
40 void getConservativeBounds(int width, int height, SkIRect* devResult,
41 bool* isIntersectionOfRects) const final;
42 bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*,
43 const SkRect* devBounds, GrAppliedClip*) const final;
44
45 private:
46 static bool UseSWOnlyPath(GrContext* context,
47 const GrPipelineBuilder& pipelineBuilder,
48 const GrDrawContext* drawContext,
49 const SkVector& clipToMaskOffset,
50 const GrReducedClip::ElementList& elements);
51 static bool PathNeedsSWRenderer(GrContext* context, bool hasUserStencilSetti ngs,
52 const GrDrawContext*, const SkMatrix& viewMa trix,
53 const SkClipStack::Element* element, GrPathR enderer** prOut,
54 bool needsStencil);
55 static bool CreateStencilClipMask(GrContext* context,
56 GrDrawContext* drawContext,
57 int32_t elementsGenID,
58 GrReducedClip::InitialState initialState,
59 const GrReducedClip::ElementList& elements ,
60 const SkIRect& clipSpaceIBounds,
61 const SkIPoint& clipSpaceToStencilOffset);
62
63 SkIPoint fOrigin;
64 SkAutoTUnref<const SkClipStack> fStack;
65 typedef GrClip INHERITED;
66 };
67
68 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrClipStackClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698