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

Side by Side Diff: ui/gfx/canvas.cc

Issue 2716213002: ui: Fix cc/paint skia type mismatches (Closed)
Patch Set: Created 3 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/canvas.h" 5 #include "ui/gfx/canvas.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 void Canvas::DrawRect(const Rect& rect, const cc::PaintFlags& flags) { 284 void Canvas::DrawRect(const Rect& rect, const cc::PaintFlags& flags) {
285 DrawRect(RectF(rect), flags); 285 DrawRect(RectF(rect), flags);
286 } 286 }
287 287
288 void Canvas::DrawRect(const RectF& rect, const cc::PaintFlags& flags) { 288 void Canvas::DrawRect(const RectF& rect, const cc::PaintFlags& flags) {
289 canvas_->drawRect(RectFToSkRect(rect), flags); 289 canvas_->drawRect(RectFToSkRect(rect), flags);
290 } 290 }
291 291
292 void Canvas::DrawPoint(const Point& p1, const cc::PaintFlags& flags) {
293 DrawPoint(PointF(p1), flags);
294 }
295
296 void Canvas::DrawPoint(const PointF& p1, const cc::PaintFlags& flags) {
297 canvas_->drawPoint(SkFloatToScalar(p1.x()), SkFloatToScalar(p1.y()), flags);
298 }
299
300 void Canvas::DrawLine(const Point& p1, const Point& p2, SkColor color) { 292 void Canvas::DrawLine(const Point& p1, const Point& p2, SkColor color) {
301 DrawLine(PointF(p1), PointF(p2), color); 293 DrawLine(PointF(p1), PointF(p2), color);
302 } 294 }
303 295
304 void Canvas::DrawLine(const PointF& p1, const PointF& p2, SkColor color) { 296 void Canvas::DrawLine(const PointF& p1, const PointF& p2, SkColor color) {
305 cc::PaintFlags flags; 297 cc::PaintFlags flags;
306 flags.setColor(color); 298 flags.setColor(color);
307 flags.setStrokeWidth(SkIntToScalar(1)); 299 flags.setStrokeWidth(SkIntToScalar(1));
308 DrawLine(p1, p2, flags); 300 DrawLine(p1, p2, flags);
309 } 301 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); 602 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality);
611 flags.setShader(CreateImageRepShaderForScale( 603 flags.setShader(CreateImageRepShaderForScale(
612 image_rep, SkShader::kRepeat_TileMode, shader_scale, 604 image_rep, SkShader::kRepeat_TileMode, shader_scale,
613 remove_image_scale ? image_rep.scale() : 1.f)); 605 remove_image_scale ? image_rep.scale() : 1.f));
614 606
615 // The rect will be filled by the bitmap. 607 // The rect will be filled by the bitmap.
616 canvas_->drawRect(dest_rect, flags); 608 canvas_->drawRect(dest_rect, flags);
617 } 609 }
618 610
619 } // namespace gfx 611 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698