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: include/gpu/GrClip.h

Issue 2222873002: Encapsulate GrReducedClip result in class members (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | src/gpu/GrClipStackClip.h » ('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 2010 Google Inc. 2 * Copyright 2010 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 GrClip_DEFINED 8 #ifndef GrClip_DEFINED
9 #define GrClip_DEFINED 9 #define GrClip_DEFINED
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 constexpr static SkScalar kBoundsTolerance = 1e-3f; 122 constexpr static SkScalar kBoundsTolerance = 1e-3f;
123 123
124 /** 124 /**
125 * Returns true if the given query bounds count as entirely inside the clip. 125 * Returns true if the given query bounds count as entirely inside the clip.
126 * 126 *
127 * @param innerClipBounds device-space rect contained by the clip (SkRect or SkIRect). 127 * @param innerClipBounds device-space rect contained by the clip (SkRect or SkIRect).
128 * @param queryBounds device-space bounds of the query region. 128 * @param queryBounds device-space bounds of the query region.
129 */ 129 */
130 template<typename TRect> constexpr static bool IsInsideClip(const TRect& inn erClipBounds, 130 template<typename TRect> constexpr static bool IsInsideClip(const TRect& inn erClipBounds,
131 const SkRect& qu eryBounds) { 131 const SkRect& qu eryBounds) {
132 return innerClipBounds.fRight - innerClipBounds.fLeft >= kBoundsToleranc e && 132 return innerClipBounds.fRight - innerClipBounds.fLeft > kBoundsTolerance &&
133 innerClipBounds.fBottom - innerClipBounds.fTop >= kBoundsToleranc e && 133 innerClipBounds.fBottom - innerClipBounds.fTop > kBoundsTolerance &&
134 innerClipBounds.fLeft <= queryBounds.fLeft + kBoundsTolerance && 134 innerClipBounds.fLeft < queryBounds.fLeft + kBoundsTolerance &&
135 innerClipBounds.fTop <= queryBounds.fTop + kBoundsTolerance && 135 innerClipBounds.fTop < queryBounds.fTop + kBoundsTolerance &&
136 innerClipBounds.fRight >= queryBounds.fRight - kBoundsTolerance & & 136 innerClipBounds.fRight > queryBounds.fRight - kBoundsTolerance &&
137 innerClipBounds.fBottom >= queryBounds.fBottom - kBoundsTolerance ; 137 innerClipBounds.fBottom > queryBounds.fBottom - kBoundsTolerance;
138 } 138 }
139 139
140 /** 140 /**
141 * Returns true if the given query bounds count as entirely outside the clip . 141 * Returns true if the given query bounds count as entirely outside the clip .
142 * 142 *
143 * @param outerClipBounds device-space rect that contains the clip (SkRect or SkIRect). 143 * @param outerClipBounds device-space rect that contains the clip (SkRect or SkIRect).
144 * @param queryBounds device-space bounds of the query region. 144 * @param queryBounds device-space bounds of the query region.
145 */ 145 */
146 template<typename TRect> constexpr static bool IsOutsideClip(const TRect& ou terClipBounds, 146 template<typename TRect> constexpr static bool IsOutsideClip(const TRect& ou terClipBounds,
147 const SkRect& q ueryBounds) { 147 const SkRect& q ueryBounds) {
148 return outerClipBounds.fRight - outerClipBounds.fLeft < kBoundsTolerance || 148 return outerClipBounds.fRight - outerClipBounds.fLeft <= kBoundsToleranc e ||
149 outerClipBounds.fBottom - outerClipBounds.fTop < kBoundsTolerance || 149 outerClipBounds.fBottom - outerClipBounds.fTop <= kBoundsToleranc e ||
150 outerClipBounds.fLeft > queryBounds.fRight - kBoundsTolerance || 150 outerClipBounds.fLeft >= queryBounds.fRight - kBoundsTolerance ||
151 outerClipBounds.fTop > queryBounds.fBottom - kBoundsTolerance || 151 outerClipBounds.fTop >= queryBounds.fBottom - kBoundsTolerance ||
152 outerClipBounds.fRight < queryBounds.fLeft + kBoundsTolerance || 152 outerClipBounds.fRight <= queryBounds.fLeft + kBoundsTolerance ||
153 outerClipBounds.fBottom < queryBounds.fTop + kBoundsTolerance; 153 outerClipBounds.fBottom <= queryBounds.fTop + kBoundsTolerance;
csmartdalton 2016/08/08 05:26:55 Switching to <= and >= ought to remove the case wh
154 } 154 }
155 155
156 /** 156 /**
157 * Returns the minimal integer rect that counts as containing a given set of bounds. 157 * Returns the minimal integer rect that counts as containing a given set of bounds.
158 */ 158 */
159 static SkIRect GetPixelIBounds(const SkRect& bounds) { 159 static SkIRect GetPixelIBounds(const SkRect& bounds) {
160 return SkIRect::MakeLTRB(SkScalarFloorToInt(bounds.fLeft + kBoundsTolera nce), 160 return SkIRect::MakeLTRB(SkScalarFloorToInt(bounds.fLeft + kBoundsTolera nce),
161 SkScalarFloorToInt(bounds.fTop + kBoundsToleran ce), 161 SkScalarFloorToInt(bounds.fTop + kBoundsToleran ce),
162 SkScalarCeilToInt(bounds.fRight - kBoundsTolera nce), 162 SkScalarCeilToInt(bounds.fRight - kBoundsTolera nce),
163 SkScalarCeilToInt(bounds.fBottom - kBoundsToler ance)); 163 SkScalarCeilToInt(bounds.fBottom - kBoundsToler ance));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 bool useHWAA, 263 bool useHWAA,
264 bool hasUserStencilSettings, 264 bool hasUserStencilSettings,
265 GrAppliedClip* out) const final; 265 GrAppliedClip* out) const final;
266 266
267 GrScissorState fScissorState; 267 GrScissorState fScissorState;
268 SkRect fDeviceBounds; 268 SkRect fDeviceBounds;
269 bool fHasStencilClip; 269 bool fHasStencilClip;
270 }; 270 };
271 271
272 #endif 272 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrClipStackClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698