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

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

Issue 1160183003: Use SkPictureBuilder in SVGShapePainter, and generalize SkPictureBuilder. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DisplayItemListContextRecorder_h
6 #define DisplayItemListContextRecorder_h
7
8 #include "platform/RuntimeEnabledFeatures.h"
9 #include "platform/graphics/GraphicsContext.h"
10 #include "platform/graphics/paint/DisplayItemList.h"
11 #include "wtf/OwnPtr.h"
12
13 namespace blink {
14
15 class DisplayItemListContextRecorder {
16 WTF_MAKE_NONCOPYABLE(DisplayItemListContextRecorder);
17 STACK_ALLOCATED();
18 public:
19 DisplayItemListContextRecorder(GraphicsContext& context)
20 : m_initialContext(context)
21 {
22 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
23 return;
24
25 m_displayItemList = DisplayItemList::create();
26 m_displayItemListContext = adoptPtr(new GraphicsContext(m_displayItemLis t.get(),
27 context.contextDisabled() ? GraphicsContext::FullyDisabled : Graphic sContext::NothingDisabled));
28 m_displayItemListContext->setDeviceScaleFactor(context.deviceScaleFactor ());
29 m_displayItemListContext->setPrinting(context.printing());
30 }
31
32 ~DisplayItemListContextRecorder()
33 {
34 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
35 return;
36
37 ASSERT(m_displayItemList);
38 m_displayItemList->commitNewDisplayItemsAndReplay(m_initialContext);
39 }
40
41 GraphicsContext& context() const { return m_displayItemList ? *m_displayItem ListContext : m_initialContext; }
42
43 private:
44 GraphicsContext& m_initialContext;
45 OwnPtr<DisplayItemList> m_displayItemList;
46 OwnPtr<GraphicsContext> m_displayItemListContext;
47 };
48
49 } // namespace blink
50
51 #endif // DisplayItemListContextRecorder_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/GeneratedImage.cpp ('k') | Source/platform/graphics/paint/SkPictureBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698