Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkBitmapDevice.h" | 9 #include "SkBitmapDevice.h" |
| 10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 ); | 347 ); |
| 348 SkPaint paint; | 348 SkPaint paint; |
| 349 paint.setShader(shader); | 349 paint.setShader(shader); |
| 350 canvas.drawCircle(x, y, radius, paint); | 350 canvas.drawCircle(x, y, radius, paint); |
| 351 return bitmap; | 351 return bitmap; |
| 352 } | 352 } |
| 353 | 353 |
| 354 static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy, skiatest::Repo rter* reporter) { | 354 static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy, skiatest::Repo rter* reporter) { |
| 355 // Check that SkBlurImageFilter will accept a negative sigma, either in | 355 // Check that SkBlurImageFilter will accept a negative sigma, either in |
| 356 // the given arguments or after CTM application. | 356 // the given arguments or after CTM application. |
| 357 int width = 32, height = 32; | 357 int width = 32, height = 32; |
|
robertphillips
2015/10/06 11:43:12
I feel this variable should, at the very least, be
reed1
2015/10/06 16:59:24
Done.
| |
| 358 SkScalar five = SkIntToScalar(5); | 358 SkScalar five = SkIntToScalar(5); |
| 359 | 359 |
| 360 SkAutoTUnref<SkBlurImageFilter> positiveFilter( | 360 SkAutoTUnref<SkImageFilter> positiveFilter(SkBlurImageFilter::Create(five, f ive)); |
| 361 SkBlurImageFilter::Create(five, five) | 361 SkAutoTUnref<SkImageFilter> negativeFilter(SkBlurImageFilter::Create(-five, five)); |
| 362 ); | |
| 363 | |
| 364 SkAutoTUnref<SkBlurImageFilter> negativeFilter( | |
| 365 SkBlurImageFilter::Create(-five, five) | |
| 366 ); | |
| 367 | 362 |
| 368 SkBitmap gradient = make_gradient_circle(width, height); | 363 SkBitmap gradient = make_gradient_circle(width, height); |
| 369 SkBitmap positiveResult1, negativeResult1; | 364 SkBitmap positiveResult1, negativeResult1; |
| 370 SkBitmap positiveResult2, negativeResult2; | 365 SkBitmap positiveResult2, negativeResult2; |
| 371 SkIPoint offset; | 366 SkIPoint offset; |
| 372 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr); | 367 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr); |
| 373 positiveFilter->filterImage(proxy, gradient, ctx, &positiveResult1, &offset) ; | 368 positiveFilter->filterImage(proxy, gradient, ctx, &positiveResult1, &offset) ; |
| 374 negativeFilter->filterImage(proxy, gradient, ctx, &negativeResult1, &offset) ; | 369 negativeFilter->filterImage(proxy, gradient, ctx, &negativeResult1, &offset) ; |
| 375 SkMatrix negativeScale; | 370 SkMatrix negativeScale; |
| 376 negativeScale.setScale(-SK_Scalar1, SK_Scalar1); | 371 negativeScale.setScale(-SK_Scalar1, SK_Scalar1); |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1309 SkSurface::kNo_Budgeted , | 1304 SkSurface::kNo_Budgeted , |
| 1310 SkImageInfo::MakeN32Pre mul(1, 1), | 1305 SkImageInfo::MakeN32Pre mul(1, 1), |
| 1311 0, | 1306 0, |
| 1312 &props, | 1307 &props, |
| 1313 SkGpuDevice::kUninit_In itContents)); | 1308 SkGpuDevice::kUninit_In itContents)); |
| 1314 SkImageFilter::Proxy proxy(device); | 1309 SkImageFilter::Proxy proxy(device); |
| 1315 | 1310 |
| 1316 test_negative_blur_sigma(&proxy, reporter); | 1311 test_negative_blur_sigma(&proxy, reporter); |
| 1317 } | 1312 } |
| 1318 #endif | 1313 #endif |
| OLD | NEW |