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

Side by Side Diff: ui/views/controls/tabbed_pane/native_tabbed_pane_views.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) 2011 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/tabbed_pane/native_tabbed_pane_views.h" 5 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_views.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/canvas_skia.h" 10 #include "ui/gfx/canvas_skia.h"
11 #include "ui/gfx/font.h" 11 #include "ui/gfx/font.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 0, 0, 71 0, 0,
72 0, 0 }; 72 0, 0 };
73 path.addRoundRect(bounds, radii, SkPath::kCW_Direction); 73 path.addRoundRect(bounds, radii, SkPath::kCW_Direction);
74 74
75 SkPaint paint; 75 SkPaint paint;
76 paint.setAntiAlias(true); 76 paint.setAntiAlias(true);
77 paint.setStyle(SkPaint::kStroke_Style); 77 paint.setStyle(SkPaint::kStroke_Style);
78 paint.setColor(kTabBorderColor); 78 paint.setColor(kTabBorderColor);
79 paint.setStrokeWidth(kTabBorderThickness * 2); 79 paint.setStrokeWidth(kTabBorderThickness * 2);
80 80
81 canvas->AsCanvasSkia()->sk_canvas()->drawPath(path, paint); 81 canvas->sk_canvas()->drawPath(path, paint);
82 } 82 }
83 83
84 void PaintTabTitle(gfx::Canvas* canvas, bool selected) { 84 void PaintTabTitle(gfx::Canvas* canvas, bool selected) {
85 int text_width = GetTabTitleFont().GetStringWidth(title_); 85 int text_width = GetTabTitleFont().GetStringWidth(title_);
86 int text_height = GetTabTitleFont().GetHeight(); 86 int text_height = GetTabTitleFont().GetHeight();
87 int text_x = (width() - text_width) / 2; 87 int text_x = (width() - text_width) / 2;
88 int text_y = 5; 88 int text_y = 5;
89 gfx::Rect text_rect(text_x, text_y, text_width, text_height); 89 gfx::Rect text_rect(text_x, text_y, text_width, text_height);
90 canvas->DrawStringInt(title_, GetTabTitleFont(), title_color_, text_rect); 90 canvas->DrawStringInt(title_, GetTabTitleFont(), title_color_, text_rect);
91 } 91 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 child_at(i)->SetBounds(x, 0, ps.width(), ps.height()); 155 child_at(i)->SetBounds(x, 0, ps.width(), ps.height());
156 x = child_at(i)->bounds().right(); 156 x = child_at(i)->bounds().right();
157 } 157 }
158 } 158 }
159 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 159 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
160 SkPaint paint; 160 SkPaint paint;
161 paint.setColor(kTabBorderColor); 161 paint.setColor(kTabBorderColor);
162 paint.setStrokeWidth(kTabBorderThickness); 162 paint.setStrokeWidth(kTabBorderThickness);
163 SkScalar line_y = SkIntToScalar(height()) - kTabBorderThickness; 163 SkScalar line_y = SkIntToScalar(height()) - kTabBorderThickness;
164 SkScalar line_width = SkIntToScalar(width()); 164 SkScalar line_width = SkIntToScalar(width());
165 canvas->AsCanvasSkia()->sk_canvas()->drawLine(0, line_y, line_width, line_y, 165 canvas->sk_canvas()->drawLine(0, line_y, line_width, line_y, paint);
166 paint);
167 } 166 }
168 167
169 private: 168 private:
170 NativeTabbedPaneViews* owner_; 169 NativeTabbedPaneViews* owner_;
171 View* selected_tab_; 170 View* selected_tab_;
172 171
173 DISALLOW_COPY_AND_ASSIGN(TabStrip); 172 DISALLOW_COPY_AND_ASSIGN(TabStrip);
174 }; 173 };
175 174
176 void Tab::OnSelectedStateChanged(bool selected) { 175 void Tab::OnSelectedStateChanged(bool selected) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 //////////////////////////////////////////////////////////////////////////////// 400 ////////////////////////////////////////////////////////////////////////////////
402 // NativeTabbedPaneWrapper, public: 401 // NativeTabbedPaneWrapper, public:
403 402
404 // static 403 // static
405 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( 404 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper(
406 TabbedPane* tabbed_pane) { 405 TabbedPane* tabbed_pane) {
407 return new NativeTabbedPaneViews(tabbed_pane); 406 return new NativeTabbedPaneViews(tabbed_pane);
408 } 407 }
409 408
410 } // namespace views 409 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698