OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_image_data_proxy.h" | 5 #include "ppapi/proxy/ppb_image_data_proxy.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return PP_TRUE; | 89 return PP_TRUE; |
90 } | 90 } |
91 | 91 |
92 void* ImageData::Map() { | 92 void* ImageData::Map() { |
93 if (!mapped_canvas_.get()) { | 93 if (!mapped_canvas_.get()) { |
94 mapped_canvas_.reset(transport_dib_->GetPlatformCanvas(desc_.size.width, | 94 mapped_canvas_.reset(transport_dib_->GetPlatformCanvas(desc_.size.width, |
95 desc_.size.height)); | 95 desc_.size.height)); |
96 if (!mapped_canvas_.get()) | 96 if (!mapped_canvas_.get()) |
97 return NULL; | 97 return NULL; |
98 } | 98 } |
99 const SkBitmap& bitmap = | 99 const SkBitmap& bitmap = mapped_canvas_->getTopDevice().accessBitmap(true); |
100 mapped_canvas_->getTopPlatformDevice().accessBitmap(true); | |
101 | 100 |
102 bitmap.lockPixels(); | 101 bitmap.lockPixels(); |
103 return bitmap.getAddr(0, 0); | 102 return bitmap.getAddr(0, 0); |
104 } | 103 } |
105 | 104 |
106 void ImageData::Unmap() { | 105 void ImageData::Unmap() { |
107 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't | 106 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't |
108 // possible since deleting the TransportDIB also frees all the handles. | 107 // possible since deleting the TransportDIB also frees all the handles. |
109 // We need to add a method to TransportDIB to release the handles. | 108 // We need to add a method to TransportDIB to release the handles. |
110 } | 109 } |
(...skipping 11 matching lines...) Expand all Loading... |
122 return reinterpret_cast<ImageHandle>(i); | 121 return reinterpret_cast<ImageHandle>(i); |
123 #elif defined(OS_MACOSX) | 122 #elif defined(OS_MACOSX) |
124 return ImageHandle(i, false); | 123 return ImageHandle(i, false); |
125 #else | 124 #else |
126 return static_cast<ImageHandle>(i); | 125 return static_cast<ImageHandle>(i); |
127 #endif | 126 #endif |
128 } | 127 } |
129 | 128 |
130 } // namespace proxy | 129 } // namespace proxy |
131 } // namespace pp | 130 } // namespace pp |
OLD | NEW |