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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_x11.h" 5 #include "ui/base/cursor/cursor_loader_x11.h"
6 6
7 #include <float.h> 7 #include <float.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/cursorfont.h> 9 #include <X11/cursorfont.h>
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 void CursorLoaderX11::LoadImageCursor(int id, 157 void CursorLoaderX11::LoadImageCursor(int id,
158 int resource_id, 158 int resource_id,
159 const gfx::Point& hot) { 159 const gfx::Point& hot) {
160 const gfx::ImageSkia* image = 160 const gfx::ImageSkia* image =
161 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); 161 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id);
162 const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale()); 162 const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale());
163 SkBitmap bitmap = image_rep.sk_bitmap(); 163 SkBitmap bitmap = image_rep.sk_bitmap();
164 gfx::Point hotpoint = hot; 164 gfx::Point hotpoint = hot;
165 // TODO(oshima): The cursor should use resource scale factor when
166 // fractional scale factor is enabled. crbug.com/372212
165 ScaleAndRotateCursorBitmapAndHotpoint( 167 ScaleAndRotateCursorBitmapAndHotpoint(
166 scale(), rotation(), &bitmap, &hotpoint); 168 scale() / image_rep.scale(), rotation(), &bitmap, &hotpoint);
tdanderson 2014/05/12 13:53:09 What caused this regression in the first place?
167 169
168 XcursorImage* x_image = SkBitmapToXcursorImage(&bitmap, hotpoint); 170 XcursorImage* x_image = SkBitmapToXcursorImage(&bitmap, hotpoint);
169 cursors_[id] = CreateReffedCustomXCursor(x_image); 171 cursors_[id] = CreateReffedCustomXCursor(x_image);
170 // |image_rep| is owned by the resource bundle. So we do not need to free it. 172 // |image_rep| is owned by the resource bundle. So we do not need to free it.
171 } 173 }
172 174
173 void CursorLoaderX11::LoadAnimatedCursor(int id, 175 void CursorLoaderX11::LoadAnimatedCursor(int id,
174 int resource_id, 176 int resource_id,
175 const gfx::Point& hot, 177 const gfx::Point& hot,
176 int frame_delay_ms) { 178 int frame_delay_ms) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (animated_cursors_.count(type)) 253 if (animated_cursors_.count(type))
252 return animated_cursors_[type].first; 254 return animated_cursors_[type].first;
253 255
254 ImageCursorMap::iterator find = cursors_.find(type); 256 ImageCursorMap::iterator find = cursors_.find(type);
255 if (find != cursors_.end()) 257 if (find != cursors_.end())
256 return cursors_[type]; 258 return cursors_[type];
257 return GetXCursor(CursorShapeFromNative(native_cursor)); 259 return GetXCursor(CursorShapeFromNative(native_cursor));
258 } 260 }
259 261
260 } // namespace ui 262 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698