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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_background.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
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 "chrome/browser/ui/views/infobars/infobar_background.h" 5 #include "chrome/browser/ui/views/infobars/infobar_background.h"
6 6
7 #include "cc/paint/paint_canvas.h"
8 #include "cc/paint/paint_flags.h"
7 #include "chrome/browser/ui/infobar_container_delegate.h" 9 #include "chrome/browser/ui/infobar_container_delegate.h"
8 #include "chrome/browser/ui/views/infobars/infobar_view.h" 10 #include "chrome/browser/ui/views/infobars/infobar_view.h"
9 #include "components/infobars/core/infobar.h" 11 #include "components/infobars/core/infobar.h"
10 #include "ui/base/material_design/material_design_controller.h" 12 #include "ui/base/material_design/material_design_controller.h"
11 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/scoped_canvas.h" 14 #include "ui/gfx/scoped_canvas.h"
13 #include "ui/views/view.h" 15 #include "ui/views/view.h"
14 16
15 InfoBarBackground::InfoBarBackground( 17 InfoBarBackground::InfoBarBackground(
16 infobars::InfoBarDelegate::Type infobar_type) { 18 infobars::InfoBarDelegate::Type infobar_type) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 stroke_path.lineTo(infobar_width - 1, r_arrow_height); 58 stroke_path.lineTo(infobar_width - 1, r_arrow_height);
57 59
58 // Add SK_ScalarHalf to both axes to place the path on pixel centers. 60 // Add SK_ScalarHalf to both axes to place the path on pixel centers.
59 stroke_path.offset(SK_ScalarHalf, SK_ScalarHalf); 61 stroke_path.offset(SK_ScalarHalf, SK_ScalarHalf);
60 62
61 fill_path = stroke_path; 63 fill_path = stroke_path;
62 fill_path.close(); 64 fill_path.close();
63 } 65 }
64 } 66 }
65 fill_path.addRect(0, arrow_height, infobar_width, scale(infobar->height())); 67 fill_path.addRect(0, arrow_height, infobar_width, scale(infobar->height()));
66 SkPaint fill; 68 cc::PaintFlags fill;
67 fill.setStyle(SkPaint::kFill_Style); 69 fill.setStyle(cc::PaintFlags::kFill_Style);
68 fill.setColor(get_color()); 70 fill.setColor(get_color());
69 canvas->DrawPath(fill_path, fill); 71 canvas->DrawPath(fill_path, fill);
70 72
71 SkPaint stroke; 73 cc::PaintFlags stroke;
72 stroke.setStyle(SkPaint::kStroke_Style); 74 stroke.setStyle(cc::PaintFlags::kStroke_Style);
73 const int kSeparatorThicknessPx = 1; 75 const int kSeparatorThicknessPx = 1;
74 stroke.setStrokeWidth(SkIntToScalar(kSeparatorThicknessPx)); 76 stroke.setStrokeWidth(SkIntToScalar(kSeparatorThicknessPx));
75 stroke.setColor(separator_color); 77 stroke.setColor(separator_color);
76 stroke.setAntiAlias(true); 78 stroke.setAntiAlias(true);
77 canvas->DrawPath(stroke_path, stroke); 79 canvas->DrawPath(stroke_path, stroke);
78 80
79 // Bottom separator. 81 // Bottom separator.
80 stroke.setAntiAlias(false); 82 stroke.setAntiAlias(false);
81 gfx::SizeF view_size_px = gfx::ScaleSize(gfx::SizeF(view->size()), dsf); 83 gfx::SizeF view_size_px = gfx::ScaleSize(gfx::SizeF(view->size()), dsf);
82 SkScalar y = SkIntToScalar(view_size_px.height() - kSeparatorThicknessPx) + 84 SkScalar y = SkIntToScalar(view_size_px.height() - kSeparatorThicknessPx) +
83 SK_ScalarHalf; 85 SK_ScalarHalf;
84 SkScalar w = SkFloatToScalar(view_size_px.width()); 86 SkScalar w = SkFloatToScalar(view_size_px.width());
85 canvas->sk_canvas()->drawLine(0, y, w, y, stroke); 87 canvas->sk_canvas()->drawLine(0, y, w, y, stroke);
86 } 88 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/infobars/infobar_container_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698