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" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 SkMatrix expectedMatrix = canvas.getTotalMatrix(); | 278 SkMatrix expectedMatrix = canvas.getTotalMatrix(); |
279 | 279 |
280 SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkRTreePictureFactory)); | 280 SkAutoTUnref<SkPictureFactory> factory(SkNEW(SkRTreePictureFactory)); |
281 SkPictureRecorder recorder(factory); | 281 SkPictureRecorder recorder(factory); |
282 SkCanvas* recordingCanvas = recorder.beginRecording(100, 100); | 282 SkCanvas* recordingCanvas = recorder.beginRecording(100, 100); |
283 | 283 |
284 SkPaint paint; | 284 SkPaint paint; |
285 SkAutoTUnref<MatrixTestImageFilter> imageFilter( | 285 SkAutoTUnref<MatrixTestImageFilter> imageFilter( |
286 new MatrixTestImageFilter(reporter, expectedMatrix)); | 286 new MatrixTestImageFilter(reporter, expectedMatrix)); |
287 paint.setImageFilter(imageFilter.get()); | 287 paint.setImageFilter(imageFilter.get()); |
288 SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>( | 288 recordingCanvas->saveLayer(NULL, &paint); |
289 SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag); | |
290 recordingCanvas->saveLayer(NULL, &paint, saveFlags); | |
291 SkPaint solidPaint; | 289 SkPaint solidPaint; |
292 solidPaint.setColor(0xFFFFFFFF); | 290 solidPaint.setColor(0xFFFFFFFF); |
293 recordingCanvas->save(); | 291 recordingCanvas->save(); |
294 recordingCanvas->scale(SkIntToScalar(10), SkIntToScalar(10)); | 292 recordingCanvas->scale(SkIntToScalar(10), SkIntToScalar(10)); |
295 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(100, 100)), solidPain
t); | 293 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(100, 100)), solidPain
t); |
296 recordingCanvas->restore(); // scale | 294 recordingCanvas->restore(); // scale |
297 recordingCanvas->restore(); // saveLayer | 295 recordingCanvas->restore(); // saveLayer |
298 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 296 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
299 | 297 |
300 canvas.drawPicture(*picture); | 298 canvas.drawPicture(*picture); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 } | 442 } |
445 | 443 |
446 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { | 444 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { |
447 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 445 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
448 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 446 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
449 SkImageInfo::MakeN32Pre
mul(1, 1), | 447 SkImageInfo::MakeN32Pre
mul(1, 1), |
450 0)); | 448 0)); |
451 test_xfermode_cropped_input(device, reporter); | 449 test_xfermode_cropped_input(device, reporter); |
452 } | 450 } |
453 #endif | 451 #endif |
OLD | NEW |