csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "gm.h" |
Mike Klein | 33d2055 | 2017-03-22 13:47:51 -0400 | [diff] [blame] | 9 | #include "sk_tool_utils.h" |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 10 | #include "SkClipStack.h" |
| 11 | #include "SkRRect.h" |
| 12 | |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 13 | #include "GrAppliedClip.h" |
| 14 | #include "GrCaps.h" |
| 15 | #include "GrContextPriv.h" |
| 16 | #include "GrReducedClip.h" |
| 17 | #include "GrRenderTargetContext.h" |
| 18 | #include "GrRenderTargetContextPriv.h" |
| 19 | #include "GrResourceProvider.h" |
| 20 | #include "GrStencilClip.h" |
| 21 | #include "effects/GrTextureDomain.h" |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 22 | |
| 23 | constexpr static SkIRect kDeviceRect = {0, 0, 600, 600}; |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 24 | constexpr static SkIRect kCoverRect = {50, 50, 550, 550}; |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 25 | |
| 26 | namespace skiagm { |
| 27 | |
| 28 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 29 | |
| 30 | class WindowRectanglesBaseGM : public GM { |
| 31 | protected: |
| 32 | virtual void onCoverClipStack(const SkClipStack&, SkCanvas*) = 0; |
| 33 | |
| 34 | private: |
| 35 | SkISize onISize() override { return SkISize::Make(kDeviceRect.width(), kDeviceRect.height()); } |
| 36 | void onDraw(SkCanvas*) final; |
| 37 | }; |
| 38 | |
| 39 | void WindowRectanglesBaseGM::onDraw(SkCanvas* canvas) { |
| 40 | sk_tool_utils::draw_checkerboard(canvas, 0xffffffff, 0xffc6c3c6, 25); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 41 | |
| 42 | SkClipStack stack; |
Brian Salomon | a3b45d4 | 2016-10-03 11:36:16 -0400 | [diff] [blame] | 43 | stack.clipRect(SkRect::MakeXYWH(370.75, 80.25, 149, 100), SkMatrix::I(), |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 44 | kDifference_SkClipOp, false); |
Brian Salomon | a3b45d4 | 2016-10-03 11:36:16 -0400 | [diff] [blame] | 45 | stack.clipRect(SkRect::MakeXYWH(80.25, 420.75, 150, 100), SkMatrix::I(), |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 46 | kDifference_SkClipOp, true); |
Brian Salomon | a3b45d4 | 2016-10-03 11:36:16 -0400 | [diff] [blame] | 47 | stack.clipRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(200, 200, 200, 200), 60, 45), |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 48 | SkMatrix::I(), kDifference_SkClipOp, true); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 49 | |
| 50 | SkRRect nine; |
| 51 | nine.setNinePatch(SkRect::MakeXYWH(550 - 30.25 - 100, 370.75, 100, 150), 12, 35, 23, 20); |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 52 | stack.clipRRect(nine, SkMatrix::I(), kDifference_SkClipOp, true); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 53 | |
| 54 | SkRRect complx; |
| 55 | SkVector complxRadii[4] = {{6, 4}, {8, 12}, {16, 24}, {48, 32}}; |
| 56 | complx.setRectRadii(SkRect::MakeXYWH(80.25, 80.75, 100, 149), complxRadii); |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 57 | stack.clipRRect(complx, SkMatrix::I(), kDifference_SkClipOp, false); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 58 | |
| 59 | this->onCoverClipStack(stack, canvas); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 63 | |
| 64 | /** |
| 65 | * Draws a clip that will exercise window rectangles if they are supported. |
| 66 | */ |
| 67 | class WindowRectanglesGM : public WindowRectanglesBaseGM { |
| 68 | private: |
| 69 | SkString onShortName() final { return SkString("windowrectangles"); } |
| 70 | void onCoverClipStack(const SkClipStack&, SkCanvas*) final; |
| 71 | }; |
| 72 | |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 73 | void WindowRectanglesGM::onCoverClipStack(const SkClipStack& stack, SkCanvas* canvas) { |
| 74 | SkPaint paint; |
| 75 | paint.setColor(0xff00aa80); |
| 76 | |
| 77 | // Set up the canvas's clip to match our SkClipStack. |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 78 | SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); |
| 79 | for (const SkClipStack::Element* element = iter.next(); element; element = iter.next()) { |
Mike Reed | 598524d | 2017-03-08 13:13:44 -0500 | [diff] [blame] | 80 | SkClipOp op = element->getOp(); |
| 81 | bool isAA = element->isAA(); |
Brian Salomon | f3b46e5 | 2017-08-30 11:37:57 -0400 | [diff] [blame] | 82 | switch (element->getDeviceSpaceType()) { |
| 83 | case SkClipStack::Element::DeviceSpaceType::kPath: |
| 84 | canvas->clipPath(element->getDeviceSpacePath(), op, isAA); |
Mike Reed | 598524d | 2017-03-08 13:13:44 -0500 | [diff] [blame] | 85 | break; |
Brian Salomon | f3b46e5 | 2017-08-30 11:37:57 -0400 | [diff] [blame] | 86 | case SkClipStack::Element::DeviceSpaceType::kRRect: |
| 87 | canvas->clipRRect(element->getDeviceSpaceRRect(), op, isAA); |
Mike Reed | 598524d | 2017-03-08 13:13:44 -0500 | [diff] [blame] | 88 | break; |
Brian Salomon | f3b46e5 | 2017-08-30 11:37:57 -0400 | [diff] [blame] | 89 | case SkClipStack::Element::DeviceSpaceType::kRect: |
| 90 | canvas->clipRect(element->getDeviceSpaceRect(), op, isAA); |
Mike Reed | 598524d | 2017-03-08 13:13:44 -0500 | [diff] [blame] | 91 | break; |
Brian Salomon | f3b46e5 | 2017-08-30 11:37:57 -0400 | [diff] [blame] | 92 | case SkClipStack::Element::DeviceSpaceType::kEmpty: |
Mike Reed | 598524d | 2017-03-08 13:13:44 -0500 | [diff] [blame] | 93 | canvas->clipRect({ 0, 0, 0, 0 }, kIntersect_SkClipOp, false); |
| 94 | break; |
| 95 | } |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | canvas->drawRect(SkRect::Make(kCoverRect), paint); |
| 99 | } |
| 100 | |
| 101 | DEF_GM( return new WindowRectanglesGM(); ) |
| 102 | |
| 103 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 104 | |
mtklein | 0a44107 | 2016-09-06 11:45:31 -0700 | [diff] [blame] | 105 | constexpr static int kNumWindows = 8; |
| 106 | |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 107 | /** |
Chris Dalton | c534808 | 2018-03-30 15:59:38 +0000 | [diff] [blame] | 108 | * Visualizes the mask (alpha or stencil) for a clip with several window rectangles. The purpose of |
| 109 | * this test is to verify that window rectangles are being used during clip mask generation, and to |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 110 | * visualize where the window rectangles are placed. |
| 111 | * |
| 112 | * We use window rectangles when generating the clip mask because there is no need to invest time |
| 113 | * defining those regions where window rectangles will be in effect during the actual draw anyway. |
| 114 | * |
| 115 | * This test works by filling the entire clip mask with a small checkerboard pattern before drawing |
| 116 | * it, and then covering the mask with a solid color once it has been generated. The regions inside |
| 117 | * window rectangles or outside the scissor should still have the initial checkerboard intact. |
| 118 | */ |
| 119 | class WindowRectanglesMaskGM : public WindowRectanglesBaseGM { |
| 120 | private: |
| 121 | constexpr static int kMaskCheckerSize = 5; |
| 122 | SkString onShortName() final { return SkString("windowrectangles_mask"); } |
| 123 | void onCoverClipStack(const SkClipStack&, SkCanvas*) final; |
Chris Dalton | c534808 | 2018-03-30 15:59:38 +0000 | [diff] [blame] | 124 | void visualizeAlphaMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&, GrPaint&&); |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 125 | void visualizeStencilMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&, GrPaint&&); |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 126 | void stencilCheckerboard(GrRenderTargetContext*, bool flip); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 127 | void fail(SkCanvas*); |
| 128 | }; |
| 129 | |
| 130 | /** |
| 131 | * Base class for GrClips that visualize a clip mask. |
| 132 | */ |
| 133 | class MaskOnlyClipBase : public GrClip { |
| 134 | private: |
| 135 | bool quickContains(const SkRect&) const final { return false; } |
Brian Salomon | 0e8fc8b | 2016-12-09 15:10:07 -0500 | [diff] [blame] | 136 | bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA*) const final { return false; } |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 137 | void getConservativeBounds(int width, int height, SkIRect* rect, bool* iior) const final { |
| 138 | rect->set(0, 0, width, height); |
| 139 | if (iior) { |
| 140 | *iior = false; |
| 141 | } |
| 142 | } |
| 143 | }; |
| 144 | |
| 145 | /** |
| 146 | * This class clips a cover by an alpha mask. We use it to visualize the alpha clip mask. |
| 147 | */ |
| 148 | class AlphaOnlyClip final : public MaskOnlyClipBase { |
| 149 | public: |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 150 | AlphaOnlyClip(sk_sp<GrTextureProxy> mask, int x, int y) : fMask(mask), fX(x), fY(y) {} |
| 151 | |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 152 | private: |
Brian Salomon | 97180af | 2017-03-14 13:42:58 -0400 | [diff] [blame] | 153 | bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out, |
| 154 | SkRect* bounds) const override { |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 155 | int w = fMask->width(); |
| 156 | int h = fMask->height(); |
| 157 | out->addCoverageFP(GrDeviceSpaceTextureDecalFragmentProcessor::Make( |
| 158 | fMask, SkIRect::MakeWH(w, h), {fX, fY})); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 159 | return true; |
| 160 | } |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 161 | sk_sp<GrTextureProxy> fMask; |
| 162 | int fX; |
| 163 | int fY; |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | /** |
Chris Dalton | bbfd516 | 2017-11-07 13:35:22 -0700 | [diff] [blame] | 167 | * Makes a clip object that enforces the stencil clip bit. Used to visualize the stencil mask. |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 168 | */ |
Chris Dalton | bbfd516 | 2017-11-07 13:35:22 -0700 | [diff] [blame] | 169 | static GrStencilClip make_stencil_only_clip() { |
| 170 | return GrStencilClip(SkClipStack::kEmptyGenID); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 171 | }; |
| 172 | |
| 173 | void WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas* canvas) { |
| 174 | GrContext* ctx = canvas->getGrContext(); |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 175 | GrRenderTargetContext* rtc = canvas->internal_private_accessTopLayerRenderTargetContext(); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 176 | |
Robert Phillips | ec2249f | 2016-11-09 08:54:35 -0500 | [diff] [blame] | 177 | if (!ctx || !rtc || rtc->priv().maxWindowRectangles() < kNumWindows) { |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 178 | this->fail(canvas); |
| 179 | return; |
| 180 | } |
| 181 | |
Chris Dalton | 4c458b1 | 2018-06-16 17:22:59 -0600 | [diff] [blame] | 182 | const GrReducedClip reducedClip(stack, SkRect::Make(kCoverRect), rtc->caps(), kNumWindows); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 183 | |
Chris Dalton | c534808 | 2018-03-30 15:59:38 +0000 | [diff] [blame] | 184 | GrPaint paint; |
Brian Salomon | 7c8460e | 2017-05-12 11:36:10 -0400 | [diff] [blame] | 185 | if (GrFSAAType::kNone == rtc->fsaaType()) { |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 186 | paint.setColor4f(GrColor4f(0, 0.25f, 1, 1)); |
Chris Dalton | c534808 | 2018-03-30 15:59:38 +0000 | [diff] [blame] | 187 | this->visualizeAlphaMask(ctx, rtc, reducedClip, std::move(paint)); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 188 | } else { |
| 189 | paint.setColor4f(GrColor4f(1, 0.25f, 0.25f, 1)); |
Chris Dalton | c534808 | 2018-03-30 15:59:38 +0000 | [diff] [blame] | 190 | this->visualizeStencilMask(ctx, rtc, reducedClip, std::move(paint)); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 191 | } |
Chris Dalton | c534808 | 2018-03-30 15:59:38 +0000 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetContext* rtc, |
| 195 | const GrReducedClip& reducedClip, GrPaint&& paint) { |
| 196 | const int padRight = (kDeviceRect.right() - kCoverRect.right()) / 2; |
| 197 | const int padBottom = (kDeviceRect.bottom() - kCoverRect.bottom()) / 2; |
| 198 | sk_sp<GrRenderTargetContext> maskRTC( |
| 199 | ctx->contextPriv().makeDeferredRenderTargetContextWithFallback( |
| 200 | SkBackingFit::kExact, |
| 201 | kCoverRect.width() + padRight, |
| 202 | kCoverRect.height() + padBottom, |
| 203 | kAlpha_8_GrPixelConfig, nullptr)); |
| 204 | if (!maskRTC) { |
| 205 | return; |
| 206 | } |
| 207 | |
| 208 | // Draw a checker pattern into the alpha mask so we can visualize the regions left untouched by |
| 209 | // the clip mask generation. |
| 210 | this->stencilCheckerboard(maskRTC.get(), true); |
| 211 | maskRTC->clear(nullptr, GrColorPackA4(0xff), GrRenderTargetContext::CanClearFullscreen::kYes); |
| 212 | maskRTC->priv().drawAndStencilRect(make_stencil_only_clip(), &GrUserStencilSettings::kUnused, |
| 213 | SkRegion::kDifference_Op, false, GrAA::kNo, SkMatrix::I(), |
| 214 | SkRect::MakeIWH(maskRTC->width(), maskRTC->height())); |
| 215 | reducedClip.drawAlphaClipMask(maskRTC.get()); |
| 216 | |
| 217 | int x = kCoverRect.x() - kDeviceRect.x(), |
| 218 | y = kCoverRect.y() - kDeviceRect.y(); |
| 219 | |
| 220 | // Now visualize the alpha mask by drawing a rect over the area where it is defined. The regions |
| 221 | // inside window rectangles or outside the scissor should still have the initial checkerboard |
| 222 | // intact. (This verifies we didn't spend any time modifying those pixels in the mask.) |
| 223 | AlphaOnlyClip clip(maskRTC->asTextureProxyRef(), x, y); |
| 224 | rtc->drawRect(clip, std::move(paint), GrAA::kYes, SkMatrix::I(), |
| 225 | SkRect::Make(SkIRect::MakeXYWH(x, y, maskRTC->width(), maskRTC->height()))); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 226 | } |
| 227 | |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 228 | void WindowRectanglesMaskGM::visualizeStencilMask(GrContext* ctx, GrRenderTargetContext* rtc, |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 229 | const GrReducedClip& reducedClip, |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 230 | GrPaint&& paint) { |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 231 | // Draw a checker pattern into the stencil buffer so we can visualize the regions left untouched |
| 232 | // by the clip mask generation. |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 233 | this->stencilCheckerboard(rtc, false); |
Brian Salomon | 9a76772 | 2017-03-13 17:57:28 -0400 | [diff] [blame] | 234 | reducedClip.drawStencilClipMask(ctx, rtc); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 235 | |
| 236 | // Now visualize the stencil mask by covering the entire render target. The regions inside |
Robert Phillips | 806be2d | 2017-06-28 15:23:59 -0400 | [diff] [blame] | 237 | // window rectangles or outside the scissor should still have the initial checkerboard intact. |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 238 | // (This verifies we didn't spend any time modifying those pixels in the mask.) |
Chris Dalton | bbfd516 | 2017-11-07 13:35:22 -0700 | [diff] [blame] | 239 | rtc->drawPaint(make_stencil_only_clip(), std::move(paint), SkMatrix::I()); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 240 | } |
| 241 | |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 242 | void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, bool flip) { |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 243 | constexpr static GrUserStencilSettings kSetClip( |
| 244 | GrUserStencilSettings::StaticInit< |
| 245 | 0, |
| 246 | GrUserStencilTest::kAlways, |
| 247 | 0, |
| 248 | GrUserStencilOp::kSetClipBit, |
| 249 | GrUserStencilOp::kKeep, |
| 250 | 0>() |
| 251 | ); |
| 252 | |
Jim Van Verth | 6a40abc | 2017-11-02 16:56:09 +0000 | [diff] [blame] | 253 | rtc->priv().clearStencilClip(GrFixedClip::Disabled(), false); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 254 | |
Brian Salomon | 9a76772 | 2017-03-13 17:57:28 -0400 | [diff] [blame] | 255 | for (int y = 0; y < kDeviceRect.height(); y += kMaskCheckerSize) { |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 256 | for (int x = (y & 1) == flip ? 0 : kMaskCheckerSize; |
Brian Salomon | 9a76772 | 2017-03-13 17:57:28 -0400 | [diff] [blame] | 257 | x < kDeviceRect.width(); x += 2 * kMaskCheckerSize) { |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 258 | SkIRect checker = SkIRect::MakeXYWH(x, y, kMaskCheckerSize, kMaskCheckerSize); |
Brian Salomon | 0e8fc8b | 2016-12-09 15:10:07 -0500 | [diff] [blame] | 259 | rtc->priv().stencilRect(GrNoClip(), &kSetClip, GrAAType::kNone, SkMatrix::I(), |
Brian Osman | 693a540 | 2016-10-27 15:13:22 -0400 | [diff] [blame] | 260 | SkRect::Make(checker)); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 261 | } |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | void WindowRectanglesMaskGM::fail(SkCanvas* canvas) { |
| 266 | SkPaint paint; |
| 267 | paint.setAntiAlias(true); |
| 268 | paint.setTextAlign(SkPaint::kCenter_Align); |
| 269 | paint.setTextSize(20); |
| 270 | sk_tool_utils::set_portable_typeface(&paint); |
| 271 | |
| 272 | SkString errorMsg; |
| 273 | errorMsg.printf("Requires GPU with %i window rectangles", kNumWindows); |
| 274 | |
| 275 | canvas->clipRect(SkRect::Make(kCoverRect)); |
| 276 | canvas->clear(SK_ColorWHITE); |
Mike Reed | 1f27585 | 2018-04-11 14:30:17 -0400 | [diff] [blame] | 277 | |
| 278 | canvas->drawString(errorMsg, SkIntToScalar((kCoverRect.left() + kCoverRect.right())/2), |
| 279 | SkIntToScalar((kCoverRect.top() + kCoverRect.bottom())/2 - 10), paint); |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | DEF_GM( return new WindowRectanglesMaskGM(); ) |
| 283 | |
csmartdalton | bf4a8f9 | 2016-09-06 10:01:06 -0700 | [diff] [blame] | 284 | } |