OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 | 1304 |
1305 // The picture shares the immutable pixels but copies the mutable ones. | 1305 // The picture shares the immutable pixels but copies the mutable ones. |
1306 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1306 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1307 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1307 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
1308 | 1308 |
1309 // When the picture goes away, it's just our bitmaps holding the refs. | 1309 // When the picture goes away, it's just our bitmaps holding the refs. |
1310 pic.reset(NULL); | 1310 pic.reset(NULL); |
1311 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1311 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1312 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1312 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
1313 } | 1313 } |
| 1314 |
| 1315 // getRecordingCanvas() should return a SkCanvas when recording, null when not r
ecording. |
| 1316 DEF_TEST(Picture_getRecordingCanvas, r) { |
| 1317 SkPictureRecorder rec; |
| 1318 REPORTER_ASSERT(r, !rec.getRecordingCanvas()); |
| 1319 for (int i = 0; i < 3; i++) { |
| 1320 rec.beginRecording(100, 100); |
| 1321 REPORTER_ASSERT(r, rec.getRecordingCanvas()); |
| 1322 rec.endRecording()->unref(); |
| 1323 REPORTER_ASSERT(r, !rec.getRecordingCanvas()); |
| 1324 } |
| 1325 } |
OLD | NEW |