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/strings/utf_string_conversions.h" | 8 #include "base/strings/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/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_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/geometry/insets.h" |
13 #include "ui/views/painter.h" | 13 #include "ui/views/painter.h" |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Returns the pixels for the bitmap in |image| at scale |image_scale|. | 19 // Returns the pixels for the bitmap in |image| at scale |image_scale|. |
20 void* GetBitmapPixels(const gfx::ImageSkia& img, float image_scale) { | 20 void* GetBitmapPixels(const gfx::ImageSkia& img, float image_scale) { |
21 DCHECK_NE(0.0f, image_scale); | 21 DCHECK_NE(0.0f, image_scale); |
22 const SkBitmap& bitmap = img.GetRepresentation(image_scale).sk_bitmap(); | 22 const SkBitmap& bitmap = img.GetRepresentation(image_scale).sk_bitmap(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 canvas->DrawImageInt(image_, 0, 0, image_.width(), image_.height(), | 227 canvas->DrawImageInt(image_, 0, 0, image_.width(), image_.height(), |
228 image_bounds.x(), image_bounds.y(), image_bounds.width(), | 228 image_bounds.x(), image_bounds.y(), image_bounds.width(), |
229 image_bounds.height(), true, paint); | 229 image_bounds.height(), true, paint); |
230 } else { | 230 } else { |
231 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y()); | 231 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y()); |
232 } | 232 } |
233 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_); | 233 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_); |
234 } | 234 } |
235 | 235 |
236 } // namespace views | 236 } // namespace views |
OLD | NEW |