OLD | NEW |
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 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkClipStack.h" | 9 #include "SkClipStack.h" |
10 #include "SkRRect.h" | 10 #include "SkRRect.h" |
11 | 11 |
12 #if SK_SUPPORT_GPU | 12 #if SK_SUPPORT_GPU |
13 # include "GrAppliedClip.h" | 13 # include "GrAppliedClip.h" |
14 # include "GrDrawContext.h" | 14 # include "GrDrawContext.h" |
15 # include "GrDrawContextPriv.h" | 15 # include "GrDrawContextPriv.h" |
16 # include "GrFixedClip.h" | 16 # include "GrFixedClip.h" |
17 # include "GrReducedClip.h" | 17 # include "GrReducedClip.h" |
18 # include "GrRenderTargetPriv.h" | 18 # include "GrRenderTargetPriv.h" |
19 # include "GrResourceProvider.h" | 19 # include "GrResourceProvider.h" |
20 # include "effects/GrTextureDomain.h" | 20 # include "effects/GrTextureDomain.h" |
21 #endif | 21 #endif |
22 | 22 |
23 constexpr static SkIRect kDeviceRect = {0, 0, 600, 600}; | 23 constexpr static SkIRect kDeviceRect = {0, 0, 600, 600}; |
24 constexpr static SkIRect kLayerRect = {25, 25, 575, 575}; | 24 constexpr static SkIRect kLayerRect = {25, 25, 575, 575}; |
25 constexpr static SkIRect kCoverRect = {50, 50, 550, 550}; | 25 constexpr static SkIRect kCoverRect = {50, 50, 550, 550}; |
26 constexpr static int kNumWindows = 8; | |
27 | 26 |
28 namespace skiagm { | 27 namespace skiagm { |
29 | 28 |
30 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 29 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
31 | 30 |
32 class WindowRectanglesBaseGM : public GM { | 31 class WindowRectanglesBaseGM : public GM { |
33 protected: | 32 protected: |
34 virtual void onCoverClipStack(const SkClipStack&, SkCanvas*) = 0; | 33 virtual void onCoverClipStack(const SkClipStack&, SkCanvas*) = 0; |
35 | 34 |
36 private: | 35 private: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 99 |
101 canvas->drawRect(SkRect::Make(kCoverRect), paint); | 100 canvas->drawRect(SkRect::Make(kCoverRect), paint); |
102 } | 101 } |
103 | 102 |
104 DEF_GM( return new WindowRectanglesGM(); ) | 103 DEF_GM( return new WindowRectanglesGM(); ) |
105 | 104 |
106 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 105 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
107 | 106 |
108 #if SK_SUPPORT_GPU | 107 #if SK_SUPPORT_GPU |
109 | 108 |
| 109 constexpr static int kNumWindows = 8; |
| 110 |
110 /** | 111 /** |
111 * Visualizes the mask (alpha or stencil) for a clip with several window rectang
les. The purpose of | 112 * Visualizes the mask (alpha or stencil) for a clip with several window rectang
les. The purpose of |
112 * this test is to verify that window rectangles are being used during clip mask
generation, and to | 113 * this test is to verify that window rectangles are being used during clip mask
generation, and to |
113 * visualize where the window rectangles are placed. | 114 * visualize where the window rectangles are placed. |
114 * | 115 * |
115 * We use window rectangles when generating the clip mask because there is no ne
ed to invest time | 116 * We use window rectangles when generating the clip mask because there is no ne
ed to invest time |
116 * defining those regions where window rectangles will be in effect during the a
ctual draw anyway. | 117 * defining those regions where window rectangles will be in effect during the a
ctual draw anyway. |
117 * | 118 * |
118 * This test works by filling the entire clip mask with a small checkerboard pat
tern before drawing | 119 * This test works by filling the entire clip mask with a small checkerboard pat
tern before drawing |
119 * it, and then covering the mask with a solid color once it has been generated.
The regions inside | 120 * it, and then covering the mask with a solid color once it has been generated.
The regions inside |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 canvas->clear(SK_ColorWHITE); | 296 canvas->clear(SK_ColorWHITE); |
296 canvas->drawText(errorMsg.c_str(), errorMsg.size(), SkIntToScalar(kCoverRect
.centerX()), | 297 canvas->drawText(errorMsg.c_str(), errorMsg.size(), SkIntToScalar(kCoverRect
.centerX()), |
297 SkIntToScalar(kCoverRect.centerY() - 10), paint); | 298 SkIntToScalar(kCoverRect.centerY() - 10), paint); |
298 } | 299 } |
299 | 300 |
300 DEF_GM( return new WindowRectanglesMaskGM(); ) | 301 DEF_GM( return new WindowRectanglesMaskGM(); ) |
301 | 302 |
302 #endif | 303 #endif |
303 | 304 |
304 } | 305 } |
OLD | NEW |