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

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

Issue 556463002: Revert of tryAllocPixels returns bool, allocPixels requires success (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « content/common/cursors/webcursor.cc ('k') | content/renderer/skia_benchmarking_extension.cc » ('j') | 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 "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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 // If the size is empty, use a 1x1 transparent image. 146 // If the size is empty, use a 1x1 transparent image.
147 gfx::Size size = custom_size; 147 gfx::Size size = custom_size;
148 if (size.IsEmpty()) { 148 if (size.IsEmpty()) {
149 size.SetSize(1, 1); 149 size.SetSize(1, 1);
150 data = NULL; 150 data = NULL;
151 } 151 }
152 152
153 SkBitmap bitmap; 153 SkBitmap bitmap;
154 if (bitmap.tryAllocN32Pixels(size.width(), size.height()) && data) 154 if (bitmap.allocN32Pixels(size.width(), size.height()) && data)
155 memcpy(bitmap.getAddr32(0, 0), data, data_size); 155 memcpy(bitmap.getAddr32(0, 0), data, data_size);
156 else 156 else
157 bitmap.eraseARGB(0, 0, 0, 0); 157 bitmap.eraseARGB(0, 0, 0, 0);
158 158
159 // Convert from pixels to view units. 159 // Convert from pixels to view units.
160 if (custom_scale == 0) 160 if (custom_scale == 0)
161 custom_scale = 1; 161 custom_scale = 1;
162 NSSize dip_size = NSSizeFromCGSize(gfx::ToFlooredSize( 162 NSSize dip_size = NSSizeFromCGSize(gfx::ToFlooredSize(
163 gfx::ScaleSize(custom_size, 1 / custom_scale)).ToCGSize()); 163 gfx::ScaleSize(custom_size, 1 / custom_scale)).ToCGSize());
164 NSPoint dip_hotspot = NSPointFromCGPoint(gfx::ToFlooredPoint( 164 NSPoint dip_hotspot = NSPointFromCGPoint(gfx::ToFlooredPoint(
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 379
380 void WebCursor::CleanupPlatformData() { 380 void WebCursor::CleanupPlatformData() {
381 return; 381 return;
382 } 382 }
383 383
384 void WebCursor::CopyPlatformData(const WebCursor& other) { 384 void WebCursor::CopyPlatformData(const WebCursor& other) {
385 return; 385 return;
386 } 386 }
387 387
388 } // namespace content 388 } // namespace content
OLDNEW
« no previous file with comments | « content/common/cursors/webcursor.cc ('k') | content/renderer/skia_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698