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

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

Issue 1145843003: Fix Slimming Paint WebGL printing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
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 DisplayItemListContextRecorder_h 5 #ifndef DisplayItemListContextRecorder_h
6 #define DisplayItemListContextRecorder_h 6 #define DisplayItemListContextRecorder_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 class DisplayItemListContextRecorder { 15 class DisplayItemListContextRecorder {
16 WTF_MAKE_NONCOPYABLE(DisplayItemListContextRecorder); 16 WTF_MAKE_NONCOPYABLE(DisplayItemListContextRecorder);
17 STACK_ALLOCATED(); 17 STACK_ALLOCATED();
18 public: 18 public:
19 DisplayItemListContextRecorder(GraphicsContext& context) 19 DisplayItemListContextRecorder(GraphicsContext& context)
20 : m_initialContext(context) 20 : m_initialContext(context)
21 { 21 {
22 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) 22 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
23 return; 23 return;
24 24
25 m_displayItemList = DisplayItemList::create(); 25 m_displayItemList = DisplayItemList::create();
26 m_displayItemListContext = adoptPtr(new GraphicsContext(m_displayItemLis t.get(), 26 m_displayItemListContext = adoptPtr(new GraphicsContext(m_displayItemLis t.get(),
27 context.contextDisabled() ? GraphicsContext::FullyDisabled : Graphic sContext::NothingDisabled)); 27 context.contextDisabled() ? GraphicsContext::FullyDisabled : Graphic sContext::NothingDisabled));
28 m_displayItemListContext->setAnnotationMode(context.annotationMode());
29 m_displayItemListContext->setDeviceScaleFactor(context.deviceScaleFactor ());
30 m_displayItemListContext->setPrinting(context.printing());
28 } 31 }
29 32
30 ~DisplayItemListContextRecorder() 33 ~DisplayItemListContextRecorder()
31 { 34 {
32 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) 35 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
33 return; 36 return;
34 37
35 ASSERT(m_displayItemList); 38 ASSERT(m_displayItemList);
36 m_displayItemList->commitNewDisplayItemsAndReplay(m_initialContext); 39 m_displayItemList->commitNewDisplayItemsAndReplay(m_initialContext);
37 } 40 }
38 41
39 GraphicsContext& context() const { return m_displayItemList ? *m_displayItem ListContext : m_initialContext; } 42 GraphicsContext& context() const { return m_displayItemList ? *m_displayItem ListContext : m_initialContext; }
40 43
41 private: 44 private:
42 GraphicsContext& m_initialContext; 45 GraphicsContext& m_initialContext;
43 OwnPtr<DisplayItemList> m_displayItemList; 46 OwnPtr<DisplayItemList> m_displayItemList;
44 OwnPtr<GraphicsContext> m_displayItemListContext; 47 OwnPtr<GraphicsContext> m_displayItemListContext;
45 }; 48 };
46 49
47 } // namespace blink 50 } // namespace blink
48 51
49 #endif // DisplayItemListContextRecorder_h 52 #endif // DisplayItemListContextRecorder_h
OLDNEW
« Source/platform/graphics/GraphicsContext.cpp ('K') | « Source/platform/graphics/GraphicsContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698