| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base/cursor/cursor_util.h" | 5 #include "ui/base/cursor/cursor_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "skia/ext/image_operations.h" | 8 #include "skia/ext/image_operations.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/geometry/point_conversions.h" | 10 #include "ui/gfx/geometry/point_conversions.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 gfx::Size scaled_size = gfx::ScaleToFlooredSize( | 51 gfx::Size scaled_size = gfx::ScaleToFlooredSize( |
| 52 gfx::Size(bitmap->width(), bitmap->height()), scale); | 52 gfx::Size(bitmap->width(), bitmap->height()), scale); |
| 53 | 53 |
| 54 *bitmap = skia::ImageOperations::Resize( | 54 *bitmap = skia::ImageOperations::Resize( |
| 55 *bitmap, | 55 *bitmap, |
| 56 skia::ImageOperations::RESIZE_BETTER, | 56 skia::ImageOperations::RESIZE_BETTER, |
| 57 scaled_size.width(), | 57 scaled_size.width(), |
| 58 scaled_size.height()); | 58 scaled_size.height()); |
| 59 *hotpoint = gfx::ToFlooredPoint(gfx::ScalePoint(*hotpoint, scale)); | 59 *hotpoint = gfx::ScaleToFlooredPoint(*hotpoint, scale); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void GetImageCursorBitmap(int resource_id, | 62 void GetImageCursorBitmap(int resource_id, |
| 63 float scale, | 63 float scale, |
| 64 gfx::Display::Rotation rotation, | 64 gfx::Display::Rotation rotation, |
| 65 gfx::Point* hotspot, | 65 gfx::Point* hotspot, |
| 66 SkBitmap* bitmap) { | 66 SkBitmap* bitmap) { |
| 67 const gfx::ImageSkia* image = | 67 const gfx::ImageSkia* image = |
| 68 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); | 68 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); |
| 69 const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale); | 69 const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 SkBitmap cropped = SkBitmapOperations::CreateTiledBitmap( | 101 SkBitmap cropped = SkBitmapOperations::CreateTiledBitmap( |
| 102 bitmap, x_offset, 0, frame_width, frame_height); | 102 bitmap, x_offset, 0, frame_width, frame_height); |
| 103 DCHECK_EQ(frame_width, cropped.width()); | 103 DCHECK_EQ(frame_width, cropped.width()); |
| 104 DCHECK_EQ(frame_height, cropped.height()); | 104 DCHECK_EQ(frame_height, cropped.height()); |
| 105 | 105 |
| 106 (*bitmaps)[frame] = cropped; | 106 (*bitmaps)[frame] = cropped; |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace ui | 110 } // namespace ui |
| OLD | NEW |