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

Side by Side Diff: Source/platform/graphics/paint/SkPictureBuilder.h

Issue 1087893004: Change SkPictureBuilder strategy to not create nested recorders (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 8 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
« no previous file with comments | « Source/core/paint/SVGMaskPainter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 SkPictureBuilder_h 5 #ifndef SkPictureBuilder_h
6 #define SkPictureBuilder_h 6 #define SkPictureBuilder_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/paint/DisplayItemList.h" 10 #include "platform/graphics/paint/DisplayItemList.h"
11 #include "wtf/OwnPtr.h" 11 #include "wtf/OwnPtr.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 // When slimming paint ships we can remove this SkPicture abstraction and 15 // When slimming paint ships we can remove this SkPicture abstraction and
16 // rely on DisplayItemList here. 16 // rely on DisplayItemList here.
17 class SkPictureBuilder { 17 class SkPictureBuilder {
18 WTF_MAKE_NONCOPYABLE(SkPictureBuilder); 18 WTF_MAKE_NONCOPYABLE(SkPictureBuilder);
19 STACK_ALLOCATED(); 19 STACK_ALLOCATED();
20 public: 20 public:
21 SkPictureBuilder(const FloatRect& bounds) 21 SkPictureBuilder(const FloatRect& bounds)
22 : m_bounds(bounds)
22 { 23 {
23 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 24 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
24 m_displayItemList = DisplayItemList::create(); 25 m_displayItemList = DisplayItemList::create();
25 m_context = adoptPtr(new GraphicsContext(m_displayItemList.get())); 26 m_context = adoptPtr(new GraphicsContext(m_displayItemList.get()));
26 } else { 27 } else {
27 m_context = GraphicsContext::deprecatedCreateWithCanvas(nullptr); 28 m_context = GraphicsContext::deprecatedCreateWithCanvas(nullptr);
29 m_context->beginRecording(m_bounds);
28 } 30 }
29 m_context->beginRecording(bounds);
30 } 31 }
31 32
32 GraphicsContext& context() { return *m_context; } 33 GraphicsContext& context() { return *m_context; }
33 34
34 PassRefPtr<const SkPicture> endRecording() 35 PassRefPtr<const SkPicture> endRecording()
35 { 36 {
36 if (m_displayItemList) 37 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
37 m_displayItemList->commitNewDisplayItemsAndReplay(*m_context); 38 return m_context->endRecording();
39
40 m_context->beginRecording(m_bounds);
41 m_displayItemList->commitNewDisplayItemsAndReplay(*m_context);
38 return m_context->endRecording(); 42 return m_context->endRecording();
39 } 43 }
40 44
41 private: 45 private:
42 OwnPtr<DisplayItemList> m_displayItemList; 46 OwnPtr<DisplayItemList> m_displayItemList;
43 OwnPtr<GraphicsContext> m_context; 47 OwnPtr<GraphicsContext> m_context;
48 FloatRect m_bounds;
44 }; 49 };
45 50
46 } // namespace blink 51 } // namespace blink
47 52
48 #endif // SkPictureBuilder_h 53 #endif // SkPictureBuilder_h
OLDNEW
« no previous file with comments | « Source/core/paint/SVGMaskPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698