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 "SkBicubicImageFilter.h" | 8 #include "SkBicubicImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
11 #include "SkBitmapSource.h" | 11 #include "SkBitmapSource.h" |
12 #include "SkBlurImageFilter.h" | 12 #include "SkBlurImageFilter.h" |
13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
14 #include "SkColorFilterImageFilter.h" | 14 #include "SkColorFilterImageFilter.h" |
15 #include "SkColorMatrixFilter.h" | 15 #include "SkColorMatrixFilter.h" |
16 #include "SkDeviceImageFilterProxy.h" | 16 #include "SkDeviceImageFilterProxy.h" |
17 #include "SkDisplacementMapEffect.h" | 17 #include "SkDisplacementMapEffect.h" |
18 #include "SkDropShadowImageFilter.h" | 18 #include "SkDropShadowImageFilter.h" |
19 #include "SkFlattenableBuffers.h" | 19 #include "SkFlattenableBuffers.h" |
20 #include "SkLightingImageFilter.h" | 20 #include "SkLightingImageFilter.h" |
21 #include "SkMatrixConvolutionImageFilter.h" | 21 #include "SkMatrixConvolutionImageFilter.h" |
22 #include "SkMatrixImageFilter.h" | 22 #include "SkMatrixImageFilter.h" |
23 #include "SkMergeImageFilter.h" | 23 #include "SkMergeImageFilter.h" |
24 #include "SkMorphologyImageFilter.h" | 24 #include "SkMorphologyImageFilter.h" |
25 #include "SkOffsetImageFilter.h" | 25 #include "SkOffsetImageFilter.h" |
26 #include "SkPicture.h" | 26 #include "SkPicture.h" |
| 27 #include "SkRTreePicture.h" |
27 #include "SkRect.h" | 28 #include "SkRect.h" |
28 #include "SkTileImageFilter.h" | 29 #include "SkTileImageFilter.h" |
29 #include "SkXfermodeImageFilter.h" | 30 #include "SkXfermodeImageFilter.h" |
30 #include "Test.h" | 31 #include "Test.h" |
31 | 32 |
32 #if SK_SUPPORT_GPU | 33 #if SK_SUPPORT_GPU |
33 #include "GrContextFactory.h" | 34 #include "GrContextFactory.h" |
34 #include "SkGpuDevice.h" | 35 #include "SkGpuDevice.h" |
35 #endif | 36 #endif |
36 | 37 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 270 |
270 DEF_TEST(ImageFilterMatrixTest, reporter) { | 271 DEF_TEST(ImageFilterMatrixTest, reporter) { |
271 SkBitmap temp; | 272 SkBitmap temp; |
272 temp.allocN32Pixels(100, 100); | 273 temp.allocN32Pixels(100, 100); |
273 SkBitmapDevice device(temp); | 274 SkBitmapDevice device(temp); |
274 SkCanvas canvas(&device); | 275 SkCanvas canvas(&device); |
275 canvas.scale(SkIntToScalar(2), SkIntToScalar(2)); | 276 canvas.scale(SkIntToScalar(2), SkIntToScalar(2)); |
276 | 277 |
277 SkMatrix expectedMatrix = canvas.getTotalMatrix(); | 278 SkMatrix expectedMatrix = canvas.getTotalMatrix(); |
278 | 279 |
279 SkPictureRecorder recorder; | 280 SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkRTreePictureFactory)); |
280 SkCanvas* recordingCanvas = recorder.beginRecording(100, 100, | 281 SkPictureRecorder recorder(factory); |
281 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); | 282 SkCanvas* recordingCanvas = recorder.beginRecording(100, 100); |
282 | 283 |
283 SkPaint paint; | 284 SkPaint paint; |
284 SkAutoTUnref<MatrixTestImageFilter> imageFilter( | 285 SkAutoTUnref<MatrixTestImageFilter> imageFilter( |
285 new MatrixTestImageFilter(reporter, expectedMatrix)); | 286 new MatrixTestImageFilter(reporter, expectedMatrix)); |
286 paint.setImageFilter(imageFilter.get()); | 287 paint.setImageFilter(imageFilter.get()); |
287 SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>( | 288 SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>( |
288 SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag); | 289 SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag); |
289 recordingCanvas->saveLayer(NULL, &paint, saveFlags); | 290 recordingCanvas->saveLayer(NULL, &paint, saveFlags); |
290 SkPaint solidPaint; | 291 SkPaint solidPaint; |
291 solidPaint.setColor(0xFFFFFFFF); | 292 solidPaint.setColor(0xFFFFFFFF); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 } | 444 } |
444 | 445 |
445 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { | 446 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { |
446 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 447 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
447 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 448 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
448 SkImageInfo::MakeN32Pre
mul(1, 1), | 449 SkImageInfo::MakeN32Pre
mul(1, 1), |
449 0)); | 450 0)); |
450 test_xfermode_cropped_input(device, reporter); | 451 test_xfermode_cropped_input(device, reporter); |
451 } | 452 } |
452 #endif | 453 #endif |
OLD | NEW |