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

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

Issue 10908266: 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.h ('k') | skia/ext/bitmap_platform_device_mac.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 "skia/ext/bitmap_platform_device_android.h" 5 #include "skia/ext/bitmap_platform_device_android.h"
6 6
7 namespace skia { 7 namespace skia {
8 8
9 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, 9 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height,
10 bool is_opaque) { 10 bool is_opaque) {
11 if (RasterDeviceTooBigToAllocate(width, height))
12 return NULL;
13
11 SkBitmap bitmap; 14 SkBitmap bitmap;
12 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); 15 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
13 if (bitmap.allocPixels()) { 16 if (bitmap.allocPixels()) {
14 bitmap.setIsOpaque(is_opaque); 17 bitmap.setIsOpaque(is_opaque);
15 // Follow the logic in SkCanvas::createDevice(), initialize the bitmap if it 18 // Follow the logic in SkCanvas::createDevice(), initialize the bitmap if it
16 // is not opaque. 19 // is not opaque.
17 if (!is_opaque) 20 if (!is_opaque)
18 bitmap.eraseARGB(0, 0, 0, 0); 21 bitmap.eraseARGB(0, 0, 0, 0);
19 return new BitmapPlatformDevice(bitmap); 22 return new BitmapPlatformDevice(bitmap);
20 } 23 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return accessBitmap(true).getPixels(); 68 return accessBitmap(true).getPixels();
66 } 69 }
67 70
68 void BitmapPlatformDevice::DrawToNativeContext( 71 void BitmapPlatformDevice::DrawToNativeContext(
69 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { 72 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) {
70 // Should never be called on Android. 73 // Should never be called on Android.
71 SkASSERT(false); 74 SkASSERT(false);
72 } 75 }
73 76
74 } // namespace skia 77 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device.h ('k') | skia/ext/bitmap_platform_device_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698