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

Side by Side Diff: include/gpu/GrClip.h

Issue 2271053004: Convert drawPaint to drawRRect in simple cases (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: cleanup Created 4 years, 3 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
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 15 matching lines...) Expand all
26 return this->quickContains(rrect.getBounds()); 26 return this->quickContains(rrect.getBounds());
27 } 27 }
28 virtual void getConservativeBounds(int width, int height, SkIRect* devResult , 28 virtual void getConservativeBounds(int width, int height, SkIRect* devResult ,
29 bool* isIntersectionOfRects = nullptr) co nst = 0; 29 bool* isIntersectionOfRects = nullptr) co nst = 0;
30 virtual bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserSte ncilSettings, 30 virtual bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserSte ncilSettings,
31 GrAppliedClip* out) const = 0; 31 GrAppliedClip* out) const = 0;
32 32
33 virtual ~GrClip() {} 33 virtual ~GrClip() {}
34 34
35 /** 35 /**
36 * This method quickly and conservatively determines whether the entire clip is equivalent to
37 * intersection with a rrect.
38 *
39 * @param rtBounds The bounds of the render target that the clip will be app lied to.
40 * @param rrect If return is true rrect will contain the rrect equivalent to the clip.
41 * @param aa If return is true aa will indicate whether the rrect clip is antialiased.
42 * @return true if the clip is equivalent to a single rrect, false otherwise .
43 */
44 virtual bool isRRect(const SkRect& rtBounds, SkRRect* rrect, bool* aa) const = 0;
45
46 /**
36 * This is the maximum distance that a draw may extend beyond a clip's bound ary and still count 47 * This is the maximum distance that a draw may extend beyond a clip's bound ary and still count
37 * count as "on the other side". We leave some slack because floating point rounding error is 48 * count as "on the other side". We leave some slack because floating point rounding error is
38 * likely to blame. The rationale for 1e-3 is that in the coverage case (and barring unexpected 49 * likely to blame. The rationale for 1e-3 is that in the coverage case (and barring unexpected
39 * rounding), as long as coverage stays within 0.5 * 1/256 of its intended v alue it shouldn't 50 * rounding), as long as coverage stays within 0.5 * 1/256 of its intended v alue it shouldn't
40 * have any effect on the final pixel values. 51 * have any effect on the final pixel values.
41 */ 52 */
42 constexpr static SkScalar kBoundsTolerance = 1e-3f; 53 constexpr static SkScalar kBoundsTolerance = 1e-3f;
43 54
44 /** 55 /**
45 * Returns true if the given query bounds count as entirely inside the clip. 56 * Returns true if the given query bounds count as entirely inside the clip.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void getConservativeBounds(int width, int height, SkIRect* devResult, 126 void getConservativeBounds(int width, int height, SkIRect* devResult,
116 bool* isIntersectionOfRects) const final { 127 bool* isIntersectionOfRects) const final {
117 devResult->setXYWH(0, 0, width, height); 128 devResult->setXYWH(0, 0, width, height);
118 if (isIntersectionOfRects) { 129 if (isIntersectionOfRects) {
119 *isIntersectionOfRects = true; 130 *isIntersectionOfRects = true;
120 } 131 }
121 } 132 }
122 bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const fin al { 133 bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const fin al {
123 return true; 134 return true;
124 } 135 }
136 bool isRRect(const SkRect&, SkRRect*, bool*) const override { return false; };
125 }; 137 };
126 138
127 #endif 139 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698