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

Side by Side Diff: sky/engine/core/painting/Canvas.cpp

Issue 1161813005: Implement a simple checkbox in Sky’s fn2 components library (Closed) Base URL: git@github.com:domokit/mojo.git@master
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
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 #include "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/painting/Canvas.h" 6 #include "sky/engine/core/painting/Canvas.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/CanvasImage.h" 10 #include "sky/engine/core/painting/CanvasImage.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 void Canvas::clipRect(const Rect& rect) 110 void Canvas::clipRect(const Rect& rect)
111 { 111 {
112 if (!m_canvas) 112 if (!m_canvas)
113 return; 113 return;
114 ASSERT(m_displayList->isRecording()); 114 ASSERT(m_displayList->isRecording());
115 m_canvas->clipRect(rect.sk_rect); 115 m_canvas->clipRect(rect.sk_rect);
116 } 116 }
117 117
118 void Canvas::drawLine(float x0, float y0, float x1, float y1, const Paint* paint )
119 {
120 if (!m_canvas)
121 return;
122 ASSERT(paint);
123 ASSERT(m_displayList->isRecording());
124 m_canvas->drawLine(x0, y0, x1, y1, paint->paint());
125 }
126
118 void Canvas::drawPicture(Picture* picture) 127 void Canvas::drawPicture(Picture* picture)
119 { 128 {
120 if (!m_canvas) 129 if (!m_canvas)
121 return; 130 return;
122 ASSERT(picture); 131 ASSERT(picture);
123 ASSERT(m_displayList->isRecording()); 132 ASSERT(m_displayList->isRecording());
124 m_canvas->drawPicture(picture->toSkia()); 133 m_canvas->drawPicture(picture->toSkia());
125 } 134 }
126 135
127 void Canvas::drawPaint(const Paint* paint) 136 void Canvas::drawPaint(const Paint* paint)
128 { 137 {
129 if (!m_canvas) 138 if (!m_canvas)
130 return; 139 return;
131 ASSERT(paint); 140 ASSERT(paint);
132 ASSERT(m_displayList->isRecording()); 141 ASSERT(m_displayList->isRecording());
133 m_canvas->drawPaint(paint->paint()); 142 m_canvas->drawPaint(paint->paint());
134 } 143 }
135 144
136 void Canvas::drawRect(const Rect& rect, const Paint* paint) 145 void Canvas::drawRect(const Rect& rect, const Paint* paint)
137 { 146 {
138 if (!m_canvas) 147 if (!m_canvas)
139 return; 148 return;
140 ASSERT(paint); 149 ASSERT(paint);
141 ASSERT(m_displayList->isRecording()); 150 ASSERT(m_displayList->isRecording());
142 m_canvas->drawRect(rect.sk_rect, paint->paint()); 151 m_canvas->drawRect(rect.sk_rect, paint->paint());
143 } 152 }
144 153
154 void Canvas::drawRRect(const RRect* rrect, const Paint* paint)
155 {
156 if (!m_canvas)
157 return;
158 ASSERT(rrect);
159 ASSERT(paint);
160 ASSERT(m_displayList->isRecording());
161 m_canvas->drawRRect(rrect->rrect(), paint->paint());
162 }
163
145 void Canvas::drawOval(const Rect& rect, const Paint* paint) 164 void Canvas::drawOval(const Rect& rect, const Paint* paint)
146 { 165 {
147 if (!m_canvas) 166 if (!m_canvas)
148 return; 167 return;
149 ASSERT(paint); 168 ASSERT(paint);
150 ASSERT(m_displayList->isRecording()); 169 ASSERT(m_displayList->isRecording());
151 m_canvas->drawOval(rect.sk_rect, paint->paint()); 170 m_canvas->drawOval(rect.sk_rect, paint->paint());
152 } 171 }
153 172
154 void Canvas::drawCircle(float x, float y, float radius, const Paint* paint) 173 void Canvas::drawCircle(float x, float y, float radius, const Paint* paint)
(...skipping 29 matching lines...) Expand all
184 PassRefPtr<DisplayList> Canvas::finishRecording() 203 PassRefPtr<DisplayList> Canvas::finishRecording()
185 { 204 {
186 if (!isRecording()) 205 if (!isRecording())
187 return nullptr; 206 return nullptr;
188 m_canvas = nullptr; 207 m_canvas = nullptr;
189 m_displayList->endRecording(); 208 m_displayList->endRecording();
190 return m_displayList.release(); 209 return m_displayList.release();
191 } 210 }
192 211
193 } // namespace blink 212 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698