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

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

Issue 2312173002: Revert of Improve usage of window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_drawsinreducedclip
Patch Set: 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
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrFixedClip.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 GrFixedClip_DEFINED 8 #ifndef GrFixedClip_DEFINED
9 #define GrFixedClip_DEFINED 9 #define GrFixedClip_DEFINED
10 10
11 #include "GrClip.h" 11 #include "GrClip.h"
12 #include "GrScissorState.h" 12 #include "GrTypesPriv.h"
13 #include "GrWindowRectsState.h"
14 13
15 /** 14 /**
16 * GrFixedClip is a clip that gets implemented by fixed-function hardware. 15 * GrFixedClip is a clip that gets implemented by fixed-function hardware.
17 */ 16 */
18 class GrFixedClip final : public GrClip { 17 class GrFixedClip final : public GrClip {
19 public: 18 public:
20 GrFixedClip() = default; 19 GrFixedClip() = default;
21 explicit GrFixedClip(const SkIRect& scissorRect) : fScissorState(scissorRect ) {} 20 explicit GrFixedClip(const SkIRect& scissorRect) : fScissorState(scissorRect ) {}
22 21
23 const GrScissorState& scissorState() const { return fScissorState; } 22 const GrScissorState& scissorState() const { return fScissorState; }
24 bool scissorEnabled() const { return fScissorState.enabled(); } 23 bool scissorEnabled() const { return fScissorState.enabled(); }
25 const SkIRect& scissorRect() const { SkASSERT(scissorEnabled()); return fSci ssorState.rect(); } 24 const SkIRect& scissorRect() const { SkASSERT(scissorEnabled()); return fSci ssorState.rect(); }
26 25
27 void disableScissor() { fScissorState.setDisabled(); } 26 void disableScissor() { fScissorState.setDisabled(); }
28 27
29 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& irect) { 28 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& irect) {
30 return fScissorState.intersect(irect); 29 return fScissorState.intersect(irect);
31 } 30 }
32 31
33 const GrWindowRectsState& windowRectsState() const { return fWindowRectsStat e; } 32 bool quickContains(const SkRect& rect) const final {
34 bool hasWindowRectangles() const { return fWindowRectsState.enabled(); } 33 return !fScissorState.enabled() || GrClip::IsInsideClip(fScissorState.re ct(), rect);
34 }
35 void getConservativeBounds(int width, int height, SkIRect* devResult,
36 bool* isIntersectionOfRects) const final;
35 37
36 void disableWindowRectangles() { fWindowRectsState.setDisabled(); } 38 bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override {
39 if (fScissorState.enabled()) {
40 SkRect rect = SkRect::Make(fScissorState.rect());
41 if (!rect.intersects(rtBounds)) {
42 return false;
43 }
44 rr->setRect(rect);
45 *aa = false;
46 return true;
47 }
48 return false;
49 };
37 50
38 void setWindowRectangles(const GrWindowRectangles& windows, const SkIPoint& origin, 51 bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSett ings,
39 GrWindowRectsState::Mode mode) { 52 GrAppliedClip* out) const final;
40 fWindowRectsState.set(windows, origin, mode);
41 }
42
43 bool quickContains(const SkRect&) const override;
44 void getConservativeBounds(int w, int h, SkIRect* devResult, bool* iior) con st override;
45 bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override;
46 bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip* out) const override;
47 53
48 static const GrFixedClip& Disabled(); 54 static const GrFixedClip& Disabled();
49 55
50 private: 56 private:
51 GrScissorState fScissorState; 57 GrScissorState fScissorState;
52 GrWindowRectsState fWindowRectsState;
53 }; 58 };
54 59
55 #endif 60 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrFixedClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698