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

Side by Side Diff: ui/views/controls/image_view.cc

Issue 9877009: Two tweaks to avoid invoking ShelfLayoutManager::LayoutShelf unless we (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « ash/wm/status_area_layout_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/insets.h" 12 #include "ui/gfx/insets.h"
13 13
14 namespace views { 14 namespace views {
15 15
16 ImageView::ImageView() 16 ImageView::ImageView()
17 : image_size_set_(false), 17 : image_size_set_(false),
18 horiz_alignment_(CENTER), 18 horiz_alignment_(CENTER),
19 vert_alignment_(CENTER) { 19 vert_alignment_(CENTER) {
20 } 20 }
21 21
22 ImageView::~ImageView() { 22 ImageView::~ImageView() {
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 image_ = bm; 27 image_ = bm;
27 PreferredSizeChanged(); 28 if (pref_size != GetPreferredSize())
29 PreferredSizeChanged();
28 SchedulePaint(); 30 SchedulePaint();
29 } 31 }
30 32
31 void ImageView::SetImage(const SkBitmap* bm) { 33 void ImageView::SetImage(const SkBitmap* bm) {
32 if (bm) { 34 if (bm) {
33 SetImage(*bm); 35 SetImage(*bm);
34 } else { 36 } else {
35 SkBitmap t; 37 SkBitmap t;
36 SetImage(t); 38 SetImage(t);
37 } 39 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 167
166 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { 168 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const {
167 if (tooltip_text_.empty()) 169 if (tooltip_text_.empty())
168 return false; 170 return false;
169 171
170 *tooltip = GetTooltipText(); 172 *tooltip = GetTooltipText();
171 return true; 173 return true;
172 } 174 }
173 175
174 } // namespace views 176 } // namespace views
OLDNEW
« no previous file with comments | « ash/wm/status_area_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698