| 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 | |
| 14 SkBitmap bitmap; | 11 SkBitmap bitmap; |
| 15 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 12 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); |
| 16 if (bitmap.allocPixels()) { | 13 if (bitmap.allocPixels()) { |
| 17 bitmap.setIsOpaque(is_opaque); | 14 bitmap.setIsOpaque(is_opaque); |
| 18 // Follow the logic in SkCanvas::createDevice(), initialize the bitmap if it | 15 // Follow the logic in SkCanvas::createDevice(), initialize the bitmap if it |
| 19 // is not opaque. | 16 // is not opaque. |
| 20 if (!is_opaque) | 17 if (!is_opaque) |
| 21 bitmap.eraseARGB(0, 0, 0, 0); | 18 bitmap.eraseARGB(0, 0, 0, 0); |
| 22 return new BitmapPlatformDevice(bitmap); | 19 return new BitmapPlatformDevice(bitmap); |
| 23 } | 20 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return accessBitmap(true).getPixels(); | 65 return accessBitmap(true).getPixels(); |
| 69 } | 66 } |
| 70 | 67 |
| 71 void BitmapPlatformDevice::DrawToNativeContext( | 68 void BitmapPlatformDevice::DrawToNativeContext( |
| 72 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { | 69 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { |
| 73 // Should never be called on Android. | 70 // Should never be called on Android. |
| 74 SkASSERT(false); | 71 SkASSERT(false); |
| 75 } | 72 } |
| 76 | 73 |
| 77 } // namespace skia | 74 } // namespace skia |
| OLD | NEW |