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 <stdint.h> |
| 6 |
5 #include "skia/ext/bitmap_platform_device_skia.h" | 7 #include "skia/ext/bitmap_platform_device_skia.h" |
6 #include "skia/ext/platform_canvas.h" | 8 #include "skia/ext/platform_canvas.h" |
7 | 9 |
8 namespace skia { | 10 namespace skia { |
9 | 11 |
10 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, | 12 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, |
11 bool is_opaque) { | 13 bool is_opaque) { |
12 SkBitmap bitmap; | 14 SkBitmap bitmap; |
13 if (bitmap.tryAllocN32Pixels(width, height, is_opaque)) { | 15 if (bitmap.tryAllocN32Pixels(width, height, is_opaque)) { |
14 // Follow the logic in SkCanvas::createDevice(), initialize the bitmap if it | 16 // Follow the logic in SkCanvas::createDevice(), initialize the bitmap if it |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // PlatformCanvas impl | 60 // PlatformCanvas impl |
59 | 61 |
60 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, | 62 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, |
61 uint8_t* data, OnFailureType failureType) { | 63 uint8_t* data, OnFailureType failureType) { |
62 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( | 64 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( |
63 BitmapPlatformDevice::Create(width, height, is_opaque, data)); | 65 BitmapPlatformDevice::Create(width, height, is_opaque, data)); |
64 return CreateCanvas(dev, failureType); | 66 return CreateCanvas(dev, failureType); |
65 } | 67 } |
66 | 68 |
67 } // namespace skia | 69 } // namespace skia |
OLD | NEW |