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 "math.h" |
| 6 |
5 #include "sky/engine/config.h" | 7 #include "sky/engine/config.h" |
6 #include "sky/engine/core/painting/Canvas.h" | 8 #include "sky/engine/core/painting/Canvas.h" |
7 | 9 |
8 #include "sky/engine/core/dom/Document.h" | 10 #include "sky/engine/core/dom/Document.h" |
9 #include "sky/engine/core/dom/Element.h" | 11 #include "sky/engine/core/dom/Element.h" |
10 #include "sky/engine/core/painting/CanvasImage.h" | 12 #include "sky/engine/core/painting/CanvasImage.h" |
11 #include "sky/engine/core/painting/PaintingTasks.h" | 13 #include "sky/engine/core/painting/PaintingTasks.h" |
12 #include "sky/engine/platform/geometry/IntRect.h" | 14 #include "sky/engine/platform/geometry/IntRect.h" |
13 #include "third_party/skia/include/core/SkCanvas.h" | 15 #include "third_party/skia/include/core/SkCanvas.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 62 } |
61 | 63 |
62 void Canvas::scale(float sx, float sy) | 64 void Canvas::scale(float sx, float sy) |
63 { | 65 { |
64 if (!m_canvas) | 66 if (!m_canvas) |
65 return; | 67 return; |
66 ASSERT(m_displayList->isRecording()); | 68 ASSERT(m_displayList->isRecording()); |
67 m_canvas->scale(sx, sy); | 69 m_canvas->scale(sx, sy); |
68 } | 70 } |
69 | 71 |
70 void Canvas::rotateDegrees(float degrees) | 72 void Canvas::rotate(float radians) |
71 { | 73 { |
72 if (!m_canvas) | 74 if (!m_canvas) |
73 return; | 75 return; |
74 ASSERT(m_displayList->isRecording()); | 76 ASSERT(m_displayList->isRecording()); |
75 m_canvas->rotate(degrees); | 77 m_canvas->rotate(radians * 180.0/M_PI); |
76 } | 78 } |
77 | 79 |
78 void Canvas::skew(float sx, float sy) | 80 void Canvas::skew(float sx, float sy) |
79 { | 81 { |
80 if (!m_canvas) | 82 if (!m_canvas) |
81 return; | 83 return; |
82 ASSERT(m_displayList->isRecording()); | 84 ASSERT(m_displayList->isRecording()); |
83 m_canvas->skew(sx, sy); | 85 m_canvas->skew(sx, sy); |
84 } | 86 } |
85 | 87 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 PassRefPtr<DisplayList> Canvas::finishRecording() | 205 PassRefPtr<DisplayList> Canvas::finishRecording() |
204 { | 206 { |
205 if (!isRecording()) | 207 if (!isRecording()) |
206 return nullptr; | 208 return nullptr; |
207 m_canvas = nullptr; | 209 m_canvas = nullptr; |
208 m_displayList->endRecording(); | 210 m_displayList->endRecording(); |
209 return m_displayList.release(); | 211 return m_displayList.release(); |
210 } | 212 } |
211 | 213 |
212 } // namespace blink | 214 } // namespace blink |
OLD | NEW |