| Index: Source/platform/graphics/GraphicsContextTest.cpp
|
| diff --git a/Source/platform/graphics/GraphicsContextTest.cpp b/Source/platform/graphics/GraphicsContextTest.cpp
|
| index 0fc10ec267106941a8c4fd679fa04e9a8247386a..c1a01aef7506161de81b4eab7844d5a4b99e9932 100644
|
| --- a/Source/platform/graphics/GraphicsContextTest.cpp
|
| +++ b/Source/platform/graphics/GraphicsContextTest.cpp
|
| @@ -1135,13 +1135,15 @@ TEST(GraphicsContextTest, RecordingTotalMatrix)
|
| DISPATCH2(context, controlContext, scale, 2, 2);
|
| EXPECT_EQ(context.getCTM(), controlContext.getCTM());
|
|
|
| + RefPtr<DisplayList> displayList1 = DisplayList::create(FloatRect(0, 0, 200, 200));
|
| controlContext.save();
|
| - context.beginRecording(FloatRect(0, 0, 200, 200));
|
| + context.beginRecording(displayList1);
|
| DISPATCH2(context, controlContext, translate, 10, 10);
|
| EXPECT_EQ(context.getCTM(), controlContext.getCTM());
|
|
|
| + RefPtr<DisplayList> displayList2 = DisplayList::create(FloatRect(10, 10, 100, 100));
|
| controlContext.save();
|
| - context.beginRecording(FloatRect(10, 10, 100, 100));
|
| + context.beginRecording(displayList2);
|
| DISPATCH1(context, controlContext, rotate, 45);
|
| EXPECT_EQ(context.getCTM(), controlContext.getCTM());
|
|
|
| @@ -1156,43 +1158,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));
|
| + RefPtr<DisplayList> dl = 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);
|
| + context.beginRecording(dl);
|
| + SkCanvas* canvas1 = context.canvas();
|
| EXPECT_TRUE(canvas1);
|
| - canvas1->ref();
|
| - SkCanvas* canvas2 = dl->beginRecording(size);
|
| + context.beginRecording(dl);
|
| + 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();
|
| EXPECT_FALSE(pic);
|
|
|
| // endRecording finally makes the picture accessible
|
| - dl->endRecording();
|
| + context.endRecording();
|
| pic = dl->picture();
|
| EXPECT_TRUE(pic);
|
| EXPECT_EQ(1, pic->getRefCnt());
|
| +
|
| + context.endRecording();
|
| }
|
|
|
| } // namespace
|
|
|