robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 9 | #include "include/core/SkBBHFactory.h" |
| 10 | #include "include/core/SkBlendMode.h" |
| 11 | #include "include/core/SkCanvas.h" |
| 12 | #include "include/core/SkColor.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "include/core/SkColorFilter.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 14 | #include "include/core/SkImageInfo.h" |
| 15 | #include "include/core/SkMatrix.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 16 | #include "include/core/SkMultiPictureDraw.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 17 | #include "include/core/SkPaint.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 18 | #include "include/core/SkPath.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 19 | #include "include/core/SkPicture.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 20 | #include "include/core/SkPictureRecorder.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 21 | #include "include/core/SkRRect.h" |
| 22 | #include "include/core/SkRect.h" |
| 23 | #include "include/core/SkRefCnt.h" |
| 24 | #include "include/core/SkScalar.h" |
| 25 | #include "include/core/SkSize.h" |
| 26 | #include "include/core/SkString.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 27 | #include "include/core/SkSurface.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 28 | #include "include/core/SkTypes.h" |
| 29 | #include "include/private/SkTArray.h" |
| 30 | #include "tools/ToolUtils.h" |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 31 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 32 | constexpr SkScalar kRoot3Over2 = 0.86602545f; // sin(60) |
| 33 | constexpr SkScalar kRoot3 = 1.73205081f; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 34 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 35 | constexpr int kHexSide = 30; |
| 36 | constexpr int kNumHexX = 6; |
| 37 | constexpr int kNumHexY = 6; |
| 38 | constexpr int kPicWidth = kNumHexX * kHexSide; |
| 39 | constexpr int kPicHeight = (int)((kNumHexY - 0.5f) * 2 * kHexSide * kRoot3Over2 + 0.5f); |
| 40 | constexpr SkScalar kInset = 20.0f; |
| 41 | constexpr int kNumPictures = 4; |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 42 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 43 | constexpr int kTriSide = 40; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 44 | |
| 45 | // Create a hexagon centered at (originX, originY) |
| 46 | static SkPath make_hex_path(SkScalar originX, SkScalar originY) { |
| 47 | SkPath hex; |
| 48 | hex.moveTo(originX-kHexSide, originY); |
| 49 | hex.rLineTo(SkScalarHalf(kHexSide), kRoot3Over2 * kHexSide); |
| 50 | hex.rLineTo(SkIntToScalar(kHexSide), 0); |
| 51 | hex.rLineTo(SkScalarHalf(kHexSide), -kHexSide * kRoot3Over2); |
| 52 | hex.rLineTo(-SkScalarHalf(kHexSide), -kHexSide * kRoot3Over2); |
| 53 | hex.rLineTo(-SkIntToScalar(kHexSide), 0); |
| 54 | hex.close(); |
| 55 | return hex; |
| 56 | } |
| 57 | |
| 58 | // Make a picture that is a tiling of the plane with stroked hexagons where |
| 59 | // each hexagon is in its own layer. The layers are to exercise Ganesh's |
| 60 | // layer hoisting. |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 61 | static sk_sp<SkPicture> make_hex_plane_picture(SkColor fillColor) { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 62 | |
| 63 | // Create a hexagon with its center at the origin |
| 64 | SkPath hex = make_hex_path(0, 0); |
| 65 | |
| 66 | SkPaint fill; |
| 67 | fill.setStyle(SkPaint::kFill_Style); |
| 68 | fill.setColor(fillColor); |
| 69 | |
| 70 | SkPaint stroke; |
| 71 | stroke.setStyle(SkPaint::kStroke_Style); |
| 72 | stroke.setStrokeWidth(3); |
| 73 | |
| 74 | SkPictureRecorder recorder; |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 75 | SkRTreeFactory bbhFactory; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 76 | |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 77 | SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth), |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 78 | SkIntToScalar(kPicHeight), |
robertphillips | dda5445 | 2016-07-13 13:27:16 -0700 | [diff] [blame] | 79 | &bbhFactory); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 80 | |
| 81 | SkScalar xPos, yPos = 0; |
| 82 | |
| 83 | for (int y = 0; y < kNumHexY; ++y) { |
| 84 | xPos = 0; |
| 85 | |
| 86 | for (int x = 0; x < kNumHexX; ++x) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 87 | canvas->saveLayer(nullptr, nullptr); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 88 | canvas->translate(xPos, yPos + ((x % 2) ? kRoot3Over2 * kHexSide : 0)); |
| 89 | canvas->drawPath(hex, fill); |
| 90 | canvas->drawPath(hex, stroke); |
| 91 | canvas->restore(); |
| 92 | |
| 93 | xPos += 1.5f * kHexSide; |
| 94 | } |
| 95 | |
| 96 | yPos += 2 * kHexSide * kRoot3Over2; |
| 97 | } |
| 98 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 99 | return recorder.finishRecordingAsPicture(); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 100 | } |
| 101 | |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 102 | // Create a picture that consists of a single large layer that is tiled |
| 103 | // with hexagons. |
| 104 | // This is intended to exercise the layer hoisting code's clip handling (in |
| 105 | // tile mode). |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 106 | static sk_sp<SkPicture> make_single_layer_hex_plane_picture() { |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 107 | |
| 108 | // Create a hexagon with its center at the origin |
| 109 | SkPath hex = make_hex_path(0, 0); |
| 110 | |
| 111 | SkPaint whiteFill; |
| 112 | whiteFill.setStyle(SkPaint::kFill_Style); |
| 113 | whiteFill.setColor(SK_ColorWHITE); |
| 114 | |
| 115 | SkPaint greyFill; |
| 116 | greyFill.setStyle(SkPaint::kFill_Style); |
Mike Klein | d46dce3 | 2018-08-16 10:17:03 -0400 | [diff] [blame] | 117 | greyFill.setColor(SK_ColorLTGRAY); |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 118 | |
| 119 | SkPaint stroke; |
| 120 | stroke.setStyle(SkPaint::kStroke_Style); |
| 121 | stroke.setStrokeWidth(3); |
| 122 | |
| 123 | SkPictureRecorder recorder; |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 124 | SkRTreeFactory bbhFactory; |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 125 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 126 | constexpr SkScalar kBig = 10000.0f; |
robertphillips | dda5445 | 2016-07-13 13:27:16 -0700 | [diff] [blame] | 127 | SkCanvas* canvas = recorder.beginRecording(kBig, kBig, &bbhFactory); |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 128 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 129 | canvas->saveLayer(nullptr, nullptr); |
robertphillips | 1564dde | 2014-10-06 11:50:31 -0700 | [diff] [blame] | 130 | |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 131 | SkScalar xPos = 0.0f, yPos = 0.0f; |
| 132 | |
| 133 | for (int y = 0; yPos < kBig; ++y) { |
| 134 | xPos = 0; |
| 135 | |
| 136 | for (int x = 0; xPos < kBig; ++x) { |
| 137 | canvas->save(); |
| 138 | canvas->translate(xPos, yPos + ((x % 2) ? kRoot3Over2 * kHexSide : 0)); |
| 139 | // The color of the filled hex is swapped to yield a different |
| 140 | // pattern in each tile. This allows an error in layer hoisting (e.g., |
| 141 | // the clip isn't blocking cache reuse) to cause a visual discrepancy. |
| 142 | canvas->drawPath(hex, ((x+y) % 3) ? whiteFill : greyFill); |
| 143 | canvas->drawPath(hex, stroke); |
| 144 | canvas->restore(); |
| 145 | |
| 146 | xPos += 1.5f * kHexSide; |
| 147 | } |
| 148 | |
| 149 | yPos += 2 * kHexSide * kRoot3Over2; |
| 150 | } |
| 151 | |
robertphillips | 1564dde | 2014-10-06 11:50:31 -0700 | [diff] [blame] | 152 | canvas->restore(); |
| 153 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 154 | return recorder.finishRecordingAsPicture(); |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 155 | } |
| 156 | |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 157 | // Make an equilateral triangle path with its top corner at (originX, originY) |
| 158 | static SkPath make_tri_path(SkScalar originX, SkScalar originY) { |
| 159 | SkPath tri; |
| 160 | tri.moveTo(originX, originY); |
| 161 | tri.rLineTo(SkScalarHalf(kTriSide), 1.5f * kTriSide / kRoot3); |
| 162 | tri.rLineTo(-kTriSide, 0); |
| 163 | tri.close(); |
| 164 | return tri; |
| 165 | } |
| 166 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 167 | static sk_sp<SkPicture> make_tri_picture() { |
robertphillips | aa0c837 | 2014-09-29 05:07:39 -0700 | [diff] [blame] | 168 | SkPath tri = make_tri_path(SkScalarHalf(kTriSide), 0); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 169 | |
| 170 | SkPaint fill; |
| 171 | fill.setStyle(SkPaint::kFill_Style); |
Mike Klein | d46dce3 | 2018-08-16 10:17:03 -0400 | [diff] [blame] | 172 | fill.setColor(SK_ColorLTGRAY); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 173 | |
| 174 | SkPaint stroke; |
| 175 | stroke.setStyle(SkPaint::kStroke_Style); |
| 176 | stroke.setStrokeWidth(3); |
| 177 | |
| 178 | SkPictureRecorder recorder; |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 179 | SkRTreeFactory bbhFactory; |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 180 | |
| 181 | SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth), |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 182 | SkIntToScalar(kPicHeight), |
robertphillips | dda5445 | 2016-07-13 13:27:16 -0700 | [diff] [blame] | 183 | &bbhFactory); |
robertphillips | 7f1ed83 | 2014-10-03 07:29:20 -0700 | [diff] [blame] | 184 | SkRect r = tri.getBounds(); |
| 185 | r.outset(2.0f, 2.0f); // outset for stroke |
| 186 | canvas->clipRect(r); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 187 | // The saveLayer/restore block is to exercise layer hoisting |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 188 | canvas->saveLayer(nullptr, nullptr); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 189 | canvas->drawPath(tri, fill); |
| 190 | canvas->drawPath(tri, stroke); |
| 191 | canvas->restore(); |
| 192 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 193 | return recorder.finishRecordingAsPicture(); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 194 | } |
| 195 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 196 | static sk_sp<SkPicture> make_sub_picture(const SkPicture* tri) { |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 197 | SkPictureRecorder recorder; |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 198 | SkRTreeFactory bbhFactory; |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 199 | |
| 200 | SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth), |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 201 | SkIntToScalar(kPicHeight), |
robertphillips | dda5445 | 2016-07-13 13:27:16 -0700 | [diff] [blame] | 202 | &bbhFactory); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 203 | |
| 204 | canvas->scale(1.0f/2.0f, 1.0f/2.0f); |
| 205 | |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 206 | canvas->save(); |
robertphillips | aa0c837 | 2014-09-29 05:07:39 -0700 | [diff] [blame] | 207 | canvas->translate(SkScalarHalf(kTriSide), 0); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 208 | canvas->drawPicture(tri); |
| 209 | canvas->restore(); |
| 210 | |
| 211 | canvas->save(); |
robertphillips | aa0c837 | 2014-09-29 05:07:39 -0700 | [diff] [blame] | 212 | canvas->translate(SkIntToScalar(kTriSide), 1.5f * kTriSide / kRoot3); |
| 213 | canvas->drawPicture(tri); |
| 214 | canvas->restore(); |
| 215 | |
| 216 | canvas->save(); |
| 217 | canvas->translate(0, 1.5f * kTriSide / kRoot3); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 218 | canvas->drawPicture(tri); |
| 219 | canvas->restore(); |
| 220 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 221 | return recorder.finishRecordingAsPicture(); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | // Create a Sierpinkski-like picture that starts with a top row with a picture |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 225 | // that just contains a triangle. Subsequent rows take the prior row's picture, |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 226 | // shrinks it and replicates it 3 times then draws and appropriate number of |
| 227 | // copies of it. |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 228 | static sk_sp<SkPicture> make_sierpinski_picture() { |
| 229 | sk_sp<SkPicture> pic(make_tri_picture()); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 230 | |
| 231 | SkPictureRecorder recorder; |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 232 | SkRTreeFactory bbhFactory; |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 233 | |
| 234 | SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth), |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 235 | SkIntToScalar(kPicHeight), |
robertphillips | dda5445 | 2016-07-13 13:27:16 -0700 | [diff] [blame] | 236 | &bbhFactory); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 237 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 238 | constexpr int kNumLevels = 4; |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 239 | for (int i = 0; i < kNumLevels; ++i) { |
| 240 | canvas->save(); |
robertphillips | aa0c837 | 2014-09-29 05:07:39 -0700 | [diff] [blame] | 241 | canvas->translate(kPicWidth/2 - (i+1) * (kTriSide/2.0f), 0.0f); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 242 | for (int j = 0; j < i+1; ++j) { |
| 243 | canvas->drawPicture(pic); |
| 244 | canvas->translate(SkIntToScalar(kTriSide), 0); |
| 245 | } |
| 246 | canvas->restore(); |
| 247 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 248 | pic = make_sub_picture(pic.get()); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 249 | |
| 250 | canvas->translate(0, 1.5f * kTriSide / kRoot3); |
| 251 | } |
| 252 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 253 | return recorder.finishRecordingAsPicture(); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 254 | } |
| 255 | |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 256 | static sk_sp<SkSurface> create_compat_surface(SkCanvas* canvas, int width, int height) { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 257 | SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
| 258 | |
Mike Klein | ea3f014 | 2019-03-20 11:12:10 -0500 | [diff] [blame] | 259 | return ToolUtils::makeSurface(canvas, info); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | // This class stores the information required to compose all the result |
| 263 | // fragments potentially generated by the MultiPictureDraw object |
| 264 | class ComposeStep { |
| 265 | public: |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 266 | ComposeStep() : fX(0.0f), fY(0.0f), fPaint(nullptr) { } |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 267 | ~ComposeStep() { |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 268 | delete fPaint; |
| 269 | } |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 270 | |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 271 | sk_sp<SkSurface> fSurf; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 272 | SkScalar fX; |
| 273 | SkScalar fY; |
| 274 | SkPaint* fPaint; |
| 275 | }; |
| 276 | |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 277 | typedef void (*PFContentMtd)(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 278 | |
| 279 | // Just a single picture with no clip |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 280 | static void no_clip(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]) { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 281 | canvas->drawPicture(pictures[0]); |
| 282 | } |
| 283 | |
| 284 | // Two pictures with a rect clip on the second one |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 285 | static void rect_clip(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]) { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 286 | canvas->drawPicture(pictures[0]); |
| 287 | |
robertphillips | a8d7f0b | 2014-08-29 08:03:56 -0700 | [diff] [blame] | 288 | SkRect rect = pictures[0]->cullRect(); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 289 | rect.inset(kInset, kInset); |
| 290 | |
| 291 | canvas->clipRect(rect); |
| 292 | |
| 293 | canvas->drawPicture(pictures[1]); |
| 294 | } |
| 295 | |
| 296 | // Two pictures with a round rect clip on the second one |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 297 | static void rrect_clip(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]) { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 298 | canvas->drawPicture(pictures[0]); |
| 299 | |
robertphillips | a8d7f0b | 2014-08-29 08:03:56 -0700 | [diff] [blame] | 300 | SkRect rect = pictures[0]->cullRect(); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 301 | rect.inset(kInset, kInset); |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 302 | |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 303 | SkRRect rrect; |
| 304 | rrect.setRectXY(rect, kInset, kInset); |
| 305 | |
| 306 | canvas->clipRRect(rrect); |
| 307 | |
| 308 | canvas->drawPicture(pictures[1]); |
| 309 | } |
| 310 | |
| 311 | // Two pictures with a clip path on the second one |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 312 | static void path_clip(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]) { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 313 | canvas->drawPicture(pictures[0]); |
| 314 | |
| 315 | // Create a hexagon centered on the middle of the hex grid |
| 316 | SkPath hex = make_hex_path((kNumHexX / 2.0f) * kHexSide, kNumHexY * kHexSide * kRoot3Over2); |
| 317 | |
| 318 | canvas->clipPath(hex); |
| 319 | |
| 320 | canvas->drawPicture(pictures[1]); |
| 321 | } |
| 322 | |
| 323 | // Two pictures with an inverse clip path on the second one |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 324 | static void invpath_clip(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]) { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 325 | canvas->drawPicture(pictures[0]); |
| 326 | |
| 327 | // Create a hexagon centered on the middle of the hex grid |
| 328 | SkPath hex = make_hex_path((kNumHexX / 2.0f) * kHexSide, kNumHexY * kHexSide * kRoot3Over2); |
| 329 | hex.setFillType(SkPath::kInverseEvenOdd_FillType); |
| 330 | |
| 331 | canvas->clipPath(hex); |
| 332 | |
| 333 | canvas->drawPicture(pictures[1]); |
| 334 | } |
| 335 | |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 336 | // Reuse a single base (triangular) picture a _lot_ (rotated, scaled and translated). |
| 337 | static void sierpinski(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]) { |
| 338 | canvas->save(); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 339 | canvas->drawPicture(pictures[2]); |
| 340 | |
| 341 | canvas->rotate(180.0f); |
robertphillips | aa0c837 | 2014-09-29 05:07:39 -0700 | [diff] [blame] | 342 | canvas->translate(-SkIntToScalar(kPicWidth), -SkIntToScalar(kPicHeight)); |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 343 | canvas->drawPicture(pictures[2]); |
| 344 | canvas->restore(); |
| 345 | } |
| 346 | |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 347 | static void big_layer(SkCanvas* canvas, const SkPicture* pictures[kNumPictures]) { |
| 348 | canvas->drawPicture(pictures[3]); |
| 349 | } |
| 350 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 351 | constexpr PFContentMtd gContentMthds[] = { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 352 | no_clip, |
| 353 | rect_clip, |
| 354 | rrect_clip, |
| 355 | path_clip, |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 356 | invpath_clip, |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 357 | sierpinski, |
| 358 | big_layer, |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 359 | }; |
| 360 | |
| 361 | static void create_content(SkMultiPictureDraw* mpd, PFContentMtd pfGen, |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 362 | const SkPicture* pictures[kNumPictures], |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 363 | SkCanvas* dest, const SkMatrix& xform) { |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 364 | sk_sp<SkPicture> composite; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 365 | |
| 366 | { |
| 367 | SkPictureRecorder recorder; |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 368 | SkRTreeFactory bbhFactory; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 369 | |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 370 | SkCanvas* pictureCanvas = recorder.beginRecording(SkIntToScalar(kPicWidth), |
robertphillips | 81f71b6 | 2014-11-11 04:54:49 -0800 | [diff] [blame] | 371 | SkIntToScalar(kPicHeight), |
robertphillips | dda5445 | 2016-07-13 13:27:16 -0700 | [diff] [blame] | 372 | &bbhFactory); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 373 | |
| 374 | (*pfGen)(pictureCanvas, pictures); |
| 375 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 376 | composite = recorder.finishRecordingAsPicture(); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 377 | } |
| 378 | |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 379 | mpd->add(dest, composite.get(), &xform); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 380 | } |
| 381 | |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 382 | typedef void(*PFLayoutMtd)(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd, |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 383 | PFContentMtd pfGen, const SkPicture* pictures[kNumPictures], |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 384 | SkTArray<ComposeStep>* composeSteps); |
| 385 | |
| 386 | // Draw the content into a single canvas |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 387 | static void simple(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd, |
| 388 | PFContentMtd pfGen, |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 389 | const SkPicture* pictures[kNumPictures], |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 390 | SkTArray<ComposeStep> *composeSteps) { |
| 391 | |
| 392 | ComposeStep& step = composeSteps->push_back(); |
| 393 | |
bsalomon | 892f31a | 2014-08-21 14:40:36 -0700 | [diff] [blame] | 394 | step.fSurf = create_compat_surface(finalCanvas, kPicWidth, kPicHeight); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 395 | |
| 396 | SkCanvas* subCanvas = step.fSurf->getCanvas(); |
| 397 | |
| 398 | create_content(mpd, pfGen, pictures, subCanvas, SkMatrix::I()); |
| 399 | } |
| 400 | |
| 401 | // Draw the content into multiple canvases/tiles |
| 402 | static void tiled(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd, |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 403 | PFContentMtd pfGen, |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 404 | const SkPicture* pictures[kNumPictures], |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 405 | SkTArray<ComposeStep> *composeSteps) { |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 406 | const int kNumTilesX = 2; |
| 407 | const int kNumTilesY = 2; |
| 408 | const int kTileWidth = kPicWidth / kNumTilesX; |
| 409 | const int kTileHeight = kPicHeight / kNumTilesY; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 410 | |
| 411 | SkASSERT(kPicWidth == kNumTilesX * kTileWidth); |
| 412 | SkASSERT(kPicHeight == kNumTilesY * kTileHeight); |
| 413 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 414 | const SkColor colors[kNumTilesX][kNumTilesY] = { |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 415 | { SK_ColorCYAN, SK_ColorMAGENTA }, |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 416 | { SK_ColorYELLOW, SK_ColorGREEN } |
| 417 | }; |
| 418 | |
| 419 | for (int y = 0; y < kNumTilesY; ++y) { |
| 420 | for (int x = 0; x < kNumTilesX; ++x) { |
| 421 | ComposeStep& step = composeSteps->push_back(); |
| 422 | |
| 423 | step.fX = SkIntToScalar(x*kTileWidth); |
| 424 | step.fY = SkIntToScalar(y*kTileHeight); |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 425 | step.fPaint = new SkPaint; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 426 | step.fPaint->setColorFilter( |
Mike Reed | b286bc2 | 2019-04-08 16:23:20 -0400 | [diff] [blame] | 427 | SkColorFilters::Blend(colors[x][y], SkBlendMode::kModulate)); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 428 | |
bsalomon | 892f31a | 2014-08-21 14:40:36 -0700 | [diff] [blame] | 429 | step.fSurf = create_compat_surface(finalCanvas, kTileWidth, kTileHeight); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 430 | |
| 431 | SkCanvas* subCanvas = step.fSurf->getCanvas(); |
| 432 | |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 433 | const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWidth), |
robertphillips | 1d24b8d | 2015-03-26 19:57:08 -0700 | [diff] [blame] | 434 | -SkIntToScalar(y*kTileHeight)); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 435 | |
| 436 | create_content(mpd, pfGen, pictures, subCanvas, trans); |
| 437 | } |
| 438 | } |
| 439 | } |
| 440 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 441 | constexpr PFLayoutMtd gLayoutMthds[] = { simple, tiled }; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 442 | |
| 443 | namespace skiagm { |
| 444 | /** |
| 445 | * This GM exercises the SkMultiPictureDraw object. It tests the |
| 446 | * cross product of: |
| 447 | * tiled vs. all-at-once rendering (e.g., into many or just 1 canvas) |
| 448 | * different clips (e.g., none, rect, rrect) |
| 449 | * single vs. multiple pictures (e.g., normal vs. picture-pile-style content) |
| 450 | */ |
| 451 | class MultiPictureDraw : public GM { |
| 452 | public: |
| 453 | enum Content { |
| 454 | kNoClipSingle_Content, |
| 455 | kRectClipMulti_Content, |
| 456 | kRRectClipMulti_Content, |
| 457 | kPathClipMulti_Content, |
| 458 | kInvPathClipMulti_Content, |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 459 | kSierpinski_Content, |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 460 | kBigLayer_Content, |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 461 | |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 462 | kLast_Content = kBigLayer_Content |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 463 | }; |
| 464 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 465 | const int kContentCnt = kLast_Content + 1; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 466 | |
| 467 | enum Layout { |
| 468 | kSimple_Layout, |
| 469 | kTiled_Layout, |
| 470 | |
| 471 | kLast_Layout = kTiled_Layout |
| 472 | }; |
| 473 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 474 | const int kLayoutCnt = kLast_Layout + 1; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 475 | |
| 476 | MultiPictureDraw(Content content, Layout layout) : fContent(content), fLayout(layout) { |
| 477 | SkASSERT(SK_ARRAY_COUNT(gLayoutMthds) == kLayoutCnt); |
| 478 | SkASSERT(SK_ARRAY_COUNT(gContentMthds) == kContentCnt); |
| 479 | |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 480 | for (int i = 0; i < kNumPictures; ++i) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 481 | fPictures[i] = nullptr; |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 482 | } |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 483 | } |
| 484 | |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 485 | ~MultiPictureDraw() override { |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 486 | for (int i = 0; i < kNumPictures; ++i) { |
| 487 | SkSafeUnref(fPictures[i]); |
| 488 | } |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 489 | } |
| 490 | |
| 491 | protected: |
| 492 | Content fContent; |
| 493 | Layout fLayout; |
robertphillips | 3bc25e7 | 2014-09-19 08:56:09 -0700 | [diff] [blame] | 494 | const SkPicture* fPictures[kNumPictures]; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 495 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 496 | void onOnceBeforeDraw() override { |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 497 | fPictures[0] = make_hex_plane_picture(SK_ColorWHITE).release(); |
Mike Klein | d46dce3 | 2018-08-16 10:17:03 -0400 | [diff] [blame] | 498 | fPictures[1] = make_hex_plane_picture(SK_ColorGRAY).release(); |
reed | ca2622b | 2016-03-18 07:25:55 -0700 | [diff] [blame] | 499 | fPictures[2] = make_sierpinski_picture().release(); |
| 500 | fPictures[3] = make_single_layer_hex_plane_picture().release(); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 501 | } |
| 502 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 503 | void onDraw(SkCanvas* canvas) override { |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 504 | SkMultiPictureDraw mpd; |
| 505 | SkTArray<ComposeStep> composeSteps; |
| 506 | |
| 507 | // Fill up the MultiPictureDraw |
piotaixr | b5fae93 | 2014-09-24 13:03:30 -0700 | [diff] [blame] | 508 | (*gLayoutMthds[fLayout])(canvas, &mpd, |
| 509 | gContentMthds[fContent], |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 510 | fPictures, &composeSteps); |
| 511 | |
| 512 | mpd.draw(); |
| 513 | |
| 514 | // Compose all the drawn canvases into the final canvas |
| 515 | for (int i = 0; i < composeSteps.count(); ++i) { |
| 516 | const ComposeStep& step = composeSteps[i]; |
| 517 | |
reed | 9ce9d67 | 2016-03-17 10:51:11 -0700 | [diff] [blame] | 518 | canvas->drawImage(step.fSurf->makeImageSnapshot().get(), |
| 519 | step.fX, step.fY, step.fPaint); |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 520 | } |
| 521 | } |
| 522 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 523 | SkISize onISize() override { return SkISize::Make(kPicWidth, kPicHeight); } |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 524 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 525 | SkString onShortName() override { |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 526 | const char* gContentNames[] = { |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 527 | "noclip", "rectclip", "rrectclip", "pathclip", |
robertphillips | b1fc64b | 2014-10-02 08:32:43 -0700 | [diff] [blame] | 528 | "invpathclip", "sierpinski", "biglayer" |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 529 | }; |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 530 | const char* gLayoutNames[] = { "simple", "tiled" }; |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 531 | |
| 532 | SkASSERT(SK_ARRAY_COUNT(gLayoutNames) == kLayoutCnt); |
| 533 | SkASSERT(SK_ARRAY_COUNT(gContentNames) == kContentCnt); |
| 534 | |
| 535 | SkString name("multipicturedraw_"); |
| 536 | |
| 537 | name.append(gContentNames[fContent]); |
| 538 | name.append("_"); |
| 539 | name.append(gLayoutNames[fLayout]); |
| 540 | return name; |
| 541 | } |
| 542 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 543 | bool runAsBench() const override { return true; } |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 544 | |
| 545 | private: |
| 546 | typedef GM INHERITED; |
| 547 | }; |
| 548 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 549 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kNoClipSingle_Content, |
| 550 | MultiPictureDraw::kSimple_Layout);) |
| 551 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRectClipMulti_Content, |
| 552 | MultiPictureDraw::kSimple_Layout);) |
| 553 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRRectClipMulti_Content, |
| 554 | MultiPictureDraw::kSimple_Layout);) |
| 555 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content, |
| 556 | MultiPictureDraw::kSimple_Layout);) |
| 557 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Content, |
| 558 | MultiPictureDraw::kSimple_Layout);) |
| 559 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content, |
| 560 | MultiPictureDraw::kSimple_Layout);) |
| 561 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content, |
| 562 | MultiPictureDraw::kSimple_Layout);) |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 563 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 564 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kNoClipSingle_Content, |
| 565 | MultiPictureDraw::kTiled_Layout);) |
| 566 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRectClipMulti_Content, |
| 567 | MultiPictureDraw::kTiled_Layout);) |
| 568 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRRectClipMulti_Content, |
| 569 | MultiPictureDraw::kTiled_Layout);) |
| 570 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content, |
| 571 | MultiPictureDraw::kTiled_Layout);) |
| 572 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Content, |
| 573 | MultiPictureDraw::kTiled_Layout);) |
| 574 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content, |
| 575 | MultiPictureDraw::kTiled_Layout);) |
| 576 | DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content, |
| 577 | MultiPictureDraw::kTiled_Layout);) |
robertphillips | 7eacd77 | 2014-08-21 13:12:42 -0700 | [diff] [blame] | 578 | } |