OLD | NEW |
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 "chrome/browser/ui/views/infobars/infobar_background.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_background.h" |
6 | 6 |
7 #include "chrome/browser/infobars/infobar.h" | 7 #include "chrome/browser/infobars/infobar.h" |
8 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/canvas_skia_paint.h" | 10 #include "ui/gfx/canvas_skia_paint.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 SkShader* gradient_shader = SkGradientShader::CreateLinear( | 32 SkShader* gradient_shader = SkGradientShader::CreateLinear( |
33 gradient_points, gradient_colors, NULL, 2, SkShader::kClamp_TileMode); | 33 gradient_points, gradient_colors, NULL, 2, SkShader::kClamp_TileMode); |
34 SkPaint paint; | 34 SkPaint paint; |
35 paint.setStrokeWidth(SkIntToScalar(InfoBar::kSeparatorLineHeight)); | 35 paint.setStrokeWidth(SkIntToScalar(InfoBar::kSeparatorLineHeight)); |
36 paint.setStyle(SkPaint::kFill_Style); | 36 paint.setStyle(SkPaint::kFill_Style); |
37 paint.setStrokeCap(SkPaint::kRound_Cap); | 37 paint.setStrokeCap(SkPaint::kRound_Cap); |
38 paint.setShader(gradient_shader); | 38 paint.setShader(gradient_shader); |
39 gradient_shader->unref(); | 39 gradient_shader->unref(); |
40 | 40 |
41 InfoBarView* infobar = static_cast<InfoBarView*>(view); | 41 InfoBarView* infobar = static_cast<InfoBarView*>(view); |
42 gfx::CanvasSkia* canvas_skia = canvas->AsCanvasSkia(); | 42 SkCanvas* canvas_skia = canvas->GetSkCanvas(); |
43 canvas_skia->drawPath(infobar->fill_path(), paint); | 43 canvas_skia->drawPath(infobar->fill_path(), paint); |
44 | 44 |
45 paint.setShader(NULL); | 45 paint.setShader(NULL); |
46 paint.setColor(SkColorSetA(separator_color_, | 46 paint.setColor(SkColorSetA(separator_color_, |
47 SkColorGetA(gradient_colors[0]))); | 47 SkColorGetA(gradient_colors[0]))); |
48 paint.setStyle(SkPaint::kStroke_Style); | 48 paint.setStyle(SkPaint::kStroke_Style); |
49 // Anti-alias the path so it doesn't look goofy when the edges are not at 45 | 49 // Anti-alias the path so it doesn't look goofy when the edges are not at 45 |
50 // degree angles, but don't anti-alias anything else, especially not the fill, | 50 // degree angles, but don't anti-alias anything else, especially not the fill, |
51 // lest we get weird color bleeding problems. | 51 // lest we get weird color bleeding problems. |
52 paint.setAntiAlias(true); | 52 paint.setAntiAlias(true); |
53 canvas_skia->drawPath(infobar->stroke_path(), paint); | 53 canvas_skia->drawPath(infobar->stroke_path(), paint); |
54 paint.setAntiAlias(false); | 54 paint.setAntiAlias(false); |
55 | 55 |
56 // Now draw the separator at the bottom. | 56 // Now draw the separator at the bottom. |
57 canvas->FillRectInt(separator_color_, 0, | 57 canvas->FillRectInt(separator_color_, 0, |
58 view->height() - InfoBar::kSeparatorLineHeight, | 58 view->height() - InfoBar::kSeparatorLineHeight, |
59 view->width(), InfoBar::kSeparatorLineHeight); | 59 view->width(), InfoBar::kSeparatorLineHeight); |
60 } | 60 } |
OLD | NEW |