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 "SkBitmapSource.h" | 10 #include "SkBitmapSource.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 SkPaint greenPaint; | 436 SkPaint greenPaint; |
437 greenPaint.setColor(SK_ColorGREEN); | 437 greenPaint.setColor(SK_ColorGREEN); |
438 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 30, 20)), g
reenPaint); | 438 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 30, 20)), g
reenPaint); |
439 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 439 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
440 SkAutoTUnref<SkImageFilter> pictureFilter(SkPictureImageFilter::Create(pictu
re.get())); | 440 SkAutoTUnref<SkImageFilter> pictureFilter(SkPictureImageFilter::Create(pictu
re.get())); |
441 SkAutoTUnref<SkShader> shader(SkPerlinNoiseShader::CreateTurbulence(SK_Scala
r1, SK_Scalar1, 1, 0)); | 441 SkAutoTUnref<SkShader> shader(SkPerlinNoiseShader::CreateTurbulence(SK_Scala
r1, SK_Scalar1, 1, 0)); |
442 | 442 |
443 SkAutoTUnref<SkImageFilter> rectShaderFilter(SkRectShaderImageFilter::Create
(shader.get())); | 443 SkAutoTUnref<SkImageFilter> rectShaderFilter(SkRectShaderImageFilter::Create
(shader.get())); |
444 | 444 |
| 445 SkAutoTUnref<SkShader> greenColorShader(SkShader::CreateColorShader(SK_Color
GREEN)); |
| 446 SkImageFilter::CropRect leftSideCropRect(SkRect::MakeXYWH(0, 0, 32, 64)); |
| 447 SkAutoTUnref<SkImageFilter> rectShaderFilterLeft(SkRectShaderImageFilter::Cr
eate(greenColorShader.get(), &leftSideCropRect)); |
| 448 SkImageFilter::CropRect rightSideCropRect(SkRect::MakeXYWH(32, 0, 32, 64)); |
| 449 SkAutoTUnref<SkImageFilter> rectShaderFilterRight(SkRectShaderImageFilter::C
reate(greenColorShader.get(), &rightSideCropRect)); |
| 450 |
445 struct { | 451 struct { |
446 const char* fName; | 452 const char* fName; |
447 SkImageFilter* fFilter; | 453 SkImageFilter* fFilter; |
448 } filters[] = { | 454 } filters[] = { |
449 { "color filter", SkColorFilterImageFilter::Create(cf.get()) }, | 455 { "color filter", SkColorFilterImageFilter::Create(cf.get()) }, |
450 { "displacement map", SkDisplacementMapEffect::Create( | 456 { "displacement map", SkDisplacementMapEffect::Create( |
451 SkDisplacementMapEffect::kR_ChannelSelectorType, | 457 SkDisplacementMapEffect::kR_ChannelSelectorType, |
452 SkDisplacementMapEffect::kB_ChannelSelectorType, | 458 SkDisplacementMapEffect::kB_ChannelSelectorType, |
453 20.0f, gradient_source.get()) }, | 459 20.0f, gradient_source.get()) }, |
454 { "blur", SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1) }, | 460 { "blur", SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1) }, |
455 { "drop shadow", SkDropShadowImageFilter::Create( | 461 { "drop shadow", SkDropShadowImageFilter::Create( |
456 SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_ColorGREEN, | 462 SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_ColorGREEN, |
457 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode) }, | 463 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode) }, |
458 { "diffuse lighting", SkLightingImageFilter::CreatePointLitDiffuse( | 464 { "diffuse lighting", SkLightingImageFilter::CreatePointLitDiffuse( |
459 location, SK_ColorGREEN, 0, 0) }, | 465 location, SK_ColorGREEN, 0, 0) }, |
460 { "specular lighting", | 466 { "specular lighting", |
461 SkLightingImageFilter::CreatePointLitSpecular(location, SK_ColorGR
EEN, 0, 0, 0) }, | 467 SkLightingImageFilter::CreatePointLitSpecular(location, SK_ColorGR
EEN, 0, 0, 0) }, |
462 { "matrix convolution", | 468 { "matrix convolution", |
463 SkMatrixConvolutionImageFilter::Create( | 469 SkMatrixConvolutionImageFilter::Create( |
464 kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1), | 470 kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1), |
465 SkMatrixConvolutionImageFilter::kRepeat_TileMode, false) }, | 471 SkMatrixConvolutionImageFilter::kRepeat_TileMode, false) }, |
466 { "merge", SkMergeImageFilter::Create(NULL, NULL, SkXfermode::kSrcOver_M
ode) }, | 472 { "merge", SkMergeImageFilter::Create(NULL, NULL, SkXfermode::kSrcOver_M
ode) }, |
| 473 { "merge with disjoint inputs", SkMergeImageFilter::Create( |
| 474 rectShaderFilterLeft, rectShaderFilterRight, SkXfermode::kSrcOver_
Mode) }, |
467 { "offset", SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1) }, | 475 { "offset", SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1) }, |
468 { "dilate", SkDilateImageFilter::Create(3, 2) }, | 476 { "dilate", SkDilateImageFilter::Create(3, 2) }, |
469 { "erode", SkErodeImageFilter::Create(2, 3) }, | 477 { "erode", SkErodeImageFilter::Create(2, 3) }, |
470 { "tile", SkTileImageFilter::Create(SkRect::MakeXYWH(0, 0, 50, 50), | 478 { "tile", SkTileImageFilter::Create(SkRect::MakeXYWH(0, 0, 50, 50), |
471 SkRect::MakeXYWH(0, 0, 100, 100), NU
LL) }, | 479 SkRect::MakeXYWH(0, 0, 100, 100), NU
LL) }, |
472 { "matrix", SkImageFilter::CreateMatrixFilter(matrix, kLow_SkFilterQuali
ty) }, | 480 { "matrix", SkImageFilter::CreateMatrixFilter(matrix, kLow_SkFilterQuali
ty) }, |
473 { "blur and offset", SkOffsetImageFilter::Create(five, five, blur.get())
}, | 481 { "blur and offset", SkOffsetImageFilter::Create(five, five, blur.get())
}, |
474 { "picture and blur", SkBlurImageFilter::Create(five, five, pictureFilte
r.get()) }, | 482 { "picture and blur", SkBlurImageFilter::Create(five, five, pictureFilte
r.get()) }, |
475 { "rect shader and blur", SkBlurImageFilter::Create(five, five, rectShad
erFilter.get()) }, | 483 { "rect shader and blur", SkBlurImageFilter::Create(five, five, rectShad
erFilter.get()) }, |
476 }; | 484 }; |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 return; | 1192 return; |
1185 } | 1193 } |
1186 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 1194 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
1187 SkSurface::kNo_Budgeted
, | 1195 SkSurface::kNo_Budgeted
, |
1188 SkImageInfo::MakeN32Pre
mul(1, 1), | 1196 SkImageInfo::MakeN32Pre
mul(1, 1), |
1189 0, | 1197 0, |
1190 &gProps)); | 1198 &gProps)); |
1191 test_negative_blur_sigma(device, reporter); | 1199 test_negative_blur_sigma(device, reporter); |
1192 } | 1200 } |
1193 #endif | 1201 #endif |
OLD | NEW |