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

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

Issue 280133002: Do not scale cursor image for 2x image (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added test Created 6 years, 7 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
Index: ui/base/cursor/cursor_loader_x11.cc
diff --git a/ui/base/cursor/cursor_loader_x11.cc b/ui/base/cursor/cursor_loader_x11.cc
index 9c2f609bf8e5d370497eaf27d8934d70296f87ec..58ac2cc96a29442215c3ca56bcd60ec6074a1b9c 100644
--- a/ui/base/cursor/cursor_loader_x11.cc
+++ b/ui/base/cursor/cursor_loader_x11.cc
@@ -162,8 +162,10 @@ void CursorLoaderX11::LoadImageCursor(int id,
const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale());
SkBitmap bitmap = image_rep.sk_bitmap();
gfx::Point hotpoint = hot;
+ // TODO(oshima): The cursor should use resource scale factor when
+ // fractional scale factor is enabled. crbug.com/372212
ScaleAndRotateCursorBitmapAndHotpoint(
- scale(), rotation(), &bitmap, &hotpoint);
+ scale() / image_rep.scale(), rotation(), &bitmap, &hotpoint);
XcursorImage* x_image = SkBitmapToXcursorImage(&bitmap, hotpoint);
cursors_[id] = CreateReffedCustomXCursor(x_image);
@@ -174,6 +176,7 @@ void CursorLoaderX11::LoadAnimatedCursor(int id,
int resource_id,
const gfx::Point& hot,
int frame_delay_ms) {
+ // TODO(oshima|tdanderson): Support rotation and fractional scale factor.
tdanderson 2014/05/12 17:30:24 Note that I will likely not have time to work on t
oshima 2014/05/12 20:42:09 No worry, the name in TODO does not mean the perso
const gfx::ImageSkia* image =
ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id);
const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale());
@@ -240,6 +243,10 @@ void CursorLoaderX11::SetPlatformCursor(gfx::NativeCursor* cursor) {
cursor->SetPlatformCursor(xcursor);
}
+::Cursor CursorLoaderX11::GetCursorForTest(int id) {
+ return cursors_[id];
+}
+
bool CursorLoaderX11::IsImageCursor(gfx::NativeCursor native_cursor) {
int type = native_cursor.native_type();
return cursors_.count(type) || animated_cursors_.count(type);

Powered by Google App Engine
This is Rietveld 408576698