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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_background.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 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/ui/views/infobars/infobar_view.h" 7 #include "chrome/browser/ui/views/infobars/infobar_view.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas_skia.h"
9 #include "ui/gfx/canvas_skia_paint.h"
10 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
11 #include "views/view.h" 10 #include "views/view.h"
12 11
13 // static 12 // static
14 const int InfoBarBackground::kSeparatorLineHeight = 1; 13 const int InfoBarBackground::kSeparatorLineHeight = 1;
15 14
16 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) 15 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type)
17 : separator_color_(SK_ColorBLACK), 16 : separator_color_(SK_ColorBLACK),
18 top_color_(GetTopColor(infobar_type)), 17 top_color_(GetTopColor(infobar_type)),
19 bottom_color_(GetBottomColor(infobar_type)) { 18 bottom_color_(GetBottomColor(infobar_type)) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 gradient_points, gradient_colors, NULL, 2, SkShader::kClamp_TileMode); 54 gradient_points, gradient_colors, NULL, 2, SkShader::kClamp_TileMode);
56 SkPaint paint; 55 SkPaint paint;
57 paint.setStrokeWidth(1.0); 56 paint.setStrokeWidth(1.0);
58 paint.setStyle(SkPaint::kFill_Style); 57 paint.setStyle(SkPaint::kFill_Style);
59 paint.setStrokeCap(SkPaint::kRound_Cap); 58 paint.setStrokeCap(SkPaint::kRound_Cap);
60 paint.setShader(gradient_shader); 59 paint.setShader(gradient_shader);
61 gradient_shader->unref(); 60 gradient_shader->unref();
62 61
63 InfoBarView* infobar = static_cast<InfoBarView*>(view); 62 InfoBarView* infobar = static_cast<InfoBarView*>(view);
64 gfx::CanvasSkia* canvas_skia = canvas->AsCanvasSkia(); 63 gfx::CanvasSkia* canvas_skia = canvas->AsCanvasSkia();
65 canvas_skia->drawPath(*infobar->fill_path(), paint); 64 canvas_skia->skia_canvas()->drawPath(*infobar->fill_path(), paint);
66 65
67 paint.setShader(NULL); 66 paint.setShader(NULL);
68 paint.setColor(SkColorSetA(separator_color_, 67 paint.setColor(SkColorSetA(separator_color_,
69 SkColorGetA(gradient_colors[0]))); 68 SkColorGetA(gradient_colors[0])));
70 paint.setStyle(SkPaint::kStroke_Style); 69 paint.setStyle(SkPaint::kStroke_Style);
71 canvas_skia->drawPath(*infobar->stroke_path(), paint); 70 canvas_skia->skia_canvas()->drawPath(*infobar->stroke_path(), paint);
72 71
73 // Now draw the separator at the bottom. 72 // Now draw the separator at the bottom.
74 canvas->FillRectInt(separator_color_, 0, 73 canvas->FillRectInt(separator_color_, 0,
75 view->height() - kSeparatorLineHeight, view->width(), 74 view->height() - kSeparatorLineHeight, view->width(),
76 kSeparatorLineHeight); 75 kSeparatorLineHeight);
77 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/extension_infobar.cc ('k') | chrome/browser/ui/views/infobars/translate_infobar_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698