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

Unified Diff: ui/base/cursor/cursor_loader_ozone.cc

Issue 543823002: ozone: Plumb animated cursors from CursorLoaderOzone to CursorFactoryOzone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/0/0U/ Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/cursor/cursor_loader_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cursor/cursor_loader_ozone.cc
diff --git a/ui/base/cursor/cursor_loader_ozone.cc b/ui/base/cursor/cursor_loader_ozone.cc
index 8309c2e4b2afc8e8e38cac4e5cd3eb249a8f37ff..08b831e6d959712e91f4fe22475189423156d8fc 100644
--- a/ui/base/cursor/cursor_loader_ozone.cc
+++ b/ui/base/cursor/cursor_loader_ozone.cc
@@ -4,9 +4,10 @@
#include "ui/base/cursor/cursor_loader_ozone.h"
+#include <vector>
+
#include "ui/base/cursor/cursor.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image_skia.h"
+#include "ui/base/cursor/cursor_util.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
namespace ui {
@@ -18,21 +19,27 @@ CursorLoaderOzone::~CursorLoaderOzone() {}
void CursorLoaderOzone::LoadImageCursor(int id,
int resource_id,
const gfx::Point& hot) {
- const gfx::ImageSkia* image =
- ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id);
- const gfx::ImageSkiaRep& image_rep =
- image->GetRepresentation(scale());
- SkBitmap bitmap = image_rep.sk_bitmap();
+ SkBitmap bitmap;
+ gfx::Point hotspot = hot;
+
+ GetImageCursorBitmap(resource_id, scale(), rotation(), &hotspot, &bitmap);
+
cursors_[id] =
- CursorFactoryOzone::GetInstance()->CreateImageCursor(bitmap, hot);
+ CursorFactoryOzone::GetInstance()->CreateImageCursor(bitmap, hotspot);
}
void CursorLoaderOzone::LoadAnimatedCursor(int id,
int resource_id,
const gfx::Point& hot,
int frame_delay_ms) {
- // TODO(dnicoara) Add support: crbug.com/343245
- NOTIMPLEMENTED();
+ std::vector<SkBitmap> bitmaps;
+ gfx::Point hotspot = hot;
+
+ GetAnimatedCursorBitmaps(
+ resource_id, scale(), rotation(), &hotspot, &bitmaps);
+
+ cursors_[id] = CursorFactoryOzone::GetInstance()->CreateAnimatedCursor(
+ bitmaps, hotspot, frame_delay_ms);
}
void CursorLoaderOzone::UnloadAll() {
« no previous file with comments | « no previous file | ui/base/cursor/cursor_loader_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698