| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
| 7 | 7 |
| 8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/paint/ClipPathRecorder.h" | 10 #include "platform/graphics/paint/ClipPathRecorder.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (expectedSize != actual.size()) \ | 77 if (expectedSize != actual.size()) \ |
| 78 break; \ | 78 break; \ |
| 79 const TestDisplayItem expected[] = { __VA_ARGS__ }; \ | 79 const TestDisplayItem expected[] = { __VA_ARGS__ }; \ |
| 80 for (size_t index = 0; index < std::min<size_t>(actual.size(), expectedS
ize); index++) { \ | 80 for (size_t index = 0; index < std::min<size_t>(actual.size(), expectedS
ize); index++) { \ |
| 81 TRACE_DISPLAY_ITEMS(index, expected[index], *actual.elementAt(index)
); \ | 81 TRACE_DISPLAY_ITEMS(index, expected[index], *actual.elementAt(index)
); \ |
| 82 EXPECT_EQ(expected[index].client(), actual.elementAt(index)->client(
)); \ | 82 EXPECT_EQ(expected[index].client(), actual.elementAt(index)->client(
)); \ |
| 83 EXPECT_EQ(expected[index].type(), actual.elementAt(index)->type());
\ | 83 EXPECT_EQ(expected[index].type(), actual.elementAt(index)->type());
\ |
| 84 } \ | 84 } \ |
| 85 } while (false); | 85 } while (false); |
| 86 | 86 |
| 87 void drawRect(GraphicsContext& context, const TestDisplayItemClient& client, Dis
playItem::Type type, const FloatRect& bound) | 87 void drawRect(GraphicsContext& context, const TestDisplayItemClient& client, Dis
playItem::Type type, const FloatRect& bounds) |
| 88 { | 88 { |
| 89 DrawingRecorder drawingRecorder(context, client, type, bound); | 89 if (DrawingRecorder::useCachedDrawingIfPossible(context, client, type)) |
| 90 if (drawingRecorder.canUseCachedDrawing()) | |
| 91 return; | 90 return; |
| 91 DrawingRecorder drawingRecorder(context, client, type, bounds); |
| 92 IntRect rect(0, 0, 10, 10); | 92 IntRect rect(0, 0, 10, 10); |
| 93 context.drawRect(rect); | 93 context.drawRect(rect); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void drawClippedRect(GraphicsContext& context, const TestDisplayItemClient& clie
nt, DisplayItem::Type clipType, DisplayItem::Type drawingType, const FloatRect&
bound) | 96 void drawClippedRect(GraphicsContext& context, const TestDisplayItemClient& clie
nt, DisplayItem::Type clipType, DisplayItem::Type drawingType, const FloatRect&
bound) |
| 97 { | 97 { |
| 98 ClipRecorder clipRecorder(context, client, clipType, LayoutRect(1, 1, 9, 9))
; | 98 ClipRecorder clipRecorder(context, client, clipType, LayoutRect(1, 1, 9, 9))
; |
| 99 drawRect(context, client, drawingType, bound); | 99 drawRect(context, client, drawingType, bound); |
| 100 } | 100 } |
| 101 | 101 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 695 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 696 displayItemList().commitNewDisplayItems(); | 696 displayItemList().commitNewDisplayItems(); |
| 697 | 697 |
| 698 // Empty clips should have been optimized out. | 698 // Empty clips should have been optimized out. |
| 699 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 699 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
| 700 TestDisplayItem(first, backgroundDrawingType), | 700 TestDisplayItem(first, backgroundDrawingType), |
| 701 TestDisplayItem(third, backgroundDrawingType)); | 701 TestDisplayItem(third, backgroundDrawingType)); |
| 702 } | 702 } |
| 703 | 703 |
| 704 } // namespace blink | 704 } // namespace blink |
| OLD | NEW |