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

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

Issue 892293002: First version of new merge algorithm (not enabled yet) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Traverse indices vector Created 5 years, 10 months 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
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/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 DrawingRecorder::DrawingRecorder(GraphicsContext* context, DisplayItemClient dis playItemClient, DisplayItem::Type displayItemType, const FloatRect& bounds) 18 DrawingRecorder::DrawingRecorder(GraphicsContext* context, DisplayItemClient dis playItemClient, DisplayItem::Type displayItemType, const FloatRect& bounds)
19 : m_context(context) 19 : m_context(context)
20 , m_displayItemClient(displayItemClient) 20 , m_displayItemClient(displayItemClient)
21 , m_displayItemType(displayItemType) 21 , m_displayItemType(displayItemType)
22 , m_bounds(bounds)
23 , m_canUseCachedDrawing(false) 22 , m_canUseCachedDrawing(false)
24 { 23 {
25 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) 24 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
26 return; 25 return;
27 26
28 ASSERT(DisplayItem::isDrawingType(displayItemType)); 27 ASSERT(DisplayItem::isDrawingType(displayItemType));
29 #if ENABLE(ASSERT) 28 #if ENABLE(ASSERT)
30 context->setInDrawingRecorder(true); 29 context->setInDrawingRecorder(true);
31 #endif 30 #endif
32 ASSERT(context->displayItemList()); 31 ASSERT(context->displayItemList());
(...skipping 20 matching lines...) Expand all
53 52
54 if (m_canUseCachedDrawing) { 53 if (m_canUseCachedDrawing) {
55 #if ENABLE(ASSERT) 54 #if ENABLE(ASSERT)
56 RefPtr<const SkPicture> picture = m_context->endRecording(); 55 RefPtr<const SkPicture> picture = m_context->endRecording();
57 ASSERT(!picture || !picture->approximateOpCount()); 56 ASSERT(!picture || !picture->approximateOpCount());
58 #endif 57 #endif
59 displayItem = CachedDisplayItem::create(m_displayItemClient, DisplayItem ::drawingTypeToCachedType(m_displayItemType)); 58 displayItem = CachedDisplayItem::create(m_displayItemClient, DisplayItem ::drawingTypeToCachedType(m_displayItemType));
60 } else { 59 } else {
61 RefPtr<const SkPicture> picture = m_context->endRecording(); 60 RefPtr<const SkPicture> picture = m_context->endRecording();
62 if (!picture || !picture->approximateOpCount()) 61 if (!picture || !picture->approximateOpCount())
63 displayItem = DisplayItem::create(m_displayItemClient, m_displayItem Type); 62 return;
64 else 63 displayItem = DrawingDisplayItem::create(m_displayItemClient, m_displayI temType, picture);
65 displayItem = DrawingDisplayItem::create(m_displayItemClient, m_disp layItemType, picture);
66 } 64 }
67 65
68 #ifndef NDEBUG 66 #ifndef NDEBUG
69 displayItem->setClientDebugString(m_clientDebugString); 67 displayItem->setClientDebugString(m_clientDebugString);
70 #endif 68 #endif
71 69
72 m_context->displayItemList()->add(displayItem.release()); 70 m_context->displayItemList()->add(displayItem.release());
73 } 71 }
74 72
75 #ifndef NDEBUG 73 #ifndef NDEBUG
76 void DrawingRecorder::setClientDebugString(const WTF::String& clientDebugString) 74 void DrawingRecorder::setClientDebugString(const WTF::String& clientDebugString)
77 { 75 {
78 m_clientDebugString = clientDebugString; 76 m_clientDebugString = clientDebugString;
79 } 77 }
80 #endif 78 #endif
81 79
82 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698