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

Side by Side Diff: ui/views/controls/focusable_border.cc

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 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 | Annotate | Revision Log
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/views/controls/focusable_border.h" 5 #include "ui/views/controls/focusable_border.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/canvas_skia.h" 8 #include "ui/gfx/canvas_skia.h"
9 #include "ui/gfx/insets.h" 9 #include "ui/gfx/insets.h"
10 #include "ui/gfx/native_theme.h" 10 #include "ui/gfx/native_theme.h"
(...skipping 10 matching lines...) Expand all
21 } // namespace 21 } // namespace
22 22
23 namespace views { 23 namespace views {
24 24
25 FocusableBorder::FocusableBorder() 25 FocusableBorder::FocusableBorder()
26 : has_focus_(false), 26 : has_focus_(false),
27 insets_(kTopInsetSize, kLeftInsetSize, 27 insets_(kTopInsetSize, kLeftInsetSize,
28 kBottomInsetSize, kRightInsetSize) { 28 kBottomInsetSize, kRightInsetSize) {
29 } 29 }
30 30
31 void FocusableBorder::Paint(const View& view, gfx::Canvas* canvas) const { 31 void FocusableBorder::Paint(const View& view, gfx::CanvasSkia* canvas) const {
32 SkPath path; 32 SkPath path;
33 path.addRect(gfx::RectToSkRect(view.GetLocalBounds()), SkPath::kCW_Direction); 33 path.addRect(gfx::RectToSkRect(view.GetLocalBounds()), SkPath::kCW_Direction);
34 SkPaint paint; 34 SkPaint paint;
35 paint.setStyle(SkPaint::kStroke_Style); 35 paint.setStyle(SkPaint::kStroke_Style);
36 SkColor focus_color = gfx::NativeTheme::instance()->GetSystemColor( 36 SkColor focus_color = gfx::NativeTheme::instance()->GetSystemColor(
37 has_focus_ ? gfx::NativeTheme::kColorId_FocusedBorderColor 37 has_focus_ ? gfx::NativeTheme::kColorId_FocusedBorderColor
38 : gfx::NativeTheme::kColorId_UnfocusedBorderColor); 38 : gfx::NativeTheme::kColorId_UnfocusedBorderColor);
39 paint.setColor(focus_color); 39 paint.setColor(focus_color);
40 paint.setStrokeWidth(SkIntToScalar(2)); 40 paint.setStrokeWidth(SkIntToScalar(2));
41 41
42 canvas->GetSkCanvas()->drawPath(path, paint); 42 canvas->GetSkCanvas()->drawPath(path, paint);
43 } 43 }
44 44
45 void FocusableBorder::GetInsets(gfx::Insets* insets) const { 45 void FocusableBorder::GetInsets(gfx::Insets* insets) const {
46 *insets = insets_; 46 *insets = insets_;
47 } 47 }
48 48
49 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) { 49 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) {
50 insets_.Set(top, left, bottom, right); 50 insets_.Set(top, left, bottom, right);
51 } 51 }
52 52
53 } // namespace views 53 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698