| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 384 |
| 385 PlatformImageData::~PlatformImageData() { | 385 PlatformImageData::~PlatformImageData() { |
| 386 } | 386 } |
| 387 | 387 |
| 388 void* PlatformImageData::Map() { | 388 void* PlatformImageData::Map() { |
| 389 if (!mapped_canvas_.get()) { | 389 if (!mapped_canvas_.get()) { |
| 390 if (!transport_dib_.get()) | 390 if (!transport_dib_.get()) |
| 391 return NULL; | 391 return NULL; |
| 392 | 392 |
| 393 const bool is_opaque = false; | 393 const bool is_opaque = false; |
| 394 mapped_canvas_ = transport_dib_->GetPlatformCanvas( | 394 mapped_canvas_ = |
| 395 desc_.size.width, desc_.size.height, is_opaque); | 395 sk_sp<SkCanvas>(transport_dib_->GetPlatformCanvas(desc_.size.width, |
| 396 desc_.size.height, |
| 397 is_opaque)); |
| 396 if (!mapped_canvas_.get()) | 398 if (!mapped_canvas_.get()) |
| 397 return NULL; | 399 return NULL; |
| 398 } | 400 } |
| 399 SkPixmap pixmap; | 401 SkPixmap pixmap; |
| 400 skia::GetWritablePixels(mapped_canvas_.get(), &pixmap); | 402 skia::GetWritablePixels(mapped_canvas_.get(), &pixmap); |
| 401 return pixmap.writable_addr(); | 403 return pixmap.writable_addr(); |
| 402 } | 404 } |
| 403 | 405 |
| 404 void PlatformImageData::Unmap() { | 406 void PlatformImageData::Unmap() { |
| 405 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't | 407 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 // still cached in our process, the proxy still holds a reference so we can | 673 // still cached in our process, the proxy still holds a reference so we can |
| 672 // remove the one the renderer just sent is. If the proxy no longer holds a | 674 // remove the one the renderer just sent is. If the proxy no longer holds a |
| 673 // reference, we released everything and we should also release the one the | 675 // reference, we released everything and we should also release the one the |
| 674 // renderer just sent us. | 676 // renderer just sent us. |
| 675 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( | 677 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( |
| 676 API_ID_PPB_CORE, old_image_data)); | 678 API_ID_PPB_CORE, old_image_data)); |
| 677 } | 679 } |
| 678 | 680 |
| 679 } // namespace proxy | 681 } // namespace proxy |
| 680 } // namespace ppapi | 682 } // namespace ppapi |
| OLD | NEW |