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

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

Issue 2244223004: Make GrReducedClip's gen ID only apply to the element list (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more improved testing Created 4 years, 4 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/GrClipStackClip.cpp ('k') | src/gpu/GrReducedClip.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 2016 Google Inc. 2 * Copyright 2016 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 GrReducedClip_DEFINED 8 #ifndef GrReducedClip_DEFINED
9 #define GrReducedClip_DEFINED 9 #define GrReducedClip_DEFINED
10 10
11 #include "SkClipStack.h" 11 #include "SkClipStack.h"
12 #include "SkTLList.h" 12 #include "SkTLList.h"
13 13
14 /** 14 /**
15 * This class takes a clip stack and produces a reduced set of elements that are equivalent to 15 * This class takes a clip stack and produces a reduced set of elements that are equivalent to
16 * applying that full stack within a specified query rectangle. 16 * applying that full stack within a specified query rectangle.
17 */ 17 */
18 class SK_API GrReducedClip { 18 class SK_API GrReducedClip {
19 public: 19 public:
20 GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds); 20 GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds);
21 21
22 /** 22 /**
23 * Uniquely identifies this reduced clip.
24 */
25 int32_t genID() const { return fGenID; }
26
27 /**
28 * If hasIBounds() is true, this is the bounding box within which the reduce d clip is valid, and 23 * If hasIBounds() is true, this is the bounding box within which the reduce d clip is valid, and
29 * the caller must not modify any pixels outside this box. Undefined if hasI Bounds() is false. 24 * the caller must not modify any pixels outside this box. Undefined if hasI Bounds() is false.
30 */ 25 */
31 const SkIRect& ibounds() const { SkASSERT(fHasIBounds); return fIBounds; } 26 const SkIRect& ibounds() const { SkASSERT(fHasIBounds); return fIBounds; }
32 int left() const { return this->ibounds().left(); } 27 int left() const { return this->ibounds().left(); }
33 int top() const { return this->ibounds().top(); } 28 int top() const { return this->ibounds().top(); }
34 int width() const { return this->ibounds().width(); } 29 int width() const { return this->ibounds().width(); }
35 int height() const { return this->ibounds().height(); } 30 int height() const { return this->ibounds().height(); }
36 31
37 /** 32 /**
38 * Indicates whether ibounds() are defined. They will always be defined if t he elements() are 33 * Indicates whether ibounds() are defined. They will always be defined if t he elements() are
39 * nonempty. 34 * nonempty.
40 */ 35 */
41 bool hasIBounds() const { return fHasIBounds; } 36 bool hasIBounds() const { return fHasIBounds; }
42 37
43 typedef SkTLList<SkClipStack::Element, 16> ElementList; 38 typedef SkTLList<SkClipStack::Element, 16> ElementList;
44 39
45 /** 40 /**
46 * Populated with a minimal list of elements that implement the clip. 41 * Populated with a minimal list of elements that implement the clip.
47 */ 42 */
48 const ElementList& elements() const { return fElements; } 43 const ElementList& elements() const { return fElements; }
49 44
50 /** 45 /**
46 * If elements() are nonempty, uniquely identifies the list of elements with in ibounds().
47 * Otherwise undefined.
48 */
49 int32_t elementsGenID() const { SkASSERT(!fElements.isEmpty()); return fElem entsGenID; }
50
51 /**
51 * Indicates whether antialiasing is required to process any of the clip ele ments. 52 * Indicates whether antialiasing is required to process any of the clip ele ments.
52 */ 53 */
53 bool requiresAA() const { return fRequiresAA; } 54 bool requiresAA() const { return fRequiresAA; }
54 55
55 enum class InitialState : bool { 56 enum class InitialState : bool {
56 kAllIn, 57 kAllIn,
57 kAllOut 58 kAllOut
58 }; 59 };
59 60
60 InitialState initialState() const { return fInitialState; } 61 InitialState initialState() const { return fInitialState; }
61 62
62 private: 63 private:
63 int32_t fGenID;
64 SkIRect fIBounds; 64 SkIRect fIBounds;
65 bool fHasIBounds; 65 bool fHasIBounds;
66 ElementList fElements; 66 ElementList fElements;
67 int32_t fElementsGenID;
67 bool fRequiresAA; 68 bool fRequiresAA;
68 InitialState fInitialState; 69 InitialState fInitialState;
69 }; 70 };
70 71
71 #endif 72 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrClipStackClip.cpp ('k') | src/gpu/GrReducedClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698