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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 11 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "ui/accessibility/ax_view_state.h" | 12 #include "ui/accessibility/ax_view_state.h" |
11 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
12 #include "ui/gfx/geometry/insets.h" | 14 #include "ui/gfx/geometry/insets.h" |
13 #include "ui/views/painter.h" | 15 #include "ui/views/painter.h" |
14 | 16 |
15 namespace views { | 17 namespace views { |
16 | 18 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 gfx::Rect ImageView::GetImageBounds() const { | 78 gfx::Rect ImageView::GetImageBounds() const { |
77 gfx::Size image_size = GetImageSize(); | 79 gfx::Size image_size = GetImageSize(); |
78 return gfx::Rect(ComputeImageOrigin(image_size), image_size); | 80 return gfx::Rect(ComputeImageOrigin(image_size), image_size); |
79 } | 81 } |
80 | 82 |
81 void ImageView::ResetImageSize() { | 83 void ImageView::ResetImageSize() { |
82 image_size_set_ = false; | 84 image_size_set_ = false; |
83 } | 85 } |
84 | 86 |
85 void ImageView::SetFocusPainter(scoped_ptr<Painter> focus_painter) { | 87 void ImageView::SetFocusPainter(scoped_ptr<Painter> focus_painter) { |
86 focus_painter_ = focus_painter.Pass(); | 88 focus_painter_ = std::move(focus_painter); |
87 } | 89 } |
88 | 90 |
89 gfx::Size ImageView::GetPreferredSize() const { | 91 gfx::Size ImageView::GetPreferredSize() const { |
90 gfx::Size size = GetImageSize(); | 92 gfx::Size size = GetImageSize(); |
91 size.Enlarge(GetInsets().width(), GetInsets().height()); | 93 size.Enlarge(GetInsets().width(), GetInsets().height()); |
92 return size; | 94 return size; |
93 } | 95 } |
94 | 96 |
95 bool ImageView::IsImageEqual(const gfx::ImageSkia& img) const { | 97 bool ImageView::IsImageEqual(const gfx::ImageSkia& img) const { |
96 // Even though we copy ImageSkia in SetImage() the backing store | 98 // Even though we copy ImageSkia in SetImage() the backing store |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 canvas->DrawImageInt(image_, 0, 0, image_.width(), image_.height(), | 226 canvas->DrawImageInt(image_, 0, 0, image_.width(), image_.height(), |
225 image_bounds.x(), image_bounds.y(), image_bounds.width(), | 227 image_bounds.x(), image_bounds.y(), image_bounds.width(), |
226 image_bounds.height(), true, paint); | 228 image_bounds.height(), true, paint); |
227 } else { | 229 } else { |
228 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y()); | 230 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y()); |
229 } | 231 } |
230 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_); | 232 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_); |
231 } | 233 } |
232 | 234 |
233 } // namespace views | 235 } // namespace views |
OLD | NEW |