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 | 45 |
46 BitmapPlatformDevice::BitmapPlatformDevice(const SkBitmap& bitmap) | 46 BitmapPlatformDevice::BitmapPlatformDevice(const SkBitmap& bitmap) |
47 : SkBitmapDevice(bitmap) { | 47 : SkBitmapDevice(bitmap) { |
48 SetPlatformDevice(this, this); | 48 SetPlatformDevice(this, this); |
49 } | 49 } |
50 | 50 |
51 BitmapPlatformDevice::~BitmapPlatformDevice() { | 51 BitmapPlatformDevice::~BitmapPlatformDevice() { |
52 } | 52 } |
53 | 53 |
54 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const SkImageInfo& info, | 54 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
55 Usage /*usage*/) { | 55 const CreateInfo& info) { |
56 SkASSERT(info.colorType() == kN32_SkColorType); | 56 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
57 return BitmapPlatformDevice::Create(info.width(), info.height(), | 57 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), |
58 info.isOpaque()); | 58 info.fInfo.isOpaque()); |
59 } | 59 } |
60 | 60 |
61 PlatformSurface BitmapPlatformDevice::BeginPlatformPaint() { | 61 PlatformSurface BitmapPlatformDevice::BeginPlatformPaint() { |
62 // TODO(zhenghao): What should we return? The ptr to the address of the | 62 // TODO(zhenghao): What should we return? The ptr to the address of the |
63 // pixels? Maybe this won't be called at all. | 63 // pixels? Maybe this won't be called at all. |
64 return accessBitmap(true).getPixels(); | 64 return accessBitmap(true).getPixels(); |
65 } | 65 } |
66 | 66 |
67 void BitmapPlatformDevice::DrawToNativeContext( | 67 void BitmapPlatformDevice::DrawToNativeContext( |
68 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { | 68 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { |
(...skipping 17 matching lines...) Expand all Loading... |
86 | 86 |
87 bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { | 87 bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { |
88 if (!bitmap_.tryAllocN32Pixels(width, height, is_opaque)) | 88 if (!bitmap_.tryAllocN32Pixels(width, height, is_opaque)) |
89 return false; | 89 return false; |
90 | 90 |
91 surface_ = bitmap_.getPixels(); | 91 surface_ = bitmap_.getPixels(); |
92 return true; | 92 return true; |
93 } | 93 } |
94 | 94 |
95 } // namespace skia | 95 } // namespace skia |
OLD | NEW |