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

Side by Side Diff: skia/ext/bitmap_platform_device_mac.cc

Issue 10928219: Revert 156969 - Add define to limit recommended offscreen allocations. This avoids some failures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « skia/ext/bitmap_platform_device_android.cc ('k') | 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 "skia/ext/bitmap_platform_device_mac.h" 5 #include "skia/ext/bitmap_platform_device_mac.h"
6 6
7 #import <ApplicationServices/ApplicationServices.h> 7 #import <ApplicationServices/ApplicationServices.h>
8 #include <time.h> 8 #include <time.h>
9 9
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 108
109 // We use this static factory function instead of the regular constructor so 109 // We use this static factory function instead of the regular constructor so
110 // that we can create the pixel data before calling the constructor. This is 110 // that we can create the pixel data before calling the constructor. This is
111 // required so that we can call the base class' constructor with the pixel 111 // required so that we can call the base class' constructor with the pixel
112 // data. 112 // data.
113 BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context, 113 BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context,
114 int width, 114 int width,
115 int height, 115 int height,
116 bool is_opaque) { 116 bool is_opaque) {
117 if (RasterDeviceTooBigToAllocate(width, height))
118 return NULL;
119
120 SkBitmap bitmap; 117 SkBitmap bitmap;
121 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); 118 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
122 if (bitmap.allocPixels() != true) 119 if (bitmap.allocPixels() != true)
123 return NULL; 120 return NULL;
124 121
125 void* data = NULL; 122 void* data = NULL;
126 if (context) { 123 if (context) {
127 data = CGBitmapContextGetData(context); 124 data = CGBitmapContextGetData(context);
128 bitmap.setPixels(data); 125 bitmap.setPixels(data);
129 } else { 126 } else {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( 245 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
249 SkBitmap::Config config, int width, int height, bool isOpaque, 246 SkBitmap::Config config, int width, int height, bool isOpaque,
250 Usage /*usage*/) { 247 Usage /*usage*/) {
251 SkASSERT(config == SkBitmap::kARGB_8888_Config); 248 SkASSERT(config == SkBitmap::kARGB_8888_Config);
252 SkDevice* bitmap_device = BitmapPlatformDevice::CreateAndClear(width, height, 249 SkDevice* bitmap_device = BitmapPlatformDevice::CreateAndClear(width, height,
253 isOpaque); 250 isOpaque);
254 return bitmap_device; 251 return bitmap_device;
255 } 252 }
256 253
257 } // namespace skia 254 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698