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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 | 1335 |
1336 DEF_TEST(MiniRecorderLeftHanging, r) { | 1336 DEF_TEST(MiniRecorderLeftHanging, r) { |
1337 // Any shader or other ref-counted effect will do just fine here. | 1337 // Any shader or other ref-counted effect will do just fine here. |
1338 SkPaint paint; | 1338 SkPaint paint; |
1339 paint.setShader(SkShader::CreateColorShader(SK_ColorRED))->unref(); | 1339 paint.setShader(SkShader::CreateColorShader(SK_ColorRED))->unref(); |
1340 | 1340 |
1341 SkMiniRecorder rec; | 1341 SkMiniRecorder rec; |
1342 REPORTER_ASSERT(r, rec.drawRect(SkRect::MakeWH(20,30), paint)); | 1342 REPORTER_ASSERT(r, rec.drawRect(SkRect::MakeWH(20,30), paint)); |
1343 // Don't call rec.detachPicture(). Test succeeds by not asserting or leakin
g the shader. | 1343 // Don't call rec.detachPicture(). Test succeeds by not asserting or leakin
g the shader. |
1344 } | 1344 } |
| 1345 |
| 1346 DEF_TEST(Picture_preserveCullRect, r) { |
| 1347 SkPictureRecorder recorder; |
| 1348 |
| 1349 SkCanvas* c = recorder.beginRecording(SkRect::MakeLTRB(1, 2, 3, 4)); |
| 1350 c->clear(SK_ColorCYAN); |
| 1351 |
| 1352 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 1353 SkDynamicMemoryWStream wstream; |
| 1354 picture->serialize(&wstream); |
| 1355 |
| 1356 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); |
| 1357 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); |
| 1358 |
| 1359 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); |
| 1360 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); |
| 1361 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); |
| 1362 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); |
| 1363 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); |
| 1364 } |
OLD | NEW |