| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = |
| 100 mapped_canvas_->getTopPlatformDevice().accessBitmap(true); | 100 skia::GetTopDevice(mapped_canvas_.get())->accessBitmap(true); |
| 101 | 101 |
| 102 bitmap.lockPixels(); | 102 bitmap.lockPixels(); |
| 103 return bitmap.getAddr(0, 0); | 103 return bitmap.getAddr(0, 0); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ImageData::Unmap() { | 106 void ImageData::Unmap() { |
| 107 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't | 107 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't |
| 108 // possible since deleting the TransportDIB also frees all the handles. | 108 // possible since deleting the TransportDIB also frees all the handles. |
| 109 // We need to add a method to TransportDIB to release the handles. | 109 // We need to add a method to TransportDIB to release the handles. |
| 110 } | 110 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 122 return reinterpret_cast<ImageHandle>(i); | 122 return reinterpret_cast<ImageHandle>(i); |
| 123 #elif defined(OS_MACOSX) | 123 #elif defined(OS_MACOSX) |
| 124 return ImageHandle(i, false); | 124 return ImageHandle(i, false); |
| 125 #else | 125 #else |
| 126 return static_cast<ImageHandle>(i); | 126 return static_cast<ImageHandle>(i); |
| 127 #endif | 127 #endif |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace proxy | 130 } // namespace proxy |
| 131 } // namespace pp | 131 } // namespace pp |
| OLD | NEW |