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

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

Issue 78803002: Fixing focus highlight on high DPI devices for accessibility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/message_center/message_center.gyp » ('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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 325 }
326 326
327 void Canvas::DrawPath(const SkPath& path, const SkPaint& paint) { 327 void Canvas::DrawPath(const SkPath& path, const SkPaint& paint) {
328 canvas_->drawPath(path, paint); 328 canvas_->drawPath(path, paint);
329 } 329 }
330 330
331 void Canvas::DrawFocusRect(const Rect& rect) { 331 void Canvas::DrawFocusRect(const Rect& rect) {
332 DrawDashedRect(rect, SK_ColorGRAY); 332 DrawDashedRect(rect, SK_ColorGRAY);
333 } 333 }
334 334
335 void Canvas::DrawSolidFocusRect(const Rect& rect, SkColor color) {
336 SkPaint paint;
337 paint.setColor(color);
338 paint.setStrokeWidth(SkIntToScalar(1));
339 // Note: We cannot use DrawRect since it would create a path and fill it which
340 // would cause problems near the edge of the canvas.
341 int x1 = std::min(rect.x(), rect.right());
342 int x2 = std::max(rect.x(), rect.right());
343 int y1 = std::min(rect.y(), rect.bottom());
344 int y2 = std::max(rect.y(), rect.bottom());
345 DrawLine(Point(x1, y1), Point(x2, y1), paint);
346 DrawLine(Point(x1, y2), Point(x2, y2), paint);
347 DrawLine(Point(x1, y1), Point(x1, y2), paint);
348 DrawLine(Point(x2, y1), Point(x2, y2 + 1), paint);
349 }
350
335 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y) { 351 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y) {
336 SkPaint paint; 352 SkPaint paint;
337 DrawImageInt(image, x, y, paint); 353 DrawImageInt(image, x, y, paint);
338 } 354 }
339 355
340 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y, uint8 a) { 356 void Canvas::DrawImageInt(const ImageSkia& image, int x, int y, uint8 a) {
341 SkPaint paint; 357 SkPaint paint;
342 paint.setAlpha(a); 358 paint.setAlpha(a);
343 DrawImageInt(image, x, y, paint); 359 DrawImageInt(image, x, y, paint);
344 } 360 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 650
635 float bitmap_scale = image_rep.scale(); 651 float bitmap_scale = image_rep.scale();
636 if (scale_x < bitmap_scale || scale_y < bitmap_scale) 652 if (scale_x < bitmap_scale || scale_y < bitmap_scale)
637 const_cast<SkBitmap&>(image_rep.sk_bitmap()).buildMipMap(); 653 const_cast<SkBitmap&>(image_rep.sk_bitmap()).buildMipMap();
638 } 654 }
639 655
640 return image_rep; 656 return image_rep;
641 } 657 }
642 658
643 } // namespace gfx 659 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/message_center/message_center.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698