| 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 "views/controls/image_view.h" | 5 #include "views/controls/image_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/chrome_canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 ImageView::ImageView() | 12 ImageView::ImageView() |
| 13 : image_size_set_(false), | 13 : image_size_set_(false), |
| 14 horiz_alignment_(CENTER), | 14 horiz_alignment_(CENTER), |
| 15 vert_alignment_(CENTER) { | 15 vert_alignment_(CENTER) { |
| 16 } | 16 } |
| 17 | 17 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 *y = height() - image_height; | 97 *y = height() - image_height; |
| 98 break; | 98 break; |
| 99 case CENTER: | 99 case CENTER: |
| 100 *y = (height() - image_height) / 2; | 100 *y = (height() - image_height) / 2; |
| 101 break; | 101 break; |
| 102 default: | 102 default: |
| 103 NOTREACHED(); | 103 NOTREACHED(); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ImageView::Paint(ChromeCanvas* canvas) { | 107 void ImageView::Paint(gfx::Canvas* canvas) { |
| 108 View::Paint(canvas); | 108 View::Paint(canvas); |
| 109 int image_width = image_.width(); | 109 int image_width = image_.width(); |
| 110 int image_height = image_.height(); | 110 int image_height = image_.height(); |
| 111 | 111 |
| 112 if (image_width == 0 || image_height == 0) | 112 if (image_width == 0 || image_height == 0) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 int x, y; | 115 int x, y; |
| 116 if (image_size_set_ && | 116 if (image_size_set_ && |
| 117 (image_size_.width() != image_width || | 117 (image_size_.width() != image_width || |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 bool ImageView::GetTooltipText(int x, int y, std::wstring* tooltip) { | 161 bool ImageView::GetTooltipText(int x, int y, std::wstring* tooltip) { |
| 162 if (tooltip_text_.empty()) { | 162 if (tooltip_text_.empty()) { |
| 163 return false; | 163 return false; |
| 164 } else { | 164 } else { |
| 165 * tooltip = GetTooltipText(); | 165 * tooltip = GetTooltipText(); |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace views | 170 } // namespace views |
| OLD | NEW |