| 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/gtk/infobars/infobar_arrow_model.h" | 5 #include "chrome/browser/ui/gtk/infobars/infobar_arrow_model.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" | 7 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" |
| 8 #include "third_party/skia/include/effects/SkGradientShader.h" | 8 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 9 #include "ui/gfx/canvas_skia.h" |
| 9 #include "ui/gfx/canvas_skia_paint.h" | 10 #include "ui/gfx/canvas_skia_paint.h" |
| 10 #include "ui/gfx/color_utils.h" | 11 #include "ui/gfx/color_utils.h" |
| 11 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 12 #include "ui/gfx/skia_utils_gtk.h" | 13 #include "ui/gfx/skia_utils_gtk.h" |
| 13 | 14 |
| 14 const size_t InfoBarArrowModel::kDefaultArrowSize = 12; | 15 const size_t InfoBarArrowModel::kDefaultArrowSize = 12; |
| 15 | 16 |
| 16 InfoBarArrowModel::InfoBarArrowModel(Observer* observer) | 17 InfoBarArrowModel::InfoBarArrowModel(Observer* observer) |
| 17 : observer_(observer), | 18 : observer_(observer), |
| 18 animation_(this) { | 19 animation_(this) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 InfoBarColors colors = CurrentInfoBarColors(); | 95 InfoBarColors colors = CurrentInfoBarColors(); |
| 95 SkColor grad_colors[2]; | 96 SkColor grad_colors[2]; |
| 96 grad_colors[0] = colors.top; | 97 grad_colors[0] = colors.top; |
| 97 grad_colors[1] = colors.bottom; | 98 grad_colors[1] = colors.bottom; |
| 98 | 99 |
| 99 SkShader* gradient_shader = SkGradientShader::CreateLinear( | 100 SkShader* gradient_shader = SkGradientShader::CreateLinear( |
| 100 grad_points, grad_colors, NULL, 2, SkShader::kMirror_TileMode); | 101 grad_points, grad_colors, NULL, 2, SkShader::kMirror_TileMode); |
| 101 paint.setShader(gradient_shader); | 102 paint.setShader(gradient_shader); |
| 102 gradient_shader->unref(); | 103 gradient_shader->unref(); |
| 103 | 104 |
| 104 gfx::CanvasSkiaPaint canvas(expose, false); | 105 gfx::CanvasSkiaPaint canvas_paint(expose, false); |
| 105 canvas.drawPath(path, paint); | 106 SkCanvas* canvas = canvas_paint.AsCanvas()->AsCanvasSkia()->skia_canvas(); |
| 107 canvas->drawPath(path, paint); |
| 106 | 108 |
| 107 paint.setShader(NULL); | 109 paint.setShader(NULL); |
| 108 paint.setColor(SkColorSetA(gfx::GdkColorToSkColor(border_color), | 110 paint.setColor(SkColorSetA(gfx::GdkColorToSkColor(border_color), |
| 109 SkColorGetA(colors.top))); | 111 SkColorGetA(colors.top))); |
| 110 paint.setStyle(SkPaint::kStroke_Style); | 112 paint.setStyle(SkPaint::kStroke_Style); |
| 111 canvas.drawPath(path, paint); | 113 canvas->drawPath(path, paint); |
| 112 } | 114 } |
| 113 | 115 |
| 114 void InfoBarArrowModel::AnimationEnded(const ui::Animation* animation) { | 116 void InfoBarArrowModel::AnimationEnded(const ui::Animation* animation) { |
| 115 observer_->PaintStateChanged(); | 117 observer_->PaintStateChanged(); |
| 116 } | 118 } |
| 117 | 119 |
| 118 void InfoBarArrowModel::AnimationProgressed(const ui::Animation* animation) { | 120 void InfoBarArrowModel::AnimationProgressed(const ui::Animation* animation) { |
| 119 observer_->PaintStateChanged(); | 121 observer_->PaintStateChanged(); |
| 120 } | 122 } |
| 121 | 123 |
| 122 void InfoBarArrowModel::AnimationCanceled(const ui::Animation* animation) { | 124 void InfoBarArrowModel::AnimationCanceled(const ui::Animation* animation) { |
| 123 observer_->PaintStateChanged(); | 125 observer_->PaintStateChanged(); |
| 124 } | 126 } |
| OLD | NEW |