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 #ifndef DrawingRecorder_h | 5 #ifndef DrawingRecorder_h |
6 #define DrawingRecorder_h | 6 #define DrawingRecorder_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 | 9 |
10 #include "platform/geometry/FloatRect.h" | 10 #include "platform/geometry/FloatRect.h" |
11 #include "platform/graphics/paint/DrawingDisplayItem.h" | 11 #include "platform/graphics/paint/DrawingDisplayItem.h" |
12 | 12 |
13 #ifndef NDEBUG | 13 #ifndef NDEBUG |
14 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class GraphicsContext; | 19 class GraphicsContext; |
20 | 20 |
21 class PLATFORM_EXPORT DrawingRecorder { | 21 class PLATFORM_EXPORT DrawingRecorder { |
22 public: | 22 public: |
| 23 static bool useCachedDrawingIfPossible(GraphicsContext&, const DisplayItemCl
ientWrapper&, DisplayItem::Type); |
| 24 |
23 DrawingRecorder(GraphicsContext&, const DisplayItemClientWrapper&, DisplayIt
em::Type, const FloatRect& cullRect); | 25 DrawingRecorder(GraphicsContext&, const DisplayItemClientWrapper&, DisplayIt
em::Type, const FloatRect& cullRect); |
24 ~DrawingRecorder(); | 26 ~DrawingRecorder(); |
25 | 27 |
26 bool canUseCachedDrawing() const | |
27 { | |
28 #if ENABLE(ASSERT) | |
29 m_checkedCachedDrawing = true; | |
30 #endif | |
31 return m_canUseCachedDrawing; | |
32 } | |
33 | |
34 #if ENABLE(ASSERT) | 28 #if ENABLE(ASSERT) |
35 void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationC
heckingMode mode) { m_underInvalidationCheckingMode = mode; } | 29 void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationC
heckingMode mode) { m_underInvalidationCheckingMode = mode; } |
36 #endif | 30 #endif |
37 | 31 |
38 private: | 32 private: |
39 GraphicsContext& m_context; | 33 GraphicsContext& m_context; |
40 DisplayItemClientWrapper m_displayItemClient; | 34 DisplayItemClientWrapper m_displayItemClient; |
41 const DisplayItem::Type m_displayItemType; | 35 const DisplayItem::Type m_displayItemType; |
42 bool m_canUseCachedDrawing; | |
43 #if ENABLE(ASSERT) | 36 #if ENABLE(ASSERT) |
44 mutable bool m_checkedCachedDrawing; | |
45 size_t m_displayItemPosition; | 37 size_t m_displayItemPosition; |
46 DrawingDisplayItem::UnderInvalidationCheckingMode m_underInvalidationCheckin
gMode; | 38 DrawingDisplayItem::UnderInvalidationCheckingMode m_underInvalidationCheckin
gMode; |
47 #endif | 39 #endif |
48 }; | 40 }; |
49 | 41 |
50 } // namespace blink | 42 } // namespace blink |
51 | 43 |
52 #endif // DrawingRecorder_h | 44 #endif // DrawingRecorder_h |
OLD | NEW |