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

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

Issue 1214833004: Split Size into Size and Offset. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/engine/core/painting/Canvas.h ('k') | sky/engine/core/painting/Canvas.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "math.h" 5 #include "math.h"
6 6
7 #include "sky/engine/core/painting/Canvas.h" 7 #include "sky/engine/core/painting/Canvas.h"
8 8
9 #include "sky/engine/core/dom/Document.h" 9 #include "sky/engine/core/dom/Document.h"
10 #include "sky/engine/core/dom/Element.h" 10 #include "sky/engine/core/dom/Element.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 m_canvas->clipRRect(rrect->rrect()); 112 m_canvas->clipRRect(rrect->rrect());
113 } 113 }
114 114
115 void Canvas::clipPath(const CanvasPath* path) 115 void Canvas::clipPath(const CanvasPath* path)
116 { 116 {
117 if (!m_canvas) 117 if (!m_canvas)
118 return; 118 return;
119 m_canvas->clipPath(path->path()); 119 m_canvas->clipPath(path->path());
120 } 120 }
121 121
122 void Canvas::drawLine(float x0, float y0, float x1, float y1, const Paint* paint ) 122 void Canvas::drawLine(const Point& p1, const Point& p2, const Paint* paint)
123 { 123 {
124 if (!m_canvas) 124 if (!m_canvas)
125 return; 125 return;
126 ASSERT(paint); 126 ASSERT(paint);
127 m_canvas->drawLine(x0, y0, x1, y1, paint->paint()); 127 m_canvas->drawLine(p1.sk_point.x(), p1.sk_point.y(), p2.sk_point.x(), p2.sk_ point.y(), paint->paint());
128 } 128 }
129 129
130 void Canvas::drawPicture(Picture* picture) 130 void Canvas::drawPicture(Picture* picture)
131 { 131 {
132 if (!m_canvas) 132 if (!m_canvas)
133 return; 133 return;
134 ASSERT(picture); 134 ASSERT(picture);
135 m_canvas->drawPicture(picture->toSkia()); 135 m_canvas->drawPicture(picture->toSkia());
136 } 136 }
137 137
(...skipping 23 matching lines...) Expand all
161 } 161 }
162 162
163 void Canvas::drawOval(const Rect& rect, const Paint* paint) 163 void Canvas::drawOval(const Rect& rect, const Paint* paint)
164 { 164 {
165 if (!m_canvas) 165 if (!m_canvas)
166 return; 166 return;
167 ASSERT(paint); 167 ASSERT(paint);
168 m_canvas->drawOval(rect.sk_rect, paint->paint()); 168 m_canvas->drawOval(rect.sk_rect, paint->paint());
169 } 169 }
170 170
171 void Canvas::drawCircle(float x, float y, float radius, const Paint* paint) 171 void Canvas::drawCircle(const Point& c, float radius, const Paint* paint)
172 { 172 {
173 if (!m_canvas) 173 if (!m_canvas)
174 return; 174 return;
175 ASSERT(paint); 175 ASSERT(paint);
176 m_canvas->drawCircle(x, y, radius, paint->paint()); 176 m_canvas->drawCircle(c.sk_point.x(), c.sk_point.y(), radius, paint->paint()) ;
177 } 177 }
178 178
179 void Canvas::drawPath(const CanvasPath* path, const Paint* paint) 179 void Canvas::drawPath(const CanvasPath* path, const Paint* paint)
180 { 180 {
181 if (!m_canvas) 181 if (!m_canvas)
182 return; 182 return;
183 ASSERT(path); 183 ASSERT(path);
184 ASSERT(paint); 184 ASSERT(paint);
185 m_canvas->drawPath(path->path(), paint->paint()); 185 m_canvas->drawPath(path->path(), paint->paint());
186 } 186 }
187 187
188 void Canvas::drawImage(const CanvasImage* image, 188 void Canvas::drawImage(const CanvasImage* image, const Point& p, const Paint* pa int) {
189 float x,
190 float y,
191 const Paint* paint) {
192 if (!m_canvas) 189 if (!m_canvas)
193 return; 190 return;
194 ASSERT(image); 191 ASSERT(image);
195 m_canvas->drawBitmap(image->bitmap(), x, y, &paint->paint()); 192 m_canvas->drawBitmap(image->bitmap(), p.sk_point.x(), p.sk_point.y(), &paint ->paint());
196 } 193 }
197 194
198 void Canvas::drawImageRect(const CanvasImage* image, Rect& src, Rect& dst, Paint * paint) { 195 void Canvas::drawImageRect(const CanvasImage* image, Rect& src, Rect& dst, Paint * paint) {
199 if (!m_canvas) 196 if (!m_canvas)
200 return; 197 return;
201 ASSERT(image); 198 ASSERT(image);
202 m_canvas->drawBitmapRectToRect(image->bitmap(), &src.sk_rect, dst.sk_rect, & paint->paint()); 199 m_canvas->drawBitmapRectToRect(image->bitmap(), &src.sk_rect, dst.sk_rect, & paint->paint());
203 } 200 }
204 201
205 } // namespace blink 202 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/painting/Canvas.h ('k') | sky/engine/core/painting/Canvas.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698