| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/button.h" | 5 #include "chrome/views/button.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 | 9 |
| 10 #include "base/gfx/image_operations.h" | |
| 11 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/common/gfx/chrome_canvas.h" | 11 #include "chrome/common/gfx/chrome_canvas.h" |
| 13 #include "chrome/common/l10n_util.h" | 12 #include "chrome/common/l10n_util.h" |
| 14 #include "chrome/common/throb_animation.h" | 13 #include "chrome/common/throb_animation.h" |
| 15 #include "chrome/views/event.h" | 14 #include "chrome/views/event.h" |
| 15 #include "skia/ext/image_operations.h" |
| 16 | 16 |
| 17 #include "generated_resources.h" | 17 #include "generated_resources.h" |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 | 20 |
| 21 static const int kDefaultWidth = 16; // Default button width if no theme. | 21 static const int kDefaultWidth = 16; // Default button width if no theme. |
| 22 static const int kDefaultHeight = 14; // Default button height if no theme. | 22 static const int kDefaultHeight = 14; // Default button height if no theme. |
| 23 | 23 |
| 24 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
| 25 // | 25 // |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 canvas->DrawBitmapInt(img, x, y); | 99 canvas->DrawBitmapInt(img, x, y); |
| 100 } | 100 } |
| 101 PaintFocusBorder(canvas); | 101 PaintFocusBorder(canvas); |
| 102 } | 102 } |
| 103 | 103 |
| 104 SkBitmap Button::GetImageToPaint() { | 104 SkBitmap Button::GetImageToPaint() { |
| 105 SkBitmap img; | 105 SkBitmap img; |
| 106 | 106 |
| 107 if (!images_[BS_HOT].isNull() && hover_animation_->IsAnimating()) { | 107 if (!images_[BS_HOT].isNull() && hover_animation_->IsAnimating()) { |
| 108 img = gfx::ImageOperations::CreateBlendedBitmap(images_[BS_NORMAL], | 108 img = skia::ImageOperations::CreateBlendedBitmap(images_[BS_NORMAL], |
| 109 images_[BS_HOT], hover_animation_->GetCurrentValue()); | 109 images_[BS_HOT], hover_animation_->GetCurrentValue()); |
| 110 } else { | 110 } else { |
| 111 img = images_[GetState()]; | 111 img = images_[GetState()]; |
| 112 } | 112 } |
| 113 | 113 |
| 114 return !img.isNull() ? img : images_[BS_NORMAL]; | 114 return !img.isNull() ? img : images_[BS_NORMAL]; |
| 115 } | 115 } |
| 116 | 116 |
| 117 //////////////////////////////////////////////////////////////////////////////// | 117 //////////////////////////////////////////////////////////////////////////////// |
| 118 // | 118 // |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 toggled_ = toggled; | 194 toggled_ = toggled; |
| 195 SchedulePaint(); | 195 SchedulePaint(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ToggleButton::SetToggledTooltipText(const std::wstring& tooltip) { | 198 void ToggleButton::SetToggledTooltipText(const std::wstring& tooltip) { |
| 199 toggled_tooltip_text_.assign(tooltip); | 199 toggled_tooltip_text_.assign(tooltip); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace views | 202 } // namespace views |
| 203 | 203 |
| OLD | NEW |