| 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/DisplayItem.h" | 11 #include "platform/graphics/paint/DisplayItem.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 class RenderObject; | 20 class RenderObject; |
| 21 | 21 |
| 22 class PLATFORM_EXPORT DrawingRecorder { | 22 class PLATFORM_EXPORT DrawingRecorder { |
| 23 public: | 23 public: |
| 24 explicit DrawingRecorder(GraphicsContext*, const DisplayItemClient, DisplayI
tem::Type, const FloatRect& bounds); | 24 enum CachePolicy { |
| 25 UseCacheIfAvailable, |
| 26 DisableCache, |
| 27 }; |
| 28 |
| 29 explicit DrawingRecorder(GraphicsContext*, const DisplayItemClient, DisplayI
tem::Type, const FloatRect&, CachePolicy = UseCacheIfAvailable); |
| 25 | 30 |
| 26 ~DrawingRecorder(); | 31 ~DrawingRecorder(); |
| 27 | 32 |
| 28 bool canUseCachedDrawing() const { return m_canUseCachedDrawing; } | 33 bool canUseCachedDrawing() const { return m_canUseCachedDrawing; } |
| 29 | 34 |
| 30 #ifndef NDEBUG | 35 #ifndef NDEBUG |
| 31 void setClientDebugString(const WTF::String&); | 36 void setClientDebugString(const WTF::String&); |
| 32 #endif | 37 #endif |
| 33 | 38 |
| 34 private: | 39 private: |
| 35 GraphicsContext* m_context; | 40 GraphicsContext* m_context; |
| 36 DisplayItemClient m_displayItemClient; | 41 DisplayItemClient m_displayItemClient; |
| 37 const DisplayItem::Type m_displayItemType; | 42 const DisplayItem::Type m_displayItemType; |
| 38 const FloatRect m_bounds; | 43 const FloatRect m_bounds; |
| 39 bool m_canUseCachedDrawing; | 44 bool m_canUseCachedDrawing; |
| 40 #ifndef NDEBUG | 45 #ifndef NDEBUG |
| 41 WTF::String m_clientDebugString; | 46 WTF::String m_clientDebugString; |
| 42 #endif | 47 #endif |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 } // namespace blink | 50 } // namespace blink |
| 46 | 51 |
| 47 #endif // DrawingRecorder_h | 52 #endif // DrawingRecorder_h |
| OLD | NEW |