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_loader_ozone.h" | 5 #include "ui/base/cursor/cursor_loader_ozone.h" |
6 | 6 |
7 #include "ui/base/cursor/cursor.h" | 7 #include "ui/base/cursor/cursor.h" |
8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" | 8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 CursorLoaderOzone::CursorLoaderOzone() {} | 14 CursorLoaderOzone::CursorLoaderOzone() {} |
15 | 15 |
16 CursorLoaderOzone::~CursorLoaderOzone() {} | 16 CursorLoaderOzone::~CursorLoaderOzone() {} |
17 | 17 |
18 void CursorLoaderOzone::LoadImageCursor(int id, | 18 void CursorLoaderOzone::LoadImageCursor(int id, |
19 int resource_id, | 19 int resource_id, |
20 const gfx::Point& hot) { | 20 const gfx::Point& hot) { |
21 const gfx::ImageSkia* image = | 21 const gfx::ImageSkia* image = |
22 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); | 22 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); |
23 const gfx::ImageSkiaRep& image_rep = | 23 const gfx::ImageSkiaRep& image_rep = |
24 image->GetRepresentation(scale()); | 24 image->GetRepresentation(display().device_scale_factor()); |
25 SkBitmap bitmap = image_rep.sk_bitmap(); | 25 SkBitmap bitmap = image_rep.sk_bitmap(); |
26 cursors_[id] = | 26 cursors_[id] = |
27 CursorFactoryOzone::GetInstance()->CreateImageCursor(bitmap, hot); | 27 CursorFactoryOzone::GetInstance()->CreateImageCursor(bitmap, hot); |
28 } | 28 } |
29 | 29 |
30 void CursorLoaderOzone::LoadAnimatedCursor(int id, | 30 void CursorLoaderOzone::LoadAnimatedCursor(int id, |
31 int resource_id, | 31 int resource_id, |
32 const gfx::Point& hot, | 32 const gfx::Point& hot, |
33 int frame_delay_ms) { | 33 int frame_delay_ms) { |
34 // TODO(dnicoara) Add support: crbug.com/343245 | 34 // TODO(dnicoara) Add support: crbug.com/343245 |
(...skipping 24 matching lines...) Expand all Loading... |
59 } | 59 } |
60 | 60 |
61 cursor->SetPlatformCursor(platform); | 61 cursor->SetPlatformCursor(platform); |
62 } | 62 } |
63 | 63 |
64 CursorLoader* CursorLoader::Create() { | 64 CursorLoader* CursorLoader::Create() { |
65 return new CursorLoaderOzone(); | 65 return new CursorLoaderOzone(); |
66 } | 66 } |
67 | 67 |
68 } // namespace ui | 68 } // namespace ui |
OLD | NEW |