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

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

Issue 2689273002: Fix appearance of header row separators in table view at fractional (Closed)
Patch Set: pkasting review Created 3 years, 10 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 | « ui/gfx/canvas.h ('k') | ui/views/controls/table/table_header.cc » ('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 (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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 DrawLine(PointF(p1), PointF(p2), flags); 314 DrawLine(PointF(p1), PointF(p2), flags);
315 } 315 }
316 316
317 void Canvas::DrawLine(const PointF& p1, 317 void Canvas::DrawLine(const PointF& p1,
318 const PointF& p2, 318 const PointF& p2,
319 const cc::PaintFlags& flags) { 319 const cc::PaintFlags& flags) {
320 canvas_->drawLine(SkFloatToScalar(p1.x()), SkFloatToScalar(p1.y()), 320 canvas_->drawLine(SkFloatToScalar(p1.x()), SkFloatToScalar(p1.y()),
321 SkFloatToScalar(p2.x()), SkFloatToScalar(p2.y()), flags); 321 SkFloatToScalar(p2.x()), SkFloatToScalar(p2.y()), flags);
322 } 322 }
323 323
324 void Canvas::DrawSharpLine(PointF p1, PointF p2, SkColor color) {
325 ScopedCanvas scoped(this);
326 float dsf = UndoDeviceScaleFactor();
327 p1.Scale(dsf);
328 p2.Scale(dsf);
329
330 cc::PaintFlags flags;
331 flags.setColor(color);
332 flags.setStrokeWidth(SkFloatToScalar(std::floor(dsf)));
333
334 DrawLine(p1, p2, flags);
335 }
336
324 void Canvas::DrawCircle(const Point& center_point, 337 void Canvas::DrawCircle(const Point& center_point,
325 int radius, 338 int radius,
326 const cc::PaintFlags& flags) { 339 const cc::PaintFlags& flags) {
327 DrawCircle(PointF(center_point), radius, flags); 340 DrawCircle(PointF(center_point), radius, flags);
328 } 341 }
329 342
330 void Canvas::DrawCircle(const PointF& center_point, 343 void Canvas::DrawCircle(const PointF& center_point,
331 float radius, 344 float radius,
332 const cc::PaintFlags& flags) { 345 const cc::PaintFlags& flags) {
333 canvas_->drawCircle(SkFloatToScalar(center_point.x()), 346 canvas_->drawCircle(SkFloatToScalar(center_point.x()),
(...skipping 19 matching lines...) Expand all
353 } 366 }
354 367
355 void Canvas::DrawFocusRect(const Rect& rect) { 368 void Canvas::DrawFocusRect(const Rect& rect) {
356 DrawFocusRect(RectF(rect)); 369 DrawFocusRect(RectF(rect));
357 } 370 }
358 371
359 void Canvas::DrawFocusRect(const RectF& rect) { 372 void Canvas::DrawFocusRect(const RectF& rect) {
360 DrawDashedRect(rect, SK_ColorGRAY); 373 DrawDashedRect(rect, SK_ColorGRAY);
361 } 374 }
362 375
363 void Canvas::DrawSolidFocusRect(const RectF& rect, 376 void Canvas::DrawSolidFocusRect(RectF rect, SkColor color, float thickness) {
364 SkColor color,
365 float thickness) {
366 cc::PaintFlags flags; 377 cc::PaintFlags flags;
367 flags.setColor(color); 378 flags.setColor(color);
368 flags.setStrokeWidth(SkFloatToScalar(thickness)); 379 flags.setStrokeWidth(SkFloatToScalar(thickness));
369 flags.setStyle(cc::PaintFlags::kStroke_Style); 380 flags.setStyle(cc::PaintFlags::kStroke_Style);
370 gfx::RectF draw_rect = rect; 381 rect.Inset(gfx::InsetsF(thickness / 2));
371 draw_rect.Inset(gfx::InsetsF(thickness / 2)); 382 DrawRect(rect, flags);
372 DrawRect(draw_rect, flags);
373 } 383 }
374 384
375 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y) { 385 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y) {
376 cc::PaintFlags flags; 386 cc::PaintFlags flags;
377 DrawImageInt(image, x, y, flags); 387 DrawImageInt(image, x, y, flags);
378 } 388 }
379 389
380 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y, uint8_t a) { 390 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y, uint8_t a) {
381 cc::PaintFlags flags; 391 cc::PaintFlags flags;
382 flags.setAlpha(a); 392 flags.setAlpha(a);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); 610 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality);
601 flags.setShader(CreateImageRepShaderForScale( 611 flags.setShader(CreateImageRepShaderForScale(
602 image_rep, SkShader::kRepeat_TileMode, shader_scale, 612 image_rep, SkShader::kRepeat_TileMode, shader_scale,
603 remove_image_scale ? image_rep.scale() : 1.f)); 613 remove_image_scale ? image_rep.scale() : 1.f));
604 614
605 // The rect will be filled by the bitmap. 615 // The rect will be filled by the bitmap.
606 canvas_->drawRect(dest_rect, flags); 616 canvas_->drawRect(dest_rect, flags);
607 } 617 }
608 618
609 } // namespace gfx 619 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/views/controls/table/table_header.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698