| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 skia::GetWritablePixels(mapped_canvas_.get(), &pixmap); | 397 skia::GetWritablePixels(mapped_canvas_.get(), &pixmap); |
| 398 return pixmap.writable_addr(); | 398 return pixmap.writable_addr(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void PlatformImageData::Unmap() { | 401 void PlatformImageData::Unmap() { |
| 402 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't | 402 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't |
| 403 // possible since deleting the TransportDIB also frees all the handles. | 403 // possible since deleting the TransportDIB also frees all the handles. |
| 404 // We need to add a method to TransportDIB to release the handles. | 404 // We need to add a method to TransportDIB to release the handles. |
| 405 } | 405 } |
| 406 | 406 |
| 407 SkCanvas* PlatformImageData::GetPlatformCanvas() { | 407 CdlCanvas* PlatformImageData::GetPlatformCanvas() { |
| 408 return mapped_canvas_.get(); | 408 return mapped_canvas_.get(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 SkCanvas* PlatformImageData::GetCanvas() { | 411 CdlCanvas* PlatformImageData::GetCanvas() { |
| 412 return mapped_canvas_.get(); | 412 return mapped_canvas_.get(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 // static | 415 // static |
| 416 ImageHandle PlatformImageData::NullHandle() { | 416 ImageHandle PlatformImageData::NullHandle() { |
| 417 return ImageHandle(); | 417 return ImageHandle(); |
| 418 } | 418 } |
| 419 #endif // !defined(OS_NACL) | 419 #endif // !defined(OS_NACL) |
| 420 | 420 |
| 421 // SimpleImageData ------------------------------------------------------------- | 421 // SimpleImageData ------------------------------------------------------------- |
| (...skipping 14 matching lines...) Expand all Loading... |
| 436 if (map_count_++ == 0) | 436 if (map_count_++ == 0) |
| 437 shm_.Map(size_); | 437 shm_.Map(size_); |
| 438 return shm_.memory(); | 438 return shm_.memory(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void SimpleImageData::Unmap() { | 441 void SimpleImageData::Unmap() { |
| 442 if (--map_count_ == 0) | 442 if (--map_count_ == 0) |
| 443 shm_.Unmap(); | 443 shm_.Unmap(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 SkCanvas* SimpleImageData::GetPlatformCanvas() { | 446 CdlCanvas* SimpleImageData::GetPlatformCanvas() { |
| 447 return NULL; // No canvas available. | 447 return NULL; // No canvas available. |
| 448 } | 448 } |
| 449 | 449 |
| 450 SkCanvas* SimpleImageData::GetCanvas() { | 450 CdlCanvas* SimpleImageData::GetCanvas() { |
| 451 return NULL; // No canvas available. | 451 return NULL; // No canvas available. |
| 452 } | 452 } |
| 453 | 453 |
| 454 // PPB_ImageData_Proxy --------------------------------------------------------- | 454 // PPB_ImageData_Proxy --------------------------------------------------------- |
| 455 | 455 |
| 456 PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher) | 456 PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher) |
| 457 : InterfaceProxy(dispatcher) { | 457 : InterfaceProxy(dispatcher) { |
| 458 } | 458 } |
| 459 | 459 |
| 460 PPB_ImageData_Proxy::~PPB_ImageData_Proxy() { | 460 PPB_ImageData_Proxy::~PPB_ImageData_Proxy() { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 // still cached in our process, the proxy still holds a reference so we can | 668 // still cached in our process, the proxy still holds a reference so we can |
| 669 // remove the one the renderer just sent is. If the proxy no longer holds a | 669 // remove the one the renderer just sent is. If the proxy no longer holds a |
| 670 // reference, we released everything and we should also release the one the | 670 // reference, we released everything and we should also release the one the |
| 671 // renderer just sent us. | 671 // renderer just sent us. |
| 672 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( | 672 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( |
| 673 API_ID_PPB_CORE, old_image_data)); | 673 API_ID_PPB_CORE, old_image_data)); |
| 674 } | 674 } |
| 675 | 675 |
| 676 } // namespace proxy | 676 } // namespace proxy |
| 677 } // namespace ppapi | 677 } // namespace ppapi |
| OLD | NEW |