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

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

Issue 1508893003: Use proper namespace in skia/ext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 166 NSPoint dip_hotspot = NSPointFromCGPoint(
167 gfx::ScaleToFlooredPoint(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 = skia::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];
178 178
179 return [cursor autorelease]; 179 return [cursor autorelease];
180 } 180 }
181 181
182 } // namespace 182 } // namespace
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if ([rep isKindOfClass:[NSBitmapImageRep class]]) { 347 if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
348 cg_image = [rep CGImage]; 348 cg_image = [rep CGImage];
349 break; 349 break;
350 } 350 }
351 } 351 }
352 352
353 if (cg_image) { 353 if (cg_image) {
354 cursor_info.type = WebCursorInfo::TypeCustom; 354 cursor_info.type = WebCursorInfo::TypeCustom;
355 NSPoint hot_spot = [cursor hotSpot]; 355 NSPoint hot_spot = [cursor hotSpot];
356 cursor_info.hotspot = gfx::Point(hot_spot.x, hot_spot.y); 356 cursor_info.hotspot = gfx::Point(hot_spot.x, hot_spot.y);
357 cursor_info.custom_image = gfx::CGImageToSkBitmap(cg_image); 357 cursor_info.custom_image = skia::CGImageToSkBitmap(cg_image);
358 } else { 358 } else {
359 cursor_info.type = WebCursorInfo::TypePointer; 359 cursor_info.type = WebCursorInfo::TypePointer;
360 } 360 }
361 } 361 }
362 362
363 InitFromCursorInfo(cursor_info); 363 InitFromCursorInfo(cursor_info);
364 } 364 }
365 365
366 void WebCursor::InitPlatformData() { 366 void WebCursor::InitPlatformData() {
367 return; 367 return;
(...skipping 13 matching lines...) Expand all
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
« no previous file with comments | « content/child/npapi/webplugin_delegate_impl_mac.mm ('k') | ios/chrome/browser/suggestions/image_fetcher_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698