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/PictureRecorder.h" | 6 #include "sky/engine/core/painting/PictureRecorder.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" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 void Canvas::drawPicture(Picture* picture) | 114 void Canvas::drawPicture(Picture* picture) |
115 { | 115 { |
116 if (!m_canvas) | 116 if (!m_canvas) |
117 return; | 117 return; |
118 ASSERT(picture); | 118 ASSERT(picture); |
119 ASSERT(m_displayList->isRecording()); | 119 ASSERT(m_displayList->isRecording()); |
120 m_canvas->drawPicture(picture->displayList()->picture()); | 120 m_canvas->drawPicture(picture->displayList()->picture()); |
121 } | 121 } |
122 | 122 |
123 void Canvas::drawPaint(Paint* paint) | 123 void Canvas::drawPaint(const Paint* paint) |
124 { | 124 { |
125 if (!m_canvas) | 125 if (!m_canvas) |
126 return; | 126 return; |
127 ASSERT(paint); | 127 ASSERT(paint); |
128 ASSERT(m_displayList->isRecording()); | 128 ASSERT(m_displayList->isRecording()); |
129 m_canvas->drawPaint(paint->paint()); | 129 m_canvas->drawPaint(paint->paint()); |
130 } | 130 } |
131 | 131 |
132 void Canvas::drawRect(const Vector<float>& rect, const Paint* paint) | 132 void Canvas::drawRect(const Vector<float>& rect, const Paint* paint) |
133 { | 133 { |
134 if (!m_canvas) | 134 if (!m_canvas) |
135 return; | 135 return; |
136 ASSERT(paint); | 136 ASSERT(paint); |
137 ASSERT(m_displayList->isRecording()); | 137 ASSERT(m_displayList->isRecording()); |
138 m_canvas->drawRect(toSkRect(rect), paint->paint()); | 138 m_canvas->drawRect(toSkRect(rect), paint->paint()); |
139 } | 139 } |
140 | 140 |
141 void Canvas::drawOval(const Vector<float>& rect, const Paint* paint) | 141 void Canvas::drawOval(const Vector<float>& rect, const Paint* paint) |
142 { | 142 { |
143 if (!m_canvas) | 143 if (!m_canvas) |
144 return; | 144 return; |
145 ASSERT(paint); | 145 ASSERT(paint); |
146 ASSERT(m_displayList->isRecording()); | 146 ASSERT(m_displayList->isRecording()); |
147 m_canvas->drawOval(toSkRect(rect), paint->paint()); | 147 m_canvas->drawOval(toSkRect(rect), paint->paint()); |
148 } | 148 } |
149 | 149 |
150 void Canvas::drawCircle(float x, float y, float radius, Paint* paint) | 150 void Canvas::drawCircle(float x, float y, float radius, const Paint* paint) |
151 { | 151 { |
152 if (!m_canvas) | 152 if (!m_canvas) |
153 return; | 153 return; |
154 ASSERT(paint); | 154 ASSERT(paint); |
155 ASSERT(m_displayList->isRecording()); | 155 ASSERT(m_displayList->isRecording()); |
156 m_canvas->drawCircle(x, y, radius, paint->paint()); | 156 m_canvas->drawCircle(x, y, radius, paint->paint()); |
157 } | 157 } |
158 | 158 |
159 PassRefPtr<DisplayList> Canvas::finishRecording() | 159 PassRefPtr<DisplayList> Canvas::finishRecording() |
160 { | 160 { |
161 if (!isRecording()) | 161 if (!isRecording()) |
162 return nullptr; | 162 return nullptr; |
163 m_canvas = nullptr; | 163 m_canvas = nullptr; |
164 m_displayList->endRecording(); | 164 m_displayList->endRecording(); |
165 return m_displayList.release(); | 165 return m_displayList.release(); |
166 } | 166 } |
167 | 167 |
168 } // namespace blink | 168 } // namespace blink |
OLD | NEW |