Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp

Issue 1497873002: Make DisplayItemClient an interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/PaintController.h" 12 #include "platform/graphics/paint/PaintController.h"
13 #include "third_party/skia/include/core/SkPicture.h" 13 #include "third_party/skia/include/core/SkPicture.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 bool DrawingRecorder::useCachedDrawingIfPossible(GraphicsContext& context, const DisplayItemClientWrapper& client, DisplayItem::Type type) 17 bool DrawingRecorder::useCachedDrawingIfPossible(GraphicsContext& context, const DisplayItemClient& client, DisplayItem::Type type)
18 { 18 {
19 ASSERT(DisplayItem::isDrawingType(type)); 19 ASSERT(DisplayItem::isDrawingType(type));
20 20
21 if (!context.paintController().clientCacheIsValid(client.displayItemClient() )) 21 if (!context.paintController().clientCacheIsValid(client))
22 return false; 22 return false;
23 23
24 context.paintController().createAndAppend<CachedDisplayItem>(client, Display Item::drawingTypeToCachedDrawingType(type)); 24 context.paintController().createAndAppend<CachedDisplayItem>(client, Display Item::drawingTypeToCachedDrawingType(type));
25 25
26 #if ENABLE(ASSERT) 26 #if ENABLE(ASSERT)
27 // When under-invalidation checking is enabled, we output CachedDrawing disp lay item 27 // When under-invalidation checking is enabled, we output CachedDrawing disp lay item
28 // followed by the display item containing forced painting. 28 // followed by the display item containing forced painting.
29 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) 29 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled())
30 return false; 30 return false;
31 #endif 31 #endif
32 32
33 return true; 33 return true;
34 } 34 }
35 35
36 DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClie ntWrapper& displayItemClient, DisplayItem::Type displayItemType, const FloatRect & cullRect) 36 DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClie nt& displayItemClient, DisplayItem::Type displayItemType, const FloatRect& cullR ect)
37 : m_context(context) 37 : m_context(context)
38 , m_displayItemClient(displayItemClient) 38 , m_displayItemClient(displayItemClient)
39 , m_displayItemType(displayItemType) 39 , m_displayItemType(displayItemType)
40 #if ENABLE(ASSERT) 40 #if ENABLE(ASSERT)
41 , m_displayItemPosition(m_context.paintController().newDisplayItemList().siz e()) 41 , m_displayItemPosition(m_context.paintController().newDisplayItemList().siz e())
42 , m_underInvalidationCheckingMode(DrawingDisplayItem::CheckPicture) 42 , m_underInvalidationCheckingMode(DrawingDisplayItem::CheckPicture)
43 #endif 43 #endif
44 { 44 {
45 if (context.paintController().displayItemConstructionIsDisabled()) 45 if (context.paintController().displayItemConstructionIsDisabled())
46 return; 46 return;
47 47
48 // Must check DrawingRecorder::useCachedDrawingIfPossible before creating th e DrawingRecorder. 48 // Must check DrawingRecorder::useCachedDrawingIfPossible before creating th e DrawingRecorder.
49 ASSERT((RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && conte xt.paintController().paintOffsetWasInvalidated(displayItemClient.displayItemClie nt())) 49 ASSERT((RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && conte xt.paintController().paintOffsetWasInvalidated(displayItemClient))
50 || RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled () 50 || RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled ()
51 || !useCachedDrawingIfPossible(m_context, m_displayItemClient, m_display ItemType)); 51 || !useCachedDrawingIfPossible(m_context, m_displayItemClient, m_display ItemType));
52 52
53 ASSERT(DisplayItem::isDrawingType(displayItemType)); 53 ASSERT(DisplayItem::isDrawingType(displayItemType));
54 54
55 #if ENABLE(ASSERT) 55 #if ENABLE(ASSERT)
56 context.setInDrawingRecorder(true); 56 context.setInDrawingRecorder(true);
57 #endif 57 #endif
58 58
59 context.beginRecording(cullRect); 59 context.beginRecording(cullRect);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 m_context.paintController().createAndAppend<DrawingDisplayItem>(m_displayIte mClient 91 m_context.paintController().createAndAppend<DrawingDisplayItem>(m_displayIte mClient
92 , m_displayItemType 92 , m_displayItemType
93 , m_context.endRecording() 93 , m_context.endRecording()
94 #if ENABLE(ASSERT) 94 #if ENABLE(ASSERT)
95 , m_underInvalidationCheckingMode 95 , m_underInvalidationCheckingMode
96 #endif 96 #endif
97 ); 97 );
98 } 98 }
99 99
100 } // namespace blink 100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698