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

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

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/focusable_border.h" 5 #include "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 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 }; 53 };
54 SkPath path; 54 SkPath path;
55 path.addRoundRect(rect, corners); 55 path.addRoundRect(rect, corners);
56 SkPaint paint; 56 SkPaint paint;
57 paint.setStyle(SkPaint::kStroke_Style); 57 paint.setStyle(SkPaint::kStroke_Style);
58 paint.setFlags(SkPaint::kAntiAlias_Flag); 58 paint.setFlags(SkPaint::kAntiAlias_Flag);
59 // TODO(oshima): Copy what WebKit does for focused border. 59 // TODO(oshima): Copy what WebKit does for focused border.
60 paint.setColor(has_focus_ ? kFocusedBorderColor : kDefaultBorderColor); 60 paint.setColor(has_focus_ ? kFocusedBorderColor : kDefaultBorderColor);
61 paint.setStrokeWidth(SkIntToScalar(has_focus_ ? 2 : 1)); 61 paint.setStrokeWidth(SkIntToScalar(has_focus_ ? 2 : 1));
62 62
63 canvas->AsCanvasSkia()->drawPath(path, paint); 63 canvas->GetSkCanvas()->drawPath(path, paint);
64 } 64 }
65 65
66 void FocusableBorder::GetInsets(gfx::Insets* insets) const { 66 void FocusableBorder::GetInsets(gfx::Insets* insets) const {
67 *insets = insets_; 67 *insets = insets_;
68 } 68 }
69 69
70 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) { 70 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) {
71 insets_.Set(top, left, bottom, right); 71 insets_.Set(top, left, bottom, right);
72 } 72 }
73 73
74 } // namespace views 74 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698