Index: Source/platform/graphics/GraphicsContextTest.cpp |
diff --git a/Source/platform/graphics/GraphicsContextTest.cpp b/Source/platform/graphics/GraphicsContextTest.cpp |
index 0fc10ec267106941a8c4fd679fa04e9a8247386a..085fe56135abac803cc6a1196646b963e99c0a7e 100644 |
--- a/Source/platform/graphics/GraphicsContextTest.cpp |
+++ b/Source/platform/graphics/GraphicsContextTest.cpp |
@@ -1156,43 +1156,43 @@ TEST(GraphicsContextTest, RecordingTotalMatrix) |
TEST(GraphicsContextTest, DisplayList) |
{ |
+ SkBitmap bitmap; |
+ ASSERT_TRUE(bitmap.allocN32Pixels(1, 1)); |
+ bitmap.eraseColor(0); |
+ SkCanvas canvas(bitmap); |
+ GraphicsContext context(&canvas); |
+ |
FloatRect rect(0, 0, 1, 1); |
- RefPtr<DisplayList> dl = adoptRef(new DisplayList(rect)); |
+ DisplayList::create(rect); |
- // picture() returns 0 initially |
- SkPicture* pic = dl->picture(); |
- EXPECT_FALSE(pic); |
- |
- // endRecording without a beginRecording does nothing |
- dl->endRecording(); |
- pic = dl->picture(); |
- EXPECT_FALSE(pic); |
// Two beginRecordings in a row generate two canvases. |
// Unfortunately the new one could be allocated in the same |
// spot as the old one so ref the first one to prolong its life. |
- IntSize size(1, 1); |
- SkCanvas* canvas1 = dl->beginRecording(size); |
+ RefPtr<DisplayList> dl1 = context.beginRecording(rect); |
+ // picture() returns 0 initially |
+ SkPicture* pic = dl1->picture(); |
+ EXPECT_FALSE(pic); |
+ SkCanvas* canvas1 = context.canvas(); |
EXPECT_TRUE(canvas1); |
- canvas1->ref(); |
- SkCanvas* canvas2 = dl->beginRecording(size); |
+ RefPtr<DisplayList> dl2 = context.beginRecording(rect); |
+ SkCanvas* canvas2 = context.canvas(); |
EXPECT_TRUE(canvas2); |
EXPECT_NE(canvas1, canvas2); |
EXPECT_EQ(1, canvas1->getRefCnt()); |
- canvas1->unref(); |
- |
- EXPECT_TRUE(dl->isRecording()); |
// picture() returns 0 during recording |
- pic = dl->picture(); |
+ pic = dl2->picture(); |
EXPECT_FALSE(pic); |
// endRecording finally makes the picture accessible |
- dl->endRecording(); |
- pic = dl->picture(); |
+ context.endRecording(); |
+ pic = dl2->picture(); |
EXPECT_TRUE(pic); |
EXPECT_EQ(1, pic->getRefCnt()); |
+ |
+ context.endRecording(); |
} |
} // namespace |