OLD | NEW |
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 Loading... |
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 |
OLD | NEW |