Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: ui/base/cursor/cursor_loader_ozone.cc

Issue 2798883003: [ozone,views-mus] Build CursorDataFactoryOzone. (Closed)
Patch Set: sadrul comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "ui/base/cursor/cursor.h" 9 #include "ui/base/cursor/cursor.h"
10 #include "ui/base/cursor/cursor_util.h" 10 #include "ui/base/cursor/cursor_util.h"
11 #include "ui/ozone/public/cursor_factory_ozone.h" 11 #include "ui/ozone/public/cursor_factory_ozone.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 CursorLoaderOzone::CursorLoaderOzone() {} 15 CursorLoaderOzone::CursorLoaderOzone() {}
16 16
17 CursorLoaderOzone::~CursorLoaderOzone() {} 17 CursorLoaderOzone::~CursorLoaderOzone() {}
18 18
19 void CursorLoaderOzone::LoadImageCursor(int id, 19 void CursorLoaderOzone::LoadImageCursor(int id,
20 int resource_id, 20 int resource_id,
21 const gfx::Point& hot) { 21 const gfx::Point& hot) {
22 SkBitmap bitmap; 22 SkBitmap bitmap;
23 gfx::Point hotspot = hot; 23 gfx::Point hotspot = hot;
24 24
25 GetImageCursorBitmap(resource_id, scale(), rotation(), &hotspot, &bitmap); 25 GetImageCursorBitmap(resource_id, scale(), rotation(), &hotspot, &bitmap);
26 26
27 cursors_[id] = 27 cursors_[id] = CursorFactoryOzone::GetInstance()->CreateImageCursor(
28 CursorFactoryOzone::GetInstance()->CreateImageCursor(bitmap, hotspot); 28 bitmap, hotspot, scale());
29 } 29 }
30 30
31 void CursorLoaderOzone::LoadAnimatedCursor(int id, 31 void CursorLoaderOzone::LoadAnimatedCursor(int id,
32 int resource_id, 32 int resource_id,
33 const gfx::Point& hot, 33 const gfx::Point& hot,
34 int frame_delay_ms) { 34 int frame_delay_ms) {
35 std::vector<SkBitmap> bitmaps; 35 std::vector<SkBitmap> bitmaps;
36 gfx::Point hotspot = hot; 36 gfx::Point hotspot = hot;
37 37
38 GetAnimatedCursorBitmaps( 38 GetAnimatedCursorBitmaps(
39 resource_id, scale(), rotation(), &hotspot, &bitmaps); 39 resource_id, scale(), rotation(), &hotspot, &bitmaps);
40 40
41 cursors_[id] = CursorFactoryOzone::GetInstance()->CreateAnimatedCursor( 41 cursors_[id] = CursorFactoryOzone::GetInstance()->CreateAnimatedCursor(
42 bitmaps, hotspot, frame_delay_ms); 42 bitmaps, hotspot, frame_delay_ms, scale());
43 } 43 }
44 44
45 void CursorLoaderOzone::UnloadAll() { 45 void CursorLoaderOzone::UnloadAll() {
46 for (ImageCursorMap::const_iterator it = cursors_.begin(); 46 for (ImageCursorMap::const_iterator it = cursors_.begin();
47 it != cursors_.end(); 47 it != cursors_.end();
48 ++it) 48 ++it)
49 CursorFactoryOzone::GetInstance()->UnrefImageCursor(it->second); 49 CursorFactoryOzone::GetInstance()->UnrefImageCursor(it->second);
50 cursors_.clear(); 50 cursors_.clear();
51 } 51 }
52 52
(...skipping 13 matching lines...) Expand all
66 } 66 }
67 67
68 cursor->SetPlatformCursor(platform); 68 cursor->SetPlatformCursor(platform);
69 } 69 }
70 70
71 CursorLoader* CursorLoader::Create() { 71 CursorLoader* CursorLoader::Create() {
72 return new CursorLoaderOzone(); 72 return new CursorLoaderOzone();
73 } 73 }
74 74
75 } // namespace ui 75 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698