OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/image_view.h" | 5 #include "ui/views/controls/image_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 void ImageView::SetImage(const SkBitmap& bm) { | 25 void ImageView::SetImage(const SkBitmap& bm) { |
26 gfx::Size pref_size(GetPreferredSize()); | 26 gfx::Size pref_size(GetPreferredSize()); |
27 image_ = bm; | 27 image_ = bm; |
28 if (pref_size != GetPreferredSize()) | 28 if (pref_size != GetPreferredSize()) |
29 PreferredSizeChanged(); | 29 PreferredSizeChanged(); |
30 SchedulePaint(); | 30 SchedulePaint(); |
31 } | 31 } |
32 | 32 |
33 void ImageView::SetImage(const SkBitmap* bm) { | 33 void ImageView::SetImage(const gfx::ImageSkia* image_skia) { |
34 if (bm) { | 34 if (image_skia) { |
35 SetImage(*bm); | 35 SetImage(*image_skia); |
36 } else { | 36 } else { |
37 SkBitmap t; | 37 SkBitmap t; |
38 SetImage(t); | 38 SetImage(t); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 const SkBitmap& ImageView::GetImage() { | 42 const SkBitmap& ImageView::GetImage() { |
43 return image_; | 43 return image_; |
44 } | 44 } |
45 | 45 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { | 168 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { |
169 if (tooltip_text_.empty()) | 169 if (tooltip_text_.empty()) |
170 return false; | 170 return false; |
171 | 171 |
172 *tooltip = GetTooltipText(); | 172 *tooltip = GetTooltipText(); |
173 return true; | 173 return true; |
174 } | 174 } |
175 | 175 |
176 } // namespace views | 176 } // namespace views |
OLD | NEW |