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/geometry/insets.h" | 12 #include "ui/gfx/geometry/insets.h" |
13 #include "ui/gfx/paint_vector_icon.h" | 13 #include "ui/gfx/paint_vector_icon.h" |
| 14 #include "ui/gfx/vector_icons_public.h" |
14 #include "ui/views/painter.h" | 15 #include "ui/views/painter.h" |
15 | 16 |
16 namespace views { | 17 namespace views { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Returns the pixels for the bitmap in |image| at scale |image_scale|. | 21 // Returns the pixels for the bitmap in |image| at scale |image_scale|. |
21 void* GetBitmapPixels(const gfx::ImageSkia& img, float image_scale) { | 22 void* GetBitmapPixels(const gfx::ImageSkia& img, float image_scale) { |
22 DCHECK_NE(0.0f, image_scale); | 23 DCHECK_NE(0.0f, image_scale); |
23 const SkBitmap& bitmap = img.GetRepresentation(image_scale).sk_bitmap(); | 24 const SkBitmap& bitmap = img.GetRepresentation(image_scale).sk_bitmap(); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 void ImageView::OnPaintVectorIcon(gfx::Canvas* canvas) { | 248 void ImageView::OnPaintVectorIcon(gfx::Canvas* canvas) { |
248 if (vector_id_ == gfx::VectorIconId::VECTOR_ICON_NONE) | 249 if (vector_id_ == gfx::VectorIconId::VECTOR_ICON_NONE) |
249 return; | 250 return; |
250 | 251 |
251 DCHECK(image_size_set_); | 252 DCHECK(image_size_set_); |
252 canvas->Translate(ComputeImageOrigin(image_size_).OffsetFromOrigin()); | 253 canvas->Translate(ComputeImageOrigin(image_size_).OffsetFromOrigin()); |
253 gfx::PaintVectorIcon(canvas, vector_id_, image_size_.width(), vector_color_); | 254 gfx::PaintVectorIcon(canvas, vector_id_, image_size_.width(), vector_color_); |
254 } | 255 } |
255 | 256 |
256 } // namespace views | 257 } // namespace views |
OLD | NEW |