| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 SkScalar gain = SK_Scalar1, bias = 0; | 291 SkScalar gain = SK_Scalar1, bias = 0; |
| 292 | 292 |
| 293 SkImageFilter* filters[] = { | 293 SkImageFilter* filters[] = { |
| 294 SkColorFilterImageFilter::Create(cf.get(), input.get(), &cropRect), | 294 SkColorFilterImageFilter::Create(cf.get(), input.get(), &cropRect), |
| 295 SkDisplacementMapEffect::Create(SkDisplacementMapEffect::kR_ChannelSelec
torType, | 295 SkDisplacementMapEffect::Create(SkDisplacementMapEffect::kR_ChannelSelec
torType, |
| 296 SkDisplacementMapEffect::kB_ChannelSelec
torType, | 296 SkDisplacementMapEffect::kB_ChannelSelec
torType, |
| 297 40.0f, input.get(), input.get(), &cropRe
ct), | 297 40.0f, input.get(), input.get(), &cropRe
ct), |
| 298 SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRect
), | 298 SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRect
), |
| 299 SkDropShadowImageFilter::Create(SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_S
calar1, | 299 SkDropShadowImageFilter::Create(SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_S
calar1, |
| 300 SK_ColorGREEN, SkDropShadowImageFilter::kDrawShadowAndForeground_Sha
dowMode, | 300 SK_ColorGREEN, SkDropShadowImageFilter::kDrawShadowAndForeground_Sha
dowMode, |
| 301 input.get(), &cropRect, 0), | 301 input.get(), &cropRect), |
| 302 SkLightingImageFilter::CreatePointLitDiffuse(location, SK_ColorGREEN, 0,
0, input.get(), &cropRect), | 302 SkLightingImageFilter::CreatePointLitDiffuse(location, SK_ColorGREEN, 0,
0, input.get(), &cropRect), |
| 303 SkLightingImageFilter::CreatePointLitSpecular(location, SK_ColorGREEN, 0
, 0, 0, input.get(), &cropRect), | 303 SkLightingImageFilter::CreatePointLitSpecular(location, SK_ColorGREEN, 0
, 0, 0, input.get(), &cropRect), |
| 304 SkMatrixConvolutionImageFilter::Create(kernelSize, kernel, gain, bias, S
kIPoint::Make(1, 1), SkMatrixConvolutionImageFilter::kRepeat_TileMode, false, in
put.get(), &cropRect), | 304 SkMatrixConvolutionImageFilter::Create(kernelSize, kernel, gain, bias, S
kIPoint::Make(1, 1), SkMatrixConvolutionImageFilter::kRepeat_TileMode, false, in
put.get(), &cropRect), |
| 305 SkMergeImageFilter::Create(input.get(), input.get(), SkXfermode::kSrcOve
r_Mode, &cropRect), | 305 SkMergeImageFilter::Create(input.get(), input.get(), SkXfermode::kSrcOve
r_Mode, &cropRect), |
| 306 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), | 306 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), |
| 307 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), | 307 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), |
| 308 SkDilateImageFilter::Create(3, 2, input.get(), &cropRect), | 308 SkDilateImageFilter::Create(3, 2, input.get(), &cropRect), |
| 309 SkErodeImageFilter::Create(2, 3, input.get(), &cropRect), | 309 SkErodeImageFilter::Create(2, 3, input.get(), &cropRect), |
| 310 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), | 310 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), |
| 311 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), | 311 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 578 |
| 579 static SkImageFilter* makeBlur(SkImageFilter* input = NULL) { | 579 static SkImageFilter* makeBlur(SkImageFilter* input = NULL) { |
| 580 return SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, input); | 580 return SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, input); |
| 581 } | 581 } |
| 582 | 582 |
| 583 static SkImageFilter* makeDropShadow(SkImageFilter* input = NULL) { | 583 static SkImageFilter* makeDropShadow(SkImageFilter* input = NULL) { |
| 584 return SkDropShadowImageFilter::Create( | 584 return SkDropShadowImageFilter::Create( |
| 585 SkIntToScalar(100), SkIntToScalar(100), | 585 SkIntToScalar(100), SkIntToScalar(100), |
| 586 SkIntToScalar(10), SkIntToScalar(10), | 586 SkIntToScalar(10), SkIntToScalar(10), |
| 587 SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMo
de, | 587 SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMo
de, |
| 588 input, NULL, 0); | 588 input, NULL); |
| 589 } | 589 } |
| 590 | 590 |
| 591 DEF_TEST(ImageFilterBlurThenShadowBounds, reporter) { | 591 DEF_TEST(ImageFilterBlurThenShadowBounds, reporter) { |
| 592 SkAutoTUnref<SkImageFilter> filter1(makeBlur()); | 592 SkAutoTUnref<SkImageFilter> filter1(makeBlur()); |
| 593 SkAutoTUnref<SkImageFilter> filter2(makeDropShadow(filter1.get())); | 593 SkAutoTUnref<SkImageFilter> filter2(makeDropShadow(filter1.get())); |
| 594 | 594 |
| 595 SkIRect bounds = SkIRect::MakeXYWH(0, 0, 100, 100); | 595 SkIRect bounds = SkIRect::MakeXYWH(0, 0, 100, 100); |
| 596 SkIRect expectedBounds = SkIRect::MakeXYWH(-133, -133, 236, 236); | 596 SkIRect expectedBounds = SkIRect::MakeXYWH(-133, -133, 236, 236); |
| 597 filter2->filterBounds(bounds, SkMatrix::I(), &bounds); | 597 filter2->filterBounds(bounds, SkMatrix::I(), &bounds); |
| 598 | 598 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { | 1173 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { |
| 1174 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 1174 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
| 1175 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 1175 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
| 1176 SkSurface::kNo_Budgeted
, | 1176 SkSurface::kNo_Budgeted
, |
| 1177 SkImageInfo::MakeN32Pre
mul(1, 1), | 1177 SkImageInfo::MakeN32Pre
mul(1, 1), |
| 1178 0, | 1178 0, |
| 1179 &gProps)); | 1179 &gProps)); |
| 1180 test_negative_blur_sigma(device, reporter); | 1180 test_negative_blur_sigma(device, reporter); |
| 1181 } | 1181 } |
| 1182 #endif | 1182 #endif |
| OLD | NEW |