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

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

Issue 10824359: Remove ImageSkia::empty and ImageSkia::extractSubset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « ui/views/controls/button/text_button.h ('k') | ui/views/controls/menu/menu_item_view.cc » ('j') | 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) 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 case CENTER: y = (height() - image_size.height()) / 2; break; 103 case CENTER: y = (height() - image_size.height()) / 2; break;
104 default: NOTREACHED(); y = 0; break; 104 default: NOTREACHED(); y = 0; break;
105 } 105 }
106 106
107 return gfx::Point(x, y); 107 return gfx::Point(x, y);
108 } 108 }
109 109
110 void ImageView::OnPaint(gfx::Canvas* canvas) { 110 void ImageView::OnPaint(gfx::Canvas* canvas) {
111 View::OnPaint(canvas); 111 View::OnPaint(canvas);
112 112
113 if (image_.empty()) 113 if (image_.isNull())
114 return; 114 return;
115 115
116 gfx::Rect image_bounds(GetImageBounds()); 116 gfx::Rect image_bounds(GetImageBounds());
117 if (image_bounds.IsEmpty()) 117 if (image_bounds.IsEmpty())
118 return; 118 return;
119 119
120 if (image_bounds.size() != gfx::Size(image_.width(), image_.height())) { 120 if (image_bounds.size() != gfx::Size(image_.width(), image_.height())) {
121 // Resize case 121 // Resize case
122 SkPaint paint; 122 SkPaint paint;
123 paint.setFilterBitmap(true); 123 paint.setFilterBitmap(true);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { 167 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const {
168 if (tooltip_text_.empty()) 168 if (tooltip_text_.empty())
169 return false; 169 return false;
170 170
171 *tooltip = GetTooltipText(); 171 *tooltip = GetTooltipText();
172 return true; 172 return true;
173 } 173 }
174 174
175 } // namespace views 175 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/text_button.h ('k') | ui/views/controls/menu/menu_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698