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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem 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/views/controls/focus_ring.cc ('k') | ui/views/controls/focusable_rounded_border_mac.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/views/controls/focusable_border.h" 5 #include "ui/views/controls/focusable_border.h"
6 6
7 #include "third_party/skia/include/core/SkPaint.h" 7 #include "cc/paint/paint_flags.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/color_palette.h" 11 #include "ui/gfx/color_palette.h"
12 #include "ui/gfx/color_utils.h" 12 #include "ui/gfx/color_utils.h"
13 #include "ui/gfx/geometry/insets.h" 13 #include "ui/gfx/geometry/insets.h"
14 #include "ui/gfx/scoped_canvas.h" 14 #include "ui/gfx/scoped_canvas.h"
15 #include "ui/gfx/skia_util.h" 15 #include "ui/gfx/skia_util.h"
16 #include "ui/native_theme/native_theme.h" 16 #include "ui/native_theme/native_theme.h"
17 #include "ui/views/controls/textfield/textfield.h" 17 #include "ui/views/controls/textfield/textfield.h"
(...skipping 14 matching lines...) Expand all
32 void FocusableBorder::SetColorId( 32 void FocusableBorder::SetColorId(
33 const base::Optional<ui::NativeTheme::ColorId>& color_id) { 33 const base::Optional<ui::NativeTheme::ColorId>& color_id) {
34 override_color_id_ = color_id; 34 override_color_id_ = color_id;
35 } 35 }
36 36
37 void FocusableBorder::Paint(const View& view, gfx::Canvas* canvas) { 37 void FocusableBorder::Paint(const View& view, gfx::Canvas* canvas) {
38 // In harmony, the focus indicator is a FocusRing. 38 // In harmony, the focus indicator is a FocusRing.
39 if (ui::MaterialDesignController::IsSecondaryUiMaterial() && view.HasFocus()) 39 if (ui::MaterialDesignController::IsSecondaryUiMaterial() && view.HasFocus())
40 return; 40 return;
41 41
42 SkPaint paint; 42 cc::PaintFlags paint;
43 paint.setStyle(SkPaint::kStroke_Style); 43 paint.setStyle(cc::PaintFlags::kStroke_Style);
44 paint.setColor(GetCurrentColor(view)); 44 paint.setColor(GetCurrentColor(view));
45 45
46 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { 46 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
47 gfx::ScopedCanvas scoped(canvas); 47 gfx::ScopedCanvas scoped(canvas);
48 float dsf = canvas->UndoDeviceScaleFactor(); 48 float dsf = canvas->UndoDeviceScaleFactor();
49 // Scale the rect and snap to pixel boundaries. 49 // Scale the rect and snap to pixel boundaries.
50 gfx::RectF rect(gfx::ScaleToEnclosingRect(view.GetLocalBounds(), dsf)); 50 gfx::RectF rect(gfx::ScaleToEnclosingRect(view.GetLocalBounds(), dsf));
51 rect.Inset(gfx::InsetsF(0.5f)); 51 rect.Inset(gfx::InsetsF(0.5f));
52 SkPath path; 52 SkPath path;
53 float corner_radius_px = kCornerRadiusDp * dsf; 53 float corner_radius_px = kCornerRadiusDp * dsf;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SkColor color = view.GetNativeTheme()->GetSystemColor(color_id); 89 SkColor color = view.GetNativeTheme()->GetSystemColor(color_id);
90 if (ui::MaterialDesignController::IsSecondaryUiMaterial() && 90 if (ui::MaterialDesignController::IsSecondaryUiMaterial() &&
91 !view.enabled()) { 91 !view.enabled()) {
92 return color_utils::BlendTowardOppositeLuma(color, 92 return color_utils::BlendTowardOppositeLuma(color,
93 gfx::kDisabledControlAlpha); 93 gfx::kDisabledControlAlpha);
94 } 94 }
95 return color; 95 return color;
96 } 96 }
97 97
98 } // namespace views 98 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/focus_ring.cc ('k') | ui/views/controls/focusable_rounded_border_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698