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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 gfx::Rect ImageView::GetImageBounds() const { | 78 gfx::Rect ImageView::GetImageBounds() const { |
79 gfx::Size image_size = GetImageSize(); | 79 gfx::Size image_size = GetImageSize(); |
80 return gfx::Rect(ComputeImageOrigin(image_size), image_size); | 80 return gfx::Rect(ComputeImageOrigin(image_size), image_size); |
81 } | 81 } |
82 | 82 |
83 void ImageView::ResetImageSize() { | 83 void ImageView::ResetImageSize() { |
84 image_size_set_ = false; | 84 image_size_set_ = false; |
85 } | 85 } |
86 | 86 |
87 void ImageView::SetFocusPainter(scoped_ptr<Painter> focus_painter) { | 87 void ImageView::SetFocusPainter(std::unique_ptr<Painter> focus_painter) { |
88 focus_painter_ = std::move(focus_painter); | 88 focus_painter_ = std::move(focus_painter); |
89 } | 89 } |
90 | 90 |
91 gfx::Size ImageView::GetPreferredSize() const { | 91 gfx::Size ImageView::GetPreferredSize() const { |
92 gfx::Size size = GetImageSize(); | 92 gfx::Size size = GetImageSize(); |
93 size.Enlarge(GetInsets().width(), GetInsets().height()); | 93 size.Enlarge(GetInsets().width(), GetInsets().height()); |
94 return size; | 94 return size; |
95 } | 95 } |
96 | 96 |
97 bool ImageView::IsImageEqual(const gfx::ImageSkia& img) const { | 97 bool ImageView::IsImageEqual(const gfx::ImageSkia& img) const { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 canvas->DrawImageInt(image_, 0, 0, image_.width(), image_.height(), | 226 canvas->DrawImageInt(image_, 0, 0, image_.width(), image_.height(), |
227 image_bounds.x(), image_bounds.y(), image_bounds.width(), | 227 image_bounds.x(), image_bounds.y(), image_bounds.width(), |
228 image_bounds.height(), true, paint); | 228 image_bounds.height(), true, paint); |
229 } else { | 229 } else { |
230 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y()); | 230 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y()); |
231 } | 231 } |
232 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_); | 232 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_); |
233 } | 233 } |
234 | 234 |
235 } // namespace views | 235 } // namespace views |
OLD | NEW |