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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 // both pictures should have different ids | 1554 // both pictures should have different ids |
1555 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty.uniqueID()); | 1555 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty.uniqueID()); |
1556 | 1556 |
1557 // test out copy constructor | 1557 // test out copy constructor |
1558 SkPicture copyWithData(*hasData); | 1558 SkPicture copyWithData(*hasData); |
1559 REPORTER_ASSERT(reporter, hasData->uniqueID() == copyWithData.uniqueID()); | 1559 REPORTER_ASSERT(reporter, hasData->uniqueID() == copyWithData.uniqueID()); |
1560 | 1560 |
1561 SkPicture emptyCopy(empty); | 1561 SkPicture emptyCopy(empty); |
1562 REPORTER_ASSERT(reporter, empty.uniqueID() != emptyCopy.uniqueID()); | 1562 REPORTER_ASSERT(reporter, empty.uniqueID() != emptyCopy.uniqueID()); |
1563 | 1563 |
1564 // test out swap | |
1565 { | |
1566 SkPicture swapWithData; | |
1567 uint32_t beforeID1 = swapWithData.uniqueID(); | |
1568 uint32_t beforeID2 = copyWithData.uniqueID(); | |
1569 swapWithData.swap(copyWithData); | |
1570 REPORTER_ASSERT(reporter, copyWithData.uniqueID() == beforeID1); | |
1571 REPORTER_ASSERT(reporter, swapWithData.uniqueID() == beforeID2); | |
1572 } | |
1573 | |
1574 // test out clone | 1564 // test out clone |
1575 { | 1565 { |
1576 SkAutoTUnref<SkPicture> cloneWithData(hasData->clone()); | 1566 SkAutoTUnref<SkPicture> cloneWithData(hasData->clone()); |
1577 REPORTER_ASSERT(reporter, hasData->uniqueID() == cloneWithData->uniqueID
()); | 1567 REPORTER_ASSERT(reporter, hasData->uniqueID() == cloneWithData->uniqueID
()); |
1578 | 1568 |
1579 SkAutoTUnref<SkPicture> emptyClone(empty.clone()); | 1569 SkAutoTUnref<SkPicture> emptyClone(empty.clone()); |
1580 REPORTER_ASSERT(reporter, empty.uniqueID() != emptyClone->uniqueID()); | 1570 REPORTER_ASSERT(reporter, empty.uniqueID() != emptyClone->uniqueID()); |
1581 } | 1571 } |
1582 } | 1572 } |
1583 | 1573 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1626 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
1637 } | 1627 } |
1638 | 1628 |
1639 DEF_TEST(Canvas_EmptyBitmap, r) { | 1629 DEF_TEST(Canvas_EmptyBitmap, r) { |
1640 SkBitmap dst; | 1630 SkBitmap dst; |
1641 dst.allocN32Pixels(10, 10); | 1631 dst.allocN32Pixels(10, 10); |
1642 SkCanvas canvas(dst); | 1632 SkCanvas canvas(dst); |
1643 | 1633 |
1644 test_draw_bitmaps(&canvas); | 1634 test_draw_bitmaps(&canvas); |
1645 } | 1635 } |
OLD | NEW |