| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_skia.h" | 5 #include "skia/ext/bitmap_platform_device_skia.h" |
| 6 #include "skia/ext/platform_canvas.h" | 6 #include "skia/ext/platform_canvas.h" |
| 7 | 7 |
| 8 namespace skia { | 8 namespace skia { |
| 9 | 9 |
| 10 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, | 10 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // PlatformCanvas impl | 58 // PlatformCanvas impl |
| 59 | 59 |
| 60 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, | 60 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, |
| 61 uint8_t* data, OnFailureType failureType) { | 61 uint8_t* data, OnFailureType failureType) { |
| 62 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( | 62 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( |
| 63 BitmapPlatformDevice::Create(width, height, is_opaque, data)); | 63 BitmapPlatformDevice::Create(width, height, is_opaque, data)); |
| 64 return CreateCanvas(dev, failureType); | 64 return CreateCanvas(dev, failureType); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Port of PlatformBitmap to android | |
| 68 PlatformBitmap::~PlatformBitmap() { | |
| 69 // Nothing to do. | |
| 70 } | |
| 71 | |
| 72 bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { | |
| 73 if (!bitmap_.tryAllocN32Pixels(width, height, is_opaque)) | |
| 74 return false; | |
| 75 | |
| 76 surface_ = bitmap_.getPixels(); | |
| 77 return true; | |
| 78 } | |
| 79 | |
| 80 } // namespace skia | 67 } // namespace skia |
| OLD | NEW |