| OLD | NEW |
| 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 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/painting/PaintingContext.h" | 6 #include "sky/engine/core/painting/PaintingContext.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/dom/Document.h" | 8 #include "sky/engine/core/dom/Document.h" |
| 9 #include "sky/engine/core/dom/Element.h" | 9 #include "sky/engine/core/dom/Element.h" |
| 10 #include "sky/engine/core/painting/PaintingTasks.h" | 10 #include "sky/engine/core/painting/PaintingTasks.h" |
| 11 #include "sky/engine/platform/geometry/IntRect.h" | 11 #include "sky/engine/platform/geometry/IntRect.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 PassRefPtr<PaintingContext> PaintingContext::create(PassRefPtr<Element> element,
const FloatSize& size) | 15 PassRefPtr<PaintingContext> PaintingContext::create(PassRefPtr<Element> element,
const FloatSize& size) |
| 16 { | 16 { |
| 17 return adoptRef(new PaintingContext(element, size)); | 17 return adoptRef(new PaintingContext(element, size)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 // TODO(iansf): Get rid of PaintingContext, which is only relevant to DOM-based |
| 21 // Sky apps, which are now deprecated. For now, make the compiler |
| 22 // happy by constructing Canvas with a nullptr. |
| 20 PaintingContext::PaintingContext(PassRefPtr<Element> element, const FloatSize& s
ize) | 23 PaintingContext::PaintingContext(PassRefPtr<Element> element, const FloatSize& s
ize) |
| 21 : Canvas(size) | 24 : Canvas(nullptr) |
| 22 , m_element(element) | 25 , m_element(element) |
| 23 { | 26 { |
| 24 } | 27 } |
| 25 | 28 |
| 26 PaintingContext::~PaintingContext() | 29 PaintingContext::~PaintingContext() |
| 27 { | 30 { |
| 28 } | 31 } |
| 29 | 32 |
| 30 void PaintingContext::commit() | 33 void PaintingContext::commit() |
| 31 { | 34 { |
| 32 if (!isRecording()) | |
| 33 return; | |
| 34 PaintingTasks::enqueueCommit(m_element, finishRecording()); | |
| 35 m_element->document().scheduleVisualUpdate(); | 35 m_element->document().scheduleVisualUpdate(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace blink | 38 } // namespace blink |
| OLD | NEW |