| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/paint/PaintChunker.h" | 5 #include "platform/graphics/paint/PaintChunker.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 TestDisplayItem(DisplayItem::Type type) : DisplayItem(*this, type, sizeof(*t
his)) { } | 39 TestDisplayItem(DisplayItem::Type type) : DisplayItem(*this, type, sizeof(*t
his)) { } |
| 40 | 40 |
| 41 void replay(GraphicsContext&) const final { NOTREACHED(); } | 41 void replay(GraphicsContext&) const final { NOTREACHED(); } |
| 42 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const f
inal { NOTREACHED(); } | 42 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const f
inal { NOTREACHED(); } |
| 43 String debugName() const final { return "Test"; } | 43 String debugName() const final { return "Test"; } |
| 44 LayoutRect visualRect() const final { return LayoutRect(); } | 44 LayoutRect visualRect() const final { return LayoutRect(); } |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class NormalTestDisplayItem : public TestDisplayItem { | 47 class NormalTestDisplayItem : public TestDisplayItem { |
| 48 public: | 48 public: |
| 49 NormalTestDisplayItem() : TestDisplayItem(DisplayItem::DrawingFirst) { } | 49 NormalTestDisplayItem() : TestDisplayItem(DisplayItem::kDrawingFirst) { } |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class TestDisplayItemRequiringSeparateChunk : public TestDisplayItem { | 52 class TestDisplayItemRequiringSeparateChunk : public TestDisplayItem { |
| 53 public: | 53 public: |
| 54 TestDisplayItemRequiringSeparateChunk() : TestDisplayItem(DisplayItem::Forei
gnLayerPlugin) { } | 54 TestDisplayItemRequiringSeparateChunk() : TestDisplayItem(DisplayItem::kFore
ignLayerPlugin) { } |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 TEST_F(PaintChunkerTest, Empty) | 57 TEST_F(PaintChunkerTest, Empty) |
| 58 { | 58 { |
| 59 Vector<PaintChunk> chunks = PaintChunker().releasePaintChunks(); | 59 Vector<PaintChunk> chunks = PaintChunker().releasePaintChunks(); |
| 60 ASSERT_TRUE(chunks.isEmpty()); | 60 ASSERT_TRUE(chunks.isEmpty()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 TEST_F(PaintChunkerTest, SingleNonEmptyRange) | 63 TEST_F(PaintChunkerTest, SingleNonEmptyRange) |
| 64 { | 64 { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 PaintChunk(1, 2, &id1, rootPaintChunkProperties()), | 247 PaintChunk(1, 2, &id1, rootPaintChunkProperties()), |
| 248 PaintChunk(2, 3, &id2, rootPaintChunkProperties()), | 248 PaintChunk(2, 3, &id2, rootPaintChunkProperties()), |
| 249 PaintChunk(3, 4, &id3, rootPaintChunkProperties()), | 249 PaintChunk(3, 4, &id3, rootPaintChunkProperties()), |
| 250 PaintChunk(4, 6, nullptr, rootPaintChunkProperties()), | 250 PaintChunk(4, 6, nullptr, rootPaintChunkProperties()), |
| 251 PaintChunk(6, 7, &id6, rootPaintChunkProperties()))); | 251 PaintChunk(6, 7, &id6, rootPaintChunkProperties()))); |
| 252 } | 252 } |
| 253 | 253 |
| 254 TEST_F(PaintChunkerTest, ChunkIds) | 254 TEST_F(PaintChunkerTest, ChunkIds) |
| 255 { | 255 { |
| 256 PaintChunker chunker; | 256 PaintChunker chunker; |
| 257 TestDisplayItem i1(DisplayItem::DrawingFirst); | 257 TestDisplayItem i1(DisplayItem::kDrawingFirst); |
| 258 DisplayItem::Id id1 = i1.getId(); | 258 DisplayItem::Id id1 = i1.getId(); |
| 259 TestDisplayItemRequiringSeparateChunk i2; | 259 TestDisplayItemRequiringSeparateChunk i2; |
| 260 DisplayItem::Id id2 = i2.getId(); | 260 DisplayItem::Id id2 = i2.getId(); |
| 261 | 261 |
| 262 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); | 262 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); |
| 263 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); | 263 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); |
| 264 | 264 |
| 265 PaintChunkProperties simpleTransform; | 265 PaintChunkProperties simpleTransform; |
| 266 simpleTransform.transform = TransformPaintPropertyNode::create(nullptr, Tran
sformationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7)); | 266 simpleTransform.transform = TransformPaintPropertyNode::create(nullptr, Tran
sformationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7)); |
| 267 chunker.updateCurrentPaintChunkProperties(&id1, simpleTransform); | 267 chunker.updateCurrentPaintChunkProperties(&id1, simpleTransform); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 279 PaintChunk(0, 2, nullptr, rootPaintChunkProperties()), | 279 PaintChunk(0, 2, nullptr, rootPaintChunkProperties()), |
| 280 PaintChunk(2, 4, &id1, simpleTransform), | 280 PaintChunk(2, 4, &id1, simpleTransform), |
| 281 PaintChunk(4, 5, &id2, simpleTransform), | 281 PaintChunk(4, 5, &id2, simpleTransform), |
| 282 PaintChunk(5, 6, nullptr, simpleTransform), | 282 PaintChunk(5, 6, nullptr, simpleTransform), |
| 283 PaintChunk(6, 7, nullptr, rootPaintChunkProperties()))); | 283 PaintChunk(6, 7, nullptr, rootPaintChunkProperties()))); |
| 284 } | 284 } |
| 285 | 285 |
| 286 TEST_F(PaintChunkerTest, ChunkIdsSkippingCache) | 286 TEST_F(PaintChunkerTest, ChunkIdsSkippingCache) |
| 287 { | 287 { |
| 288 PaintChunker chunker; | 288 PaintChunker chunker; |
| 289 TestDisplayItem i1(DisplayItem::DrawingFirst); | 289 TestDisplayItem i1(DisplayItem::kDrawingFirst); |
| 290 i1.setSkippedCache(); | 290 i1.setSkippedCache(); |
| 291 DisplayItem::Id id1 = i1.getId(); | 291 DisplayItem::Id id1 = i1.getId(); |
| 292 TestDisplayItemRequiringSeparateChunk i2; | 292 TestDisplayItemRequiringSeparateChunk i2; |
| 293 i2.setSkippedCache(); | 293 i2.setSkippedCache(); |
| 294 | 294 |
| 295 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); | 295 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); |
| 296 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); | 296 chunker.incrementDisplayItemIndex(NormalTestDisplayItem()); |
| 297 | 297 |
| 298 PaintChunkProperties simpleTransform; | 298 PaintChunkProperties simpleTransform; |
| 299 simpleTransform.transform = TransformPaintPropertyNode::create(nullptr, Tran
sformationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7)); | 299 simpleTransform.transform = TransformPaintPropertyNode::create(nullptr, Tran
sformationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 313 PaintChunk(2, 4, nullptr, simpleTransform), | 313 PaintChunk(2, 4, nullptr, simpleTransform), |
| 314 PaintChunk(4, 5, nullptr, simpleTransform), | 314 PaintChunk(4, 5, nullptr, simpleTransform), |
| 315 PaintChunk(5, 6, nullptr, simpleTransform), | 315 PaintChunk(5, 6, nullptr, simpleTransform), |
| 316 PaintChunk(6, 7, nullptr, rootPaintChunkProperties()))); | 316 PaintChunk(6, 7, nullptr, rootPaintChunkProperties()))); |
| 317 } | 317 } |
| 318 | 318 |
| 319 #endif | 319 #endif |
| 320 | 320 |
| 321 } // namespace | 321 } // namespace |
| 322 } // namespace blink | 322 } // namespace blink |
| OLD | NEW |