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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 | 44 |
45 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& info, | 45 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& info, |
46 const SkPaint*) { | 46 const SkPaint*) { |
47 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); | 47 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
48 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), | 48 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), |
49 info.fInfo.isOpaque()); | 49 info.fInfo.isOpaque()); |
50 } | 50 } |
51 | 51 |
52 PlatformSurface BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transfo rm, | 52 PlatformSurface BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transfo rm, |
53 const SkIRect& clip_bou nds) { | 53 const SkIRect& clip_bou nds) { |
54 // TODO(tomhudson): propagate transform and clip | |
55 // TODO(zhenghao): What should we return? The ptr to the address of the | 54 // TODO(zhenghao): What should we return? The ptr to the address of the |
56 // pixels? Maybe this won't be called at all. | 55 // pixels? Maybe this won't be called at all. |
57 return accessBitmap(true).getPixels(); | 56 SkPixmap pixmap; |
57 return accessPixels(&pixmap) ? pixmap.writable_addr() : nullptr; | |
tomhudson
2016/09/16 19:37:31
This caches a void* to the SkBitmapDevice's SkBitm
reed1
2016/09/16 20:29:03
Acknowledged.
| |
58 } | 58 } |
59 | 59 |
60 // PlatformCanvas impl | 60 // PlatformCanvas impl |
61 | 61 |
62 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, | 62 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, |
63 uint8_t* data, OnFailureType failureType) { | 63 uint8_t* data, OnFailureType failureType) { |
64 sk_sp<SkBaseDevice> dev( | 64 sk_sp<SkBaseDevice> dev( |
65 BitmapPlatformDevice::Create(width, height, is_opaque, data)); | 65 BitmapPlatformDevice::Create(width, height, is_opaque, data)); |
66 return CreateCanvas(dev, failureType); | 66 return CreateCanvas(dev, failureType); |
67 } | 67 } |
68 | 68 |
69 } // namespace skia | 69 } // namespace skia |
OLD | NEW |