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/DrawingRecorder.h" | 6 #include "platform/graphics/paint/DrawingRecorder.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/GraphicsLayer.h" | 10 #include "platform/graphics/GraphicsLayer.h" |
11 #include "platform/graphics/paint/CachedDisplayItem.h" | 11 #include "platform/graphics/paint/CachedDisplayItem.h" |
12 #include "platform/graphics/paint/DisplayItemList.h" | 12 #include "platform/graphics/paint/DisplayItemList.h" |
13 #include "platform/graphics/paint/DrawingDisplayItem.h" | 13 #include "platform/graphics/paint/DrawingDisplayItem.h" |
14 #include "third_party/skia/include/core/SkPicture.h" | 14 #include "third_party/skia/include/core/SkPicture.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 #if ENABLE(ASSERT) | 18 #if ENABLE(ASSERT) |
19 static bool s_inDrawingRecorder = false; | 19 static bool s_inDrawingRecorder = false; |
20 #endif | 20 #endif |
21 | 21 |
22 DrawingRecorder::DrawingRecorder(GraphicsContext* context, const DisplayItemClie
nt displayItemClient, DisplayItem::Type displayItemType, const FloatRect& bounds
) | 22 DrawingRecorder::DrawingRecorder(GraphicsContext* context, const DisplayItemClie
nt displayItemClient, DisplayItem::Type displayItemType, const FloatRect& bounds
, CachePolicy cachePolicy) |
23 : m_context(context) | 23 : m_context(context) |
24 , m_displayItemClient(displayItemClient) | 24 , m_displayItemClient(displayItemClient) |
25 , m_displayItemType(displayItemType) | 25 , m_displayItemType(displayItemType) |
26 , m_bounds(bounds) | 26 , m_bounds(bounds) |
27 , m_canUseCachedDrawing(false) | 27 , m_canUseCachedDrawing(false) |
28 { | 28 { |
29 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) | 29 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) |
30 return; | 30 return; |
31 | 31 |
32 #if ENABLE(ASSERT) | 32 #if ENABLE(ASSERT) |
33 ASSERT(!s_inDrawingRecorder); | 33 ASSERT(!s_inDrawingRecorder); |
34 s_inDrawingRecorder = true; | 34 s_inDrawingRecorder = true; |
35 #endif | 35 #endif |
36 | 36 |
37 m_canUseCachedDrawing = context->displayItemList()->clientCacheIsValid(displ
ayItemClient); | 37 if (cachePolicy != DisableCache) |
| 38 m_canUseCachedDrawing = context->displayItemList()->clientCacheIsValid(d
isplayItemClient); |
| 39 |
38 // FIXME: beginRecording only if !m_canUseCachedDrawing or ENABLE(ASSERT) | 40 // FIXME: beginRecording only if !m_canUseCachedDrawing or ENABLE(ASSERT) |
39 // after all painters call canUseCachedDrawing(). | 41 // after all painters call canUseCachedDrawing(). |
40 m_context->beginRecording(bounds); | 42 m_context->beginRecording(bounds); |
41 } | 43 } |
42 | 44 |
43 DrawingRecorder::~DrawingRecorder() | 45 DrawingRecorder::~DrawingRecorder() |
44 { | 46 { |
45 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) | 47 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) |
46 return; | 48 return; |
47 | 49 |
(...skipping 24 matching lines...) Expand all Loading... |
72 } | 74 } |
73 | 75 |
74 #ifndef NDEBUG | 76 #ifndef NDEBUG |
75 void DrawingRecorder::setClientDebugString(const WTF::String& clientDebugString) | 77 void DrawingRecorder::setClientDebugString(const WTF::String& clientDebugString) |
76 { | 78 { |
77 m_clientDebugString = clientDebugString; | 79 m_clientDebugString = clientDebugString; |
78 } | 80 } |
79 #endif | 81 #endif |
80 | 82 |
81 } // namespace blink | 83 } // namespace blink |
OLD | NEW |