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

Side by Side Diff: Source/core/paint/DrawingRecorder.cpp

Issue 723103002: Revert "Move ViewDisplayList to GraphicsLayer" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/DrawingRecorder.h ('k') | Source/core/paint/DrawingRecorderTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/paint/DrawingRecorder.h" 6 #include "core/paint/DrawingRecorder.h"
7 7
8 #include "core/rendering/RenderLayer.h"
9 #include "core/rendering/RenderObject.h" 8 #include "core/rendering/RenderObject.h"
9 #include "core/rendering/RenderView.h"
10 #include "platform/RuntimeEnabledFeatures.h" 10 #include "platform/RuntimeEnabledFeatures.h"
11 #include "platform/graphics/DisplayList.h"
12 #include "platform/graphics/GraphicsContext.h" 11 #include "platform/graphics/GraphicsContext.h"
13 #include "platform/graphics/GraphicsLayer.h"
14 #include "platform/graphics/paint/DisplayItemList.h"
15 #include "platform/graphics/paint/DrawingDisplayItem.h"
16 12
17 namespace blink { 13 namespace blink {
18 14
15 void DrawingDisplayItem::replay(GraphicsContext* context)
16 {
17 context->drawPicture(m_picture.get(), m_location);
18 }
19
19 #if ENABLE(ASSERT) 20 #if ENABLE(ASSERT)
20 static bool s_inDrawingRecorder = false; 21 static bool s_inDrawingRecorder = false;
21 #endif 22 #endif
22 23
23 DrawingRecorder::DrawingRecorder(GraphicsContext* context, const RenderObject* r enderer, PaintPhase phase, const FloatRect& clip) 24 DrawingRecorder::DrawingRecorder(GraphicsContext* context, const RenderObject* r enderer, PaintPhase phase, const FloatRect& clip)
24 : m_context(context) 25 : m_context(context)
25 , m_renderer(renderer) 26 , m_renderer(renderer)
26 , m_phase(phase) 27 , m_phase(phase)
27 , m_bounds(clip) 28 , m_bounds(clip)
28 { 29 {
(...skipping 15 matching lines...) Expand all
44 45
45 #if ENABLE(ASSERT) 46 #if ENABLE(ASSERT)
46 s_inDrawingRecorder = false; 47 s_inDrawingRecorder = false;
47 #endif 48 #endif
48 49
49 RefPtr<DisplayList> displayList = m_context->endRecording(); 50 RefPtr<DisplayList> displayList = m_context->endRecording();
50 if (!displayList->picture()->approximateOpCount()) 51 if (!displayList->picture()->approximateOpCount())
51 return; 52 return;
52 ASSERT(displayList->bounds() == m_bounds); 53 ASSERT(displayList->bounds() == m_bounds);
53 OwnPtr<DrawingDisplayItem> drawingItem = adoptPtr( 54 OwnPtr<DrawingDisplayItem> drawingItem = adoptPtr(
54 new DrawingDisplayItem(m_renderer->displayItemClient(), (DisplayItem::Ty pe)m_phase, displayList->picture(), m_bounds.location())); 55 new DrawingDisplayItem(displayList->picture(), m_bounds.location(), m_ph ase, m_renderer));
56 ASSERT(m_renderer->view());
57 m_renderer->view()->viewDisplayList().add(drawingItem.release());
58 }
59
55 #ifndef NDEBUG 60 #ifndef NDEBUG
56 if (!m_renderer) 61 WTF::String DrawingDisplayItem::asDebugString() const
57 drawingItem->setClientDebugString("nullptr"); 62 {
58 else if (m_renderer->node()) 63 return String::format("{%s, type: \"%s\", location: [%f,%f]}",
59 drawingItem->setClientDebugString(String::format("nodeName: \"%s\", rend erer: \"%p\"", m_renderer->node()->nodeName().utf8().data(), m_renderer)); 64 rendererDebugString(renderer()).utf8().data(), typeAsDebugString(type()) .utf8().data(),
60 else 65 m_location.x(), m_location.y());
61 drawingItem->setClientDebugString(String::format("renderer: \"%p\"", m_r enderer)); 66 }
62 #endif 67 #endif
63 68
64 if (RenderLayer* container = m_renderer->enclosingLayer()->enclosingLayerFor PaintInvalidationCrossingFrameBoundaries())
65 container->graphicsLayerBacking()->displayItemList().add(drawingItem.rel ease());
66 }
67
68 } // namespace blink 69 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/DrawingRecorder.h ('k') | Source/core/paint/DrawingRecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698