OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkDrawFilter.h" | 9 #include "SkDrawFilter.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 * canvas.setDrawFilter is defined to be local to the save/restore block, such
that if you | 23 * canvas.setDrawFilter is defined to be local to the save/restore block, such
that if you |
24 * do the following: save / modify-drawfilter / restore, the current drawfilter
should be what | 24 * do the following: save / modify-drawfilter / restore, the current drawfilter
should be what |
25 * it was before the save. | 25 * it was before the save. |
26 */ | 26 */ |
27 static void test_saverestore(skiatest::Reporter* reporter) { | 27 static void test_saverestore(skiatest::Reporter* reporter) { |
28 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); | 28 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); |
29 SkCanvas* canvas = surface->getCanvas(); | 29 SkCanvas* canvas = surface->getCanvas(); |
30 | 30 |
31 SkAutoTUnref<TestFilter> df(new TestFilter); | 31 SkAutoTUnref<TestFilter> df(new TestFilter); |
32 | 32 |
33 REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter()); | 33 REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter()); |
34 | 34 |
35 canvas->save(); | 35 canvas->save(); |
36 canvas->setDrawFilter(df); | 36 canvas->setDrawFilter(df); |
37 REPORTER_ASSERT(reporter, NULL != canvas->getDrawFilter()); | 37 REPORTER_ASSERT(reporter, nullptr != canvas->getDrawFilter()); |
38 canvas->restore(); | 38 canvas->restore(); |
39 | 39 |
40 REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter()); | 40 REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter()); |
41 } | 41 } |
42 | 42 |
43 DEF_TEST(DrawFilter, reporter) { | 43 DEF_TEST(DrawFilter, reporter) { |
44 test_saverestore(reporter); | 44 test_saverestore(reporter); |
45 } | 45 } |
OLD | NEW |