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

Side by Side Diff: content/common/cursors/webcursor_mac.mm

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-event: mandol_line Created 5 years, 1 month 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
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 "content/common/cursors/webcursor.h" 5 #include "content/common/cursors/webcursor.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (bitmap.tryAllocPixels(image_info) && data) 156 if (bitmap.tryAllocPixels(image_info) && data)
157 memcpy(bitmap.getAddr32(0, 0), data, data_size); 157 memcpy(bitmap.getAddr32(0, 0), data, data_size);
158 else 158 else
159 bitmap.eraseARGB(0, 0, 0, 0); 159 bitmap.eraseARGB(0, 0, 0, 0);
160 160
161 // Convert from pixels to view units. 161 // Convert from pixels to view units.
162 if (custom_scale == 0) 162 if (custom_scale == 0)
163 custom_scale = 1; 163 custom_scale = 1;
164 NSSize dip_size = NSSizeFromCGSize( 164 NSSize dip_size = NSSizeFromCGSize(
165 gfx::ScaleToFlooredSize(custom_size, 1 / custom_scale).ToCGSize()); 165 gfx::ScaleToFlooredSize(custom_size, 1 / custom_scale).ToCGSize());
166 NSPoint dip_hotspot = NSPointFromCGPoint(gfx::ToFlooredPoint( 166 NSPoint dip_hotspot = NSPointFromCGPoint(
167 gfx::ScalePoint(hotspot, 1 / custom_scale)).ToCGPoint()); 167 gfx::ScaleToFlooredPoint(hotspot, 1 / custom_scale).ToCGPoint());
168 168
169 // Both the image and its representation need to have the same size for 169 // Both the image and its representation need to have the same size for
170 // cursors to appear in high resolution on retina displays. Note that the 170 // cursors to appear in high resolution on retina displays. Note that the
171 // size of a representation is not the same as pixelsWide or pixelsHigh. 171 // size of a representation is not the same as pixelsWide or pixelsHigh.
172 NSImage* cursor_image = gfx::SkBitmapToNSImage(bitmap); 172 NSImage* cursor_image = gfx::SkBitmapToNSImage(bitmap);
173 [cursor_image setSize:dip_size]; 173 [cursor_image setSize:dip_size];
174 [[[cursor_image representations] objectAtIndex:0] setSize:dip_size]; 174 [[[cursor_image representations] objectAtIndex:0] setSize:dip_size];
175 175
176 NSCursor* cursor = [[NSCursor alloc] initWithImage:cursor_image 176 NSCursor* cursor = [[NSCursor alloc] initWithImage:cursor_image
177 hotSpot:dip_hotspot]; 177 hotSpot:dip_hotspot];
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 void WebCursor::CleanupPlatformData() { 382 void WebCursor::CleanupPlatformData() {
383 return; 383 return;
384 } 384 }
385 385
386 void WebCursor::CopyPlatformData(const WebCursor& other) { 386 void WebCursor::CopyPlatformData(const WebCursor& other) {
387 return; 387 return;
388 } 388 }
389 389
390 } // namespace content 390 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698