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

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

Issue 2289363005: Improve usage of window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_drawsinreducedclip
Patch Set: comments 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 "GrTypesPriv.h" 12 #include "GrScissorState.h"
13 #include "GrWindowRectsState.h"
13 14
14 /** 15 /**
15 * GrFixedClip is a clip that gets implemented by fixed-function hardware. 16 * GrFixedClip is a clip that gets implemented by fixed-function hardware.
16 */ 17 */
17 class GrFixedClip final : public GrClip { 18 class GrFixedClip final : public GrClip {
18 public: 19 public:
19 GrFixedClip() = default; 20 GrFixedClip() = default;
20 explicit GrFixedClip(const SkIRect& scissorRect) : fScissorState(scissorRect ) {} 21 explicit GrFixedClip(const SkIRect& scissorRect) : fScissorState(scissorRect ) {}
21 22
22 const GrScissorState& scissorState() const { return fScissorState; } 23 const GrScissorState& scissorState() const { return fScissorState; }
23 bool scissorEnabled() const { return fScissorState.enabled(); } 24 bool scissorEnabled() const { return fScissorState.enabled(); }
24 const SkIRect& scissorRect() const { SkASSERT(scissorEnabled()); return fSci ssorState.rect(); } 25 const SkIRect& scissorRect() const { SkASSERT(scissorEnabled()); return fSci ssorState.rect(); }
25 26
26 void disableScissor() { fScissorState.setDisabled(); } 27 void disableScissor() { fScissorState.setDisabled(); }
27 28
28 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& irect) { 29 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& irect) {
29 return fScissorState.intersect(irect); 30 return fScissorState.intersect(irect);
30 } 31 }
31 32
32 bool quickContains(const SkRect& rect) const final { 33 const GrWindowRectsState& windowRectsState() const { return fWindowRectsStat e; }
33 return !fScissorState.enabled() || GrClip::IsInsideClip(fScissorState.re ct(), rect); 34 GrWindowRectsState& windowRectsState() { return fWindowRectsState; }
csmartdalton 2016/08/31 15:04:34 Would you prefer a few setters here as well, inste
bsalomon 2016/08/31 17:50:46 Yes
csmartdalton 2016/08/31 19:43:36 Done.
34 }
35 void getConservativeBounds(int width, int height, SkIRect* devResult,
36 bool* isIntersectionOfRects) const final;
37 35
38 bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override { 36 bool quickContains(const SkRect&) const override;
39 if (fScissorState.enabled()) { 37 void getConservativeBounds(int w, int h, SkIRect* devResult, bool* iior) con st override;
40 SkRect rect = SkRect::Make(fScissorState.rect()); 38 bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override;
41 if (!rect.intersects(rtBounds)) { 39 bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip* out) const override;
42 return false;
43 }
44 rr->setRect(rect);
45 *aa = false;
46 return true;
47 }
48 return false;
49 };
50
51 bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSett ings,
52 GrAppliedClip* out) const final;
53 40
54 static const GrFixedClip& Disabled(); 41 static const GrFixedClip& Disabled();
55 42
56 private: 43 private:
57 GrScissorState fScissorState; 44 GrScissorState fScissorState;
45 GrWindowRectsState fWindowRectsState;
58 }; 46 };
59 47
60 #endif 48 #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