| OLD | NEW |
| 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 "chrome/browser/ui/infobar_container_delegate.h" | 7 #include "chrome/browser/ui/infobar_container_delegate.h" |
| 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "skia/ext/cdl_canvas.h" |
| 11 #include "skia/ext/cdl_paint.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) { |
| 17 SetNativeControlColor(infobars::InfoBar::GetBackgroundColor(infobar_type)); | 19 SetNativeControlColor(infobars::InfoBar::GetBackgroundColor(infobar_type)); |
| 18 } | 20 } |
| 19 | 21 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 CdlPaint fill; |
| 67 fill.setStyle(SkPaint::kFill_Style); | 69 fill.setStyle(CdlPaint::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 CdlPaint stroke; |
| 72 stroke.setStyle(SkPaint::kStroke_Style); | 74 stroke.setStyle(CdlPaint::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 } |
| OLD | NEW |