Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1789633002: more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 );
381 SkPaint paint; 377 SkPaint paint;
382 paint.setShader(shader); 378 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius, co lors, nullptr, 2,
379 SkShader::kClamp_TileMode));
383 canvas.drawCircle(x, y, radius, paint); 380 canvas.drawCircle(x, y, radius, paint);
384 return bitmap; 381 return bitmap;
385 } 382 }
386 383
387 384
388 385
389 static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy, 386 static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy,
390 skiatest::Reporter* reporter, 387 skiatest::Reporter* reporter,
391 GrContext* context) { 388 GrContext* context) {
392 // Check that SkBlurImageFilter will accept a negative sigma, either in 389 // Check that SkBlurImageFilter will accept a negative sigma, either in
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 test_xfermode_cropped_input(&canvas, reporter); 1482 test_xfermode_cropped_input(&canvas, reporter);
1486 } 1483 }
1487 1484
1488 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { 1485 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) {
1489 SkAutoTUnref<SkSurface> surface( 1486 SkAutoTUnref<SkSurface> surface(
1490 SkSurface::NewRenderTarget(context, SkBudgeted::kYes, 1487 SkSurface::NewRenderTarget(context, SkBudgeted::kYes,
1491 SkImageInfo::MakeN32Premul(100, 100))); 1488 SkImageInfo::MakeN32Premul(100, 100)));
1492 test_large_blur_input(reporter, surface->getCanvas()); 1489 test_large_blur_input(reporter, surface->getCanvas());
1493 } 1490 }
1494 #endif 1491 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698