OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 SkBitmap bitmap; | 367 SkBitmap bitmap; |
368 SkScalar x = SkIntToScalar(width / 2); | 368 SkScalar x = SkIntToScalar(width / 2); |
369 SkScalar y = SkIntToScalar(height / 2); | 369 SkScalar y = SkIntToScalar(height / 2); |
370 SkScalar radius = SkMinScalar(x, y) * 0.8f; | 370 SkScalar radius = SkMinScalar(x, y) * 0.8f; |
371 bitmap.allocN32Pixels(width, height); | 371 bitmap.allocN32Pixels(width, height); |
372 SkCanvas canvas(bitmap); | 372 SkCanvas canvas(bitmap); |
373 canvas.clear(0x00000000); | 373 canvas.clear(0x00000000); |
374 SkColor colors[2]; | 374 SkColor colors[2]; |
375 colors[0] = SK_ColorWHITE; | 375 colors[0] = SK_ColorWHITE; |
376 colors[1] = SK_ColorBLACK; | 376 colors[1] = SK_ColorBLACK; |
| 377 SkAutoTUnref<SkShader> shader( |
| 378 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, null
ptr, 2, |
| 379 SkShader::kClamp_TileMode) |
| 380 ); |
377 SkPaint paint; | 381 SkPaint paint; |
378 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius, co
lors, nullptr, 2, | 382 paint.setShader(shader); |
379 SkShader::kClamp_TileMode)); | |
380 canvas.drawCircle(x, y, radius, paint); | 383 canvas.drawCircle(x, y, radius, paint); |
381 return bitmap; | 384 return bitmap; |
382 } | 385 } |
383 | 386 |
384 | 387 |
385 | 388 |
386 static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy, | 389 static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy, |
387 skiatest::Reporter* reporter, | 390 skiatest::Reporter* reporter, |
388 GrContext* context) { | 391 GrContext* context) { |
389 // Check that SkBlurImageFilter will accept a negative sigma, either in | 392 // Check that SkBlurImageFilter will accept a negative sigma, either in |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 test_xfermode_cropped_input(&canvas, reporter); | 1485 test_xfermode_cropped_input(&canvas, reporter); |
1483 } | 1486 } |
1484 | 1487 |
1485 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { | 1488 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { |
1486 SkAutoTUnref<SkSurface> surface( | 1489 SkAutoTUnref<SkSurface> surface( |
1487 SkSurface::NewRenderTarget(context, SkBudgeted::kYes, | 1490 SkSurface::NewRenderTarget(context, SkBudgeted::kYes, |
1488 SkImageInfo::MakeN32Premul(100, 100))); | 1491 SkImageInfo::MakeN32Premul(100, 100))); |
1489 test_large_blur_input(reporter, surface->getCanvas()); | 1492 test_large_blur_input(reporter, surface->getCanvas()); |
1490 } | 1493 } |
1491 #endif | 1494 #endif |
OLD | NEW |