epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 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 | */ |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 7 | |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 8 | #include "SkBlurMask.h" |
reed@google.com | 2b75f42 | 2011-07-07 13:43:38 +0000 | [diff] [blame] | 9 | #include "SkBlurMaskFilter.h" |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 10 | #include "SkBlurDrawLooper.h" |
reed | fb8c1fc | 2015-08-04 18:44:56 -0700 | [diff] [blame] | 11 | #include "SkCanvas.h" |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 12 | #include "SkColorFilter.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 13 | #include "SkEmbossMaskFilter.h" |
| 14 | #include "SkLayerDrawLooper.h" |
tomhudson@google.com | 889bd8b | 2011-09-27 17:38:17 +0000 | [diff] [blame] | 15 | #include "SkMath.h" |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 16 | #include "SkPaint.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 17 | #include "SkPath.h" |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 18 | #include "Test.h" |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 19 | |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 20 | #if SK_SUPPORT_GPU |
| 21 | #include "GrContextFactory.h" |
| 22 | #include "SkGpuDevice.h" |
| 23 | #endif |
| 24 | |
| 25 | #define WRITE_CSV 0 |
reed@google.com | 2b75f42 | 2011-07-07 13:43:38 +0000 | [diff] [blame] | 26 | |
| 27 | /////////////////////////////////////////////////////////////////////////////// |
| 28 | |
| 29 | #define ILLEGAL_MODE ((SkXfermode::Mode)-1) |
| 30 | |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 31 | static const int outset = 100; |
| 32 | static const SkColor bgColor = SK_ColorWHITE; |
| 33 | static const int strokeWidth = 4; |
| 34 | |
commit-bot@chromium.org | fa9e5fa | 2014-02-13 22:00:04 +0000 | [diff] [blame] | 35 | static void create(SkBitmap* bm, const SkIRect& bound) { |
| 36 | bm->allocN32Pixels(bound.width(), bound.height()); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | static void drawBG(SkCanvas* canvas) { |
| 40 | canvas->drawColor(bgColor); |
| 41 | } |
| 42 | |
| 43 | |
| 44 | struct BlurTest { |
| 45 | void (*addPath)(SkPath*); |
| 46 | int viewLen; |
| 47 | SkIRect views[9]; |
| 48 | }; |
| 49 | |
| 50 | //Path Draw Procs |
| 51 | //Beware that paths themselves my draw differently depending on the clip. |
| 52 | static void draw50x50Rect(SkPath* path) { |
| 53 | path->addRect(0, 0, SkIntToScalar(50), SkIntToScalar(50)); |
| 54 | } |
| 55 | |
| 56 | //Tests |
| 57 | static BlurTest tests[] = { |
| 58 | { draw50x50Rect, 3, { |
| 59 | //inner half of blur |
| 60 | { 0, 0, 50, 50 }, |
| 61 | //blur, but no path. |
| 62 | { 50 + strokeWidth/2, 50 + strokeWidth/2, 100, 100 }, |
| 63 | //just an edge |
| 64 | { 40, strokeWidth, 60, 50 - strokeWidth }, |
| 65 | }}, |
| 66 | }; |
| 67 | |
| 68 | /** Assumes that the ref draw was completely inside ref canvas -- |
| 69 | implies that everything outside is "bgColor". |
| 70 | Checks that all overlap is the same and that all non-overlap on the |
| 71 | ref is "bgColor". |
| 72 | */ |
| 73 | static bool compare(const SkBitmap& ref, const SkIRect& iref, |
| 74 | const SkBitmap& test, const SkIRect& itest) |
| 75 | { |
| 76 | const int xOff = itest.fLeft - iref.fLeft; |
| 77 | const int yOff = itest.fTop - iref.fTop; |
| 78 | |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 79 | for (int y = 0; y < test.height(); ++y) { |
| 80 | for (int x = 0; x < test.width(); ++x) { |
| 81 | SkColor testColor = test.getColor(x, y); |
| 82 | int refX = x + xOff; |
| 83 | int refY = y + yOff; |
| 84 | SkColor refColor; |
| 85 | if (refX >= 0 && refX < ref.width() && |
| 86 | refY >= 0 && refY < ref.height()) |
| 87 | { |
| 88 | refColor = ref.getColor(refX, refY); |
| 89 | } else { |
| 90 | refColor = bgColor; |
| 91 | } |
| 92 | if (refColor != testColor) { |
| 93 | return false; |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | return true; |
| 98 | } |
| 99 | |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 100 | DEF_TEST(BlurDrawing, reporter) { |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 101 | SkPaint paint; |
| 102 | paint.setColor(SK_ColorGRAY); |
| 103 | paint.setStyle(SkPaint::kStroke_Style); |
| 104 | paint.setStrokeWidth(SkIntToScalar(strokeWidth)); |
reed@google.com | 2b75f42 | 2011-07-07 13:43:38 +0000 | [diff] [blame] | 105 | |
robertphillips@google.com | b706117 | 2013-09-06 14:16:12 +0000 | [diff] [blame] | 106 | SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)); |
commit-bot@chromium.org | e396455 | 2014-04-28 16:25:35 +0000 | [diff] [blame] | 107 | for (int style = 0; style <= kLastEnum_SkBlurStyle; ++style) { |
| 108 | SkBlurStyle blurStyle = static_cast<SkBlurStyle>(style); |
reed@google.com | 2b75f42 | 2011-07-07 13:43:38 +0000 | [diff] [blame] | 109 | |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 110 | const uint32_t flagPermutations = SkBlurMaskFilter::kAll_BlurFlag; |
| 111 | for (uint32_t flags = 0; flags < flagPermutations; ++flags) { |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 112 | paint.setMaskFilter(SkBlurMaskFilter::Make(blurStyle, sigma, flags)); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 113 | |
tomhudson@google.com | 83a4446 | 2011-10-27 15:27:51 +0000 | [diff] [blame] | 114 | for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) { |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 115 | SkPath path; |
| 116 | tests[test].addPath(&path); |
bungeman@google.com | d16872c | 2011-09-02 15:46:17 +0000 | [diff] [blame] | 117 | SkPath strokedPath; |
| 118 | paint.getFillPath(path, &strokedPath); |
| 119 | SkRect refBound = strokedPath.getBounds(); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 120 | SkIRect iref; |
| 121 | refBound.roundOut(&iref); |
bungeman@google.com | d16872c | 2011-09-02 15:46:17 +0000 | [diff] [blame] | 122 | iref.inset(-outset, -outset); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 123 | SkBitmap refBitmap; |
commit-bot@chromium.org | fa9e5fa | 2014-02-13 22:00:04 +0000 | [diff] [blame] | 124 | create(&refBitmap, iref); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 125 | |
| 126 | SkCanvas refCanvas(refBitmap); |
| 127 | refCanvas.translate(SkIntToScalar(-iref.fLeft), |
| 128 | SkIntToScalar(-iref.fTop)); |
| 129 | drawBG(&refCanvas); |
| 130 | refCanvas.drawPath(path, paint); |
| 131 | |
| 132 | for (int view = 0; view < tests[test].viewLen; ++view) { |
| 133 | SkIRect itest = tests[test].views[view]; |
| 134 | SkBitmap testBitmap; |
commit-bot@chromium.org | fa9e5fa | 2014-02-13 22:00:04 +0000 | [diff] [blame] | 135 | create(&testBitmap, itest); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 136 | |
| 137 | SkCanvas testCanvas(testBitmap); |
| 138 | testCanvas.translate(SkIntToScalar(-itest.fLeft), |
| 139 | SkIntToScalar(-itest.fTop)); |
| 140 | drawBG(&testCanvas); |
| 141 | testCanvas.drawPath(path, paint); |
| 142 | |
| 143 | REPORTER_ASSERT(reporter, |
| 144 | compare(refBitmap, iref, testBitmap, itest)); |
| 145 | } |
| 146 | } |
| 147 | } |
reed@google.com | 2b75f42 | 2011-07-07 13:43:38 +0000 | [diff] [blame] | 148 | } |
| 149 | } |
| 150 | |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 151 | /////////////////////////////////////////////////////////////////////////////// |
| 152 | |
| 153 | // Use SkBlurMask::BlurGroundTruth to blur a 'width' x 'height' solid |
| 154 | // white rect. Return the right half of the middle row in 'result'. |
skia.committer@gmail.com | 6fc1b49 | 2013-09-06 07:01:45 +0000 | [diff] [blame] | 155 | static void ground_truth_2d(int width, int height, |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 156 | SkScalar sigma, |
| 157 | int* result, int resultCount) { |
| 158 | SkMask src, dst; |
| 159 | |
| 160 | src.fBounds.set(0, 0, width, height); |
| 161 | src.fFormat = SkMask::kA8_Format; |
| 162 | src.fRowBytes = src.fBounds.width(); |
| 163 | src.fImage = SkMask::AllocImage(src.computeTotalImageSize()); |
| 164 | |
| 165 | memset(src.fImage, 0xff, src.computeTotalImageSize()); |
| 166 | |
robertphillips | e80eb92 | 2015-12-17 11:33:12 -0800 | [diff] [blame] | 167 | if (!SkBlurMask::BlurGroundTruth(sigma, &dst, src, kNormal_SkBlurStyle)) { |
| 168 | return; |
| 169 | } |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 170 | |
| 171 | int midX = dst.fBounds.centerX(); |
| 172 | int midY = dst.fBounds.centerY(); |
| 173 | uint8_t* bytes = dst.getAddr8(midX, midY); |
| 174 | int i; |
| 175 | for (i = 0; i < dst.fBounds.width()-(midX-dst.fBounds.fLeft); ++i) { |
| 176 | if (i < resultCount) { |
| 177 | result[i] = bytes[i]; |
| 178 | } |
| 179 | } |
| 180 | for ( ; i < resultCount; ++i) { |
| 181 | result[i] = 0; |
| 182 | } |
robertphillips@google.com | 6d837aa | 2013-10-11 14:38:46 +0000 | [diff] [blame] | 183 | |
| 184 | SkMask::FreeImage(src.fImage); |
| 185 | SkMask::FreeImage(dst.fImage); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | // Implement a step function that is 255 between min and max; 0 elsewhere. |
| 189 | static int step(int x, SkScalar min, SkScalar max) { |
| 190 | if (min < x && x < max) { |
| 191 | return 255; |
| 192 | } |
| 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | // Implement a Gaussian function with 0 mean and std.dev. of 'sigma'. |
| 197 | static float gaussian(int x, SkScalar sigma) { |
robertphillips@google.com | b85564a | 2013-09-05 17:53:34 +0000 | [diff] [blame] | 198 | float k = SK_Scalar1/(sigma * sqrtf(2.0f*SK_ScalarPI)); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 199 | float exponent = -(x * x) / (2 * sigma * sigma); |
robertphillips@google.com | b85564a | 2013-09-05 17:53:34 +0000 | [diff] [blame] | 200 | return k * expf(exponent); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | // Perform a brute force convolution of a step function with a Gaussian. |
| 204 | // Return the right half in 'result' |
skia.committer@gmail.com | 6fc1b49 | 2013-09-06 07:01:45 +0000 | [diff] [blame] | 205 | static void brute_force_1d(SkScalar stepMin, SkScalar stepMax, |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 206 | SkScalar gaussianSigma, |
| 207 | int* result, int resultCount) { |
| 208 | |
| 209 | int gaussianRange = SkScalarCeilToInt(10 * gaussianSigma); |
| 210 | |
| 211 | for (int i = 0; i < resultCount; ++i) { |
| 212 | SkScalar sum = 0.0f; |
| 213 | for (int j = -gaussianRange; j < gaussianRange; ++j) { |
| 214 | sum += gaussian(j, gaussianSigma) * step(i-j, stepMin, stepMax); |
| 215 | } |
| 216 | |
| 217 | result[i] = SkClampMax(SkClampPos(int(sum + 0.5f)), 255); |
| 218 | } |
| 219 | } |
| 220 | |
skia.committer@gmail.com | 6fc1b49 | 2013-09-06 07:01:45 +0000 | [diff] [blame] | 221 | static void blur_path(SkCanvas* canvas, const SkPath& path, |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 222 | SkScalar gaussianSigma) { |
| 223 | |
| 224 | SkScalar midX = path.getBounds().centerX(); |
| 225 | SkScalar midY = path.getBounds().centerY(); |
| 226 | |
| 227 | canvas->translate(-midX, -midY); |
| 228 | |
| 229 | SkPaint blurPaint; |
| 230 | blurPaint.setColor(SK_ColorWHITE); |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 231 | blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, gaussianSigma, |
| 232 | SkBlurMaskFilter::kHighQuality_BlurFlag)); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 233 | |
| 234 | canvas->drawColor(SK_ColorBLACK); |
| 235 | canvas->drawPath(path, blurPaint); |
| 236 | } |
| 237 | |
| 238 | // Readback the blurred draw results from the canvas |
Mike Reed | f194219 | 2017-07-21 14:24:29 -0400 | [diff] [blame] | 239 | static void readback(const SkBitmap& src, int* result, int resultCount) { |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 240 | SkBitmap readback; |
commit-bot@chromium.org | fa9e5fa | 2014-02-13 22:00:04 +0000 | [diff] [blame] | 241 | readback.allocN32Pixels(resultCount, 30); |
Mike Reed | f194219 | 2017-07-21 14:24:29 -0400 | [diff] [blame] | 242 | SkPixmap pm; |
| 243 | readback.peekPixels(&pm); |
| 244 | src.readPixels(pm, 0, 0); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 245 | |
Mike Reed | f194219 | 2017-07-21 14:24:29 -0400 | [diff] [blame] | 246 | const SkPMColor* pixels = pm.addr32(0, 15); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 247 | |
| 248 | for (int i = 0; i < resultCount; ++i) { |
| 249 | result[i] = SkColorGetR(pixels[i]); |
| 250 | } |
| 251 | } |
| 252 | |
skia.committer@gmail.com | 6fc1b49 | 2013-09-06 07:01:45 +0000 | [diff] [blame] | 253 | // Draw a blurred version of the provided path. |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 254 | // Return the right half of the middle row in 'result'. |
| 255 | static void cpu_blur_path(const SkPath& path, SkScalar gaussianSigma, |
| 256 | int* result, int resultCount) { |
| 257 | |
| 258 | SkBitmap bitmap; |
commit-bot@chromium.org | fa9e5fa | 2014-02-13 22:00:04 +0000 | [diff] [blame] | 259 | bitmap.allocN32Pixels(resultCount, 30); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 260 | SkCanvas canvas(bitmap); |
| 261 | |
| 262 | blur_path(&canvas, path, gaussianSigma); |
Mike Reed | f194219 | 2017-07-21 14:24:29 -0400 | [diff] [blame] | 263 | readback(bitmap, result, resultCount); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 264 | } |
| 265 | |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 266 | #if WRITE_CSV |
| 267 | static void write_as_csv(const char* label, SkScalar scale, int* data, int count) { |
| 268 | SkDebugf("%s_%.2f,", label, scale); |
| 269 | for (int i = 0; i < count-1; ++i) { |
| 270 | SkDebugf("%d,", data[i]); |
| 271 | } |
| 272 | SkDebugf("%d\n", data[count-1]); |
| 273 | } |
| 274 | #endif |
| 275 | |
| 276 | static bool match(int* first, int* second, int count, int tol) { |
| 277 | int delta; |
| 278 | for (int i = 0; i < count; ++i) { |
| 279 | delta = first[i] - second[i]; |
| 280 | if (delta > tol || delta < -tol) { |
| 281 | return false; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | return true; |
| 286 | } |
| 287 | |
| 288 | // Test out the normal blur style with a wide range of sigmas |
bsalomon | f2f1c17 | 2016-04-05 12:59:06 -0700 | [diff] [blame] | 289 | DEF_TEST(BlurSigmaRange, reporter) { |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 290 | static const int kSize = 100; |
| 291 | |
| 292 | // The geometry is offset a smidge to trigger: |
| 293 | // https://code.google.com/p/chromium/issues/detail?id=282418 |
| 294 | SkPath rectPath; |
| 295 | rectPath.addRect(0.3f, 0.3f, 100.3f, 100.3f); |
| 296 | |
| 297 | SkPoint polyPts[] = { |
| 298 | { 0.3f, 0.3f }, |
| 299 | { 100.3f, 0.3f }, |
| 300 | { 100.3f, 100.3f }, |
| 301 | { 0.3f, 100.3f }, |
| 302 | { 2.3f, 50.3f } // a little divet to throw off the rect special case |
| 303 | }; |
| 304 | SkPath polyPath; |
| 305 | polyPath.addPoly(polyPts, SK_ARRAY_COUNT(polyPts), true); |
| 306 | |
| 307 | int rectSpecialCaseResult[kSize]; |
| 308 | int generalCaseResult[kSize]; |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 309 | int groundTruthResult[kSize]; |
| 310 | int bruteForce1DResult[kSize]; |
| 311 | |
commit-bot@chromium.org | 4b413c8 | 2013-11-25 19:44:07 +0000 | [diff] [blame] | 312 | SkScalar sigma = 10.0f; |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 313 | |
| 314 | for (int i = 0; i < 4; ++i, sigma /= 10) { |
| 315 | |
| 316 | cpu_blur_path(rectPath, sigma, rectSpecialCaseResult, kSize); |
| 317 | cpu_blur_path(polyPath, sigma, generalCaseResult, kSize); |
humper | 4a24cd8 | 2014-06-17 13:39:29 -0700 | [diff] [blame] | 318 | |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 319 | ground_truth_2d(100, 100, sigma, groundTruthResult, kSize); |
| 320 | brute_force_1d(-50.0f, 50.0f, sigma, bruteForce1DResult, kSize); |
| 321 | |
| 322 | REPORTER_ASSERT(reporter, match(rectSpecialCaseResult, bruteForce1DResult, kSize, 5)); |
| 323 | REPORTER_ASSERT(reporter, match(generalCaseResult, bruteForce1DResult, kSize, 15)); |
robertphillips@google.com | 3dfa4cc | 2013-09-05 16:39:03 +0000 | [diff] [blame] | 324 | REPORTER_ASSERT(reporter, match(groundTruthResult, bruteForce1DResult, kSize, 1)); |
| 325 | |
| 326 | #if WRITE_CSV |
| 327 | write_as_csv("RectSpecialCase", sigma, rectSpecialCaseResult, kSize); |
| 328 | write_as_csv("GeneralCase", sigma, generalCaseResult, kSize); |
| 329 | #if SK_SUPPORT_GPU |
| 330 | write_as_csv("GPU", sigma, gpuResult, kSize); |
| 331 | #endif |
| 332 | write_as_csv("GroundTruth2D", sigma, groundTruthResult, kSize); |
| 333 | write_as_csv("BruteForce1D", sigma, bruteForce1DResult, kSize); |
| 334 | #endif |
| 335 | } |
| 336 | } |
| 337 | |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 338 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 339 | |
| 340 | static SkBlurQuality blurMaskFilterFlags_as_quality(uint32_t blurMaskFilterFlags) { |
| 341 | return (blurMaskFilterFlags & SkBlurMaskFilter::kHighQuality_BlurFlag) ? |
| 342 | kHigh_SkBlurQuality : kLow_SkBlurQuality; |
| 343 | } |
| 344 | |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 345 | static void test_blurDrawLooper(skiatest::Reporter* reporter, SkScalar sigma, |
| 346 | SkBlurStyle style, uint32_t blurMaskFilterFlags) { |
| 347 | if (kNormal_SkBlurStyle != style) { |
| 348 | return; // blurdrawlooper only supports normal |
| 349 | } |
| 350 | |
| 351 | const SkColor color = 0xFF335577; |
| 352 | const SkScalar dx = 10; |
| 353 | const SkScalar dy = -5; |
Matt Sarett | f160ad4 | 2017-03-23 16:23:38 -0400 | [diff] [blame] | 354 | sk_sp<SkDrawLooper> lp(SkBlurDrawLooper::Make(color, sigma, dx, dy)); |
| 355 | const bool expectSuccess = sigma > 0; |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 356 | |
reed | 7b380d0 | 2016-03-21 13:25:16 -0700 | [diff] [blame] | 357 | if (nullptr == lp) { |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 358 | REPORTER_ASSERT(reporter, sigma <= 0); |
| 359 | } else { |
| 360 | SkDrawLooper::BlurShadowRec rec; |
| 361 | bool success = lp->asABlurShadow(&rec); |
| 362 | REPORTER_ASSERT(reporter, success == expectSuccess); |
| 363 | if (success) { |
| 364 | REPORTER_ASSERT(reporter, rec.fSigma == sigma); |
| 365 | REPORTER_ASSERT(reporter, rec.fOffset.x() == dx); |
| 366 | REPORTER_ASSERT(reporter, rec.fOffset.y() == dy); |
| 367 | REPORTER_ASSERT(reporter, rec.fColor == color); |
| 368 | REPORTER_ASSERT(reporter, rec.fStyle == style); |
Matt Sarett | f160ad4 | 2017-03-23 16:23:38 -0400 | [diff] [blame] | 369 | REPORTER_ASSERT(reporter, rec.fQuality == kLow_SkBlurQuality); |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 370 | } |
| 371 | } |
| 372 | } |
| 373 | |
reed | 7b380d0 | 2016-03-21 13:25:16 -0700 | [diff] [blame] | 374 | static void test_looper(skiatest::Reporter* reporter, sk_sp<SkDrawLooper> lp, SkScalar sigma, |
| 375 | SkBlurStyle style, SkBlurQuality quality, bool expectSuccess) { |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 376 | SkDrawLooper::BlurShadowRec rec; |
| 377 | bool success = lp->asABlurShadow(&rec); |
| 378 | REPORTER_ASSERT(reporter, success == expectSuccess); |
| 379 | if (success != expectSuccess) { |
| 380 | lp->asABlurShadow(&rec); |
| 381 | } |
| 382 | if (success) { |
| 383 | REPORTER_ASSERT(reporter, rec.fSigma == sigma); |
| 384 | REPORTER_ASSERT(reporter, rec.fStyle == style); |
| 385 | REPORTER_ASSERT(reporter, rec.fQuality == quality); |
| 386 | } |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | static void make_noop_layer(SkLayerDrawLooper::Builder* builder) { |
| 390 | SkLayerDrawLooper::LayerInfo info; |
| 391 | |
| 392 | info.fPaintBits = 0; |
Mike Reed | faba371 | 2016-11-03 14:45:31 -0400 | [diff] [blame] | 393 | info.fColorMode = SkBlendMode::kDst; |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 394 | builder->addLayer(info); |
| 395 | } |
| 396 | |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 397 | static void make_blur_layer(SkLayerDrawLooper::Builder* builder, sk_sp<SkMaskFilter> mf) { |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 398 | SkLayerDrawLooper::LayerInfo info; |
| 399 | |
| 400 | info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit; |
Mike Reed | faba371 | 2016-11-03 14:45:31 -0400 | [diff] [blame] | 401 | info.fColorMode = SkBlendMode::kSrc; |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 402 | SkPaint* paint = builder->addLayer(info); |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 403 | paint->setMaskFilter(std::move(mf)); |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 404 | } |
| 405 | |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 406 | static void test_layerDrawLooper(skiatest::Reporter* reporter, sk_sp<SkMaskFilter> mf, |
| 407 | SkScalar sigma, SkBlurStyle style, SkBlurQuality quality, |
| 408 | bool expectSuccess) { |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 409 | |
| 410 | SkLayerDrawLooper::LayerInfo info; |
| 411 | SkLayerDrawLooper::Builder builder; |
| 412 | |
| 413 | // 1 layer is too few |
| 414 | make_noop_layer(&builder); |
reed | 7b380d0 | 2016-03-21 13:25:16 -0700 | [diff] [blame] | 415 | test_looper(reporter, builder.detach(), sigma, style, quality, false); |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 416 | |
| 417 | // 2 layers is good, but need blur |
| 418 | make_noop_layer(&builder); |
| 419 | make_noop_layer(&builder); |
reed | 7b380d0 | 2016-03-21 13:25:16 -0700 | [diff] [blame] | 420 | test_looper(reporter, builder.detach(), sigma, style, quality, false); |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 421 | |
| 422 | // 2 layers is just right |
| 423 | make_noop_layer(&builder); |
| 424 | make_blur_layer(&builder, mf); |
reed | 7b380d0 | 2016-03-21 13:25:16 -0700 | [diff] [blame] | 425 | test_looper(reporter, builder.detach(), sigma, style, quality, expectSuccess); |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 426 | |
| 427 | // 3 layers is too many |
| 428 | make_noop_layer(&builder); |
| 429 | make_blur_layer(&builder, mf); |
| 430 | make_noop_layer(&builder); |
reed | 7b380d0 | 2016-03-21 13:25:16 -0700 | [diff] [blame] | 431 | test_looper(reporter, builder.detach(), sigma, style, quality, false); |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 432 | } |
| 433 | |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 434 | DEF_TEST(BlurAsABlur, reporter) { |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 435 | const SkBlurStyle styles[] = { |
| 436 | kNormal_SkBlurStyle, kSolid_SkBlurStyle, kOuter_SkBlurStyle, kInner_SkBlurStyle |
| 437 | }; |
| 438 | const SkScalar sigmas[] = { |
| 439 | // values <= 0 should not success for a blur |
| 440 | -1, 0, 0.5f, 2 |
| 441 | }; |
| 442 | |
| 443 | // Test asABlur for SkBlurMaskFilter |
| 444 | // |
| 445 | for (size_t i = 0; i < SK_ARRAY_COUNT(styles); ++i) { |
Robert Phillips | 98624d2 | 2016-12-19 11:37:37 -0500 | [diff] [blame] | 446 | const SkBlurStyle style = styles[i]; |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 447 | for (size_t j = 0; j < SK_ARRAY_COUNT(sigmas); ++j) { |
| 448 | const SkScalar sigma = sigmas[j]; |
| 449 | for (int flags = 0; flags <= SkBlurMaskFilter::kAll_BlurFlag; ++flags) { |
| 450 | const SkBlurQuality quality = blurMaskFilterFlags_as_quality(flags); |
| 451 | |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 452 | sk_sp<SkMaskFilter> mf(SkBlurMaskFilter::Make(style, sigma, flags)); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 453 | if (nullptr == mf.get()) { |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 454 | REPORTER_ASSERT(reporter, sigma <= 0); |
| 455 | } else { |
| 456 | REPORTER_ASSERT(reporter, sigma > 0); |
| 457 | SkMaskFilter::BlurRec rec; |
| 458 | bool success = mf->asABlur(&rec); |
| 459 | if (flags & SkBlurMaskFilter::kIgnoreTransform_BlurFlag) { |
| 460 | REPORTER_ASSERT(reporter, !success); |
| 461 | } else { |
| 462 | REPORTER_ASSERT(reporter, success); |
| 463 | REPORTER_ASSERT(reporter, rec.fSigma == sigma); |
| 464 | REPORTER_ASSERT(reporter, rec.fStyle == style); |
| 465 | REPORTER_ASSERT(reporter, rec.fQuality == quality); |
| 466 | } |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 467 | test_layerDrawLooper(reporter, std::move(mf), sigma, style, quality, success); |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 468 | } |
| 469 | test_blurDrawLooper(reporter, sigma, style, flags); |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | // Test asABlur for SkEmbossMaskFilter -- should never succeed |
| 475 | // |
| 476 | { |
| 477 | SkEmbossMaskFilter::Light light = { |
| 478 | { 1, 1, 1 }, 0, 127, 127 |
| 479 | }; |
| 480 | for (size_t j = 0; j < SK_ARRAY_COUNT(sigmas); ++j) { |
| 481 | const SkScalar sigma = sigmas[j]; |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 482 | auto mf(SkEmbossMaskFilter::Make(sigma, light)); |
| 483 | if (mf) { |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 484 | SkMaskFilter::BlurRec rec; |
| 485 | bool success = mf->asABlur(&rec); |
| 486 | REPORTER_ASSERT(reporter, !success); |
| 487 | } |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | |
robertphillips | 4abb0c1 | 2016-01-04 11:20:25 -0800 | [diff] [blame] | 492 | #if SK_SUPPORT_GPU |
| 493 | |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 494 | // This exercises the problem discovered in crbug.com/570232. The return value from |
robertphillips | 4abb0c1 | 2016-01-04 11:20:25 -0800 | [diff] [blame] | 495 | // SkBlurMask::BoxBlur wasn't being checked in SkBlurMaskFilter.cpp::GrRRectBlurEffect::Create |
egdaniel | ab527a5 | 2016-06-28 08:07:26 -0700 | [diff] [blame] | 496 | DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) { |
robertphillips | 4abb0c1 | 2016-01-04 11:20:25 -0800 | [diff] [blame] | 497 | |
| 498 | SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128); |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 499 | auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info)); |
robertphillips | 4abb0c1 | 2016-01-04 11:20:25 -0800 | [diff] [blame] | 500 | SkCanvas* canvas = surface->getCanvas(); |
| 501 | |
| 502 | SkRect r = SkRect::MakeXYWH(10, 10, 100, 100); |
| 503 | SkRRect rr = SkRRect::MakeRectXY(r, 10, 10); |
| 504 | |
| 505 | SkPaint p; |
reed | efdfd51 | 2016-04-04 10:02:58 -0700 | [diff] [blame] | 506 | p.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 0.01f)); |
robertphillips | 4abb0c1 | 2016-01-04 11:20:25 -0800 | [diff] [blame] | 507 | |
| 508 | canvas->drawRRect(rr, p); |
| 509 | } |
| 510 | |
| 511 | #endif |
| 512 | |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 513 | |
| 514 | DEF_TEST(BlurredRRectNinePatchComputation, reporter) { |
| 515 | const SkRect r = SkRect::MakeXYWH(10, 10, 100, 100); |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 516 | static const SkScalar kBlurRad = 3.0f; |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 517 | |
| 518 | bool ninePatchable; |
| 519 | SkRRect rrectToDraw; |
| 520 | SkISize size; |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 521 | SkScalar rectXs[SkBlurMaskFilter::kMaxDivisions], rectYs[SkBlurMaskFilter::kMaxDivisions]; |
| 522 | SkScalar texXs[SkBlurMaskFilter::kMaxDivisions], texYs[SkBlurMaskFilter::kMaxDivisions]; |
| 523 | int numX, numY; |
| 524 | uint32_t skipMask; |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 525 | |
| 526 | // not nine-patchable |
| 527 | { |
| 528 | SkVector radii[4] = { { 100, 100 }, { 0, 0 }, { 100, 100 }, { 0, 0 } }; |
| 529 | |
| 530 | SkRRect rr; |
| 531 | rr.setRectRadii(r, radii); |
| 532 | |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 533 | ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(rr, rr, SkRect::MakeEmpty(), |
| 534 | kBlurRad, kBlurRad, |
| 535 | &rrectToDraw, &size, |
| 536 | rectXs, rectYs, texXs, texYs, |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 537 | &numX, &numY, &skipMask); |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 538 | REPORTER_ASSERT(reporter, !ninePatchable); |
| 539 | } |
| 540 | |
| 541 | // simple circular |
| 542 | { |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 543 | static const SkScalar kCornerRad = 10.0f; |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 544 | SkRRect rr; |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 545 | rr.setRectXY(r, kCornerRad, kCornerRad); |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 546 | |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 547 | ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(rr, rr, SkRect::MakeEmpty(), |
| 548 | kBlurRad, kBlurRad, |
| 549 | &rrectToDraw, &size, |
| 550 | rectXs, rectYs, texXs, texYs, |
| 551 | &numX, &numY, &skipMask); |
| 552 | |
| 553 | static const SkScalar kAns = 12.0f * kBlurRad + 2.0f * kCornerRad + 1.0f; |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 554 | REPORTER_ASSERT(reporter, ninePatchable); |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 555 | REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fWidth), kAns)); |
| 556 | REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fHeight), kAns)); |
| 557 | REPORTER_ASSERT(reporter, 4 == numX && 4 == numY); |
| 558 | REPORTER_ASSERT(reporter, !skipMask); |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 559 | } |
| 560 | |
| 561 | // simple elliptical |
| 562 | { |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 563 | static const SkScalar kXCornerRad = 2.0f; |
| 564 | static const SkScalar kYCornerRad = 10.0f; |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 565 | SkRRect rr; |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 566 | rr.setRectXY(r, kXCornerRad, kYCornerRad); |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 567 | |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 568 | ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(rr, rr, SkRect::MakeEmpty(), |
| 569 | kBlurRad, kBlurRad, |
| 570 | &rrectToDraw, &size, |
| 571 | rectXs, rectYs, texXs, texYs, |
| 572 | &numX, &numY, &skipMask); |
| 573 | |
| 574 | static const SkScalar kXAns = 12.0f * kBlurRad + 2.0f * kXCornerRad + 1.0f; |
| 575 | static const SkScalar kYAns = 12.0f * kBlurRad + 2.0f * kYCornerRad + 1.0f; |
| 576 | |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 577 | REPORTER_ASSERT(reporter, ninePatchable); |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 578 | REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fWidth), kXAns)); |
| 579 | REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fHeight), kYAns)); |
| 580 | REPORTER_ASSERT(reporter, 4 == numX && 4 == numY); |
| 581 | REPORTER_ASSERT(reporter, !skipMask); |
| 582 | } |
| 583 | |
| 584 | // test-out occlusion |
| 585 | { |
| 586 | static const SkScalar kCornerRad = 10.0f; |
| 587 | SkRRect rr; |
| 588 | rr.setRectXY(r, kCornerRad, kCornerRad); |
| 589 | |
| 590 | // The rectXs & rectYs should be { 1, 29, 91, 119 }. Add two more points around each. |
| 591 | SkScalar testLocs[] = { |
| 592 | -18.0f, -9.0f, |
| 593 | 1.0f, |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 594 | 9.0f, 18.0f, |
| 595 | 29.0f, |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 596 | 39.0f, 49.0f, |
| 597 | 91.0f, |
| 598 | 109.0f, 118.0f, |
| 599 | 119.0f, |
| 600 | 139.0f, 149.0f |
| 601 | }; |
| 602 | |
| 603 | for (int minY = 0; minY < (int)SK_ARRAY_COUNT(testLocs); ++minY) { |
| 604 | for (int maxY = minY+1; maxY < (int)SK_ARRAY_COUNT(testLocs); ++maxY) { |
| 605 | for (int minX = 0; minX < (int)SK_ARRAY_COUNT(testLocs); ++minX) { |
| 606 | for (int maxX = minX+1; maxX < (int)SK_ARRAY_COUNT(testLocs); ++maxX) { |
| 607 | SkRect occluder = SkRect::MakeLTRB(testLocs[minX], testLocs[minY], |
| 608 | testLocs[maxX], testLocs[maxY]); |
| 609 | if (occluder.isEmpty()) { |
| 610 | continue; |
| 611 | } |
| 612 | |
| 613 | ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams( |
| 614 | rr, rr, occluder, |
| 615 | kBlurRad, kBlurRad, |
| 616 | &rrectToDraw, &size, |
| 617 | rectXs, rectYs, texXs, texYs, |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 618 | &numX, &numY, &skipMask); |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 619 | |
| 620 | static const SkScalar kAns = 12.0f * kBlurRad + 2.0f * kCornerRad + 1.0f; |
| 621 | REPORTER_ASSERT(reporter, ninePatchable); |
| 622 | REPORTER_ASSERT(reporter, |
| 623 | SkScalarNearlyEqual(SkIntToScalar(size.fWidth), kAns)); |
| 624 | REPORTER_ASSERT(reporter, |
| 625 | SkScalarNearlyEqual(SkIntToScalar(size.fHeight), kAns)); |
| 626 | |
| 627 | int checkBit = 0x1; |
| 628 | for (int y = 0; y < numY-1; ++y) { |
| 629 | for (int x = 0; x < numX-1; ++x) { |
| 630 | SkRect cell = SkRect::MakeLTRB(rectXs[x], rectYs[y], |
| 631 | rectXs[x+1], rectYs[y+1]); |
| 632 | REPORTER_ASSERT(reporter, |
| 633 | SkToBool(skipMask & checkBit) == |
| 634 | (cell.isEmpty() || occluder.contains(cell))); |
| 635 | |
| 636 | REPORTER_ASSERT(reporter, texXs[x] >= 0 && |
| 637 | texXs[x] <= size.fWidth); |
| 638 | REPORTER_ASSERT(reporter, texYs[y] >= 0 && |
| 639 | texXs[y] <= size.fHeight); |
| 640 | |
| 641 | checkBit <<= 1; |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | } |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 647 | } |
robertphillips | c4d2f90 | 2016-08-16 09:30:03 -0700 | [diff] [blame] | 648 | |
| 649 | |
robertphillips | f5a83e8 | 2016-08-10 12:00:09 -0700 | [diff] [blame] | 650 | } |
| 651 | |
| 652 | } |
| 653 | |
reed@google.com | daaafa6 | 2014-04-29 15:20:16 +0000 | [diff] [blame] | 654 | /////////////////////////////////////////////////////////////////////////////////////////// |