| 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 "content/renderer/pepper/pepper_platform_image_2d_impl.h" | 5 #include "content/renderer/pepper/pepper_platform_image_2d_impl.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
| 9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
| 10 #include "ui/surface/transport_dib.h" | 10 #include "ui/surface/transport_dib.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #else | 56 #else |
| 57 static int next_dib_id = 0; | 57 static int next_dib_id = 0; |
| 58 TransportDIB* dib = TransportDIB::Create(buffer_size, next_dib_id++); | 58 TransportDIB* dib = TransportDIB::Create(buffer_size, next_dib_id++); |
| 59 if (!dib) | 59 if (!dib) |
| 60 return NULL; | 60 return NULL; |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 return new PepperPlatformImage2DImpl(width, height, dib); | 63 return new PepperPlatformImage2DImpl(width, height, dib); |
| 64 } | 64 } |
| 65 | 65 |
| 66 skia::PlatformCanvas* PepperPlatformImage2DImpl::Map() { | 66 SkCanvas* PepperPlatformImage2DImpl::Map() { |
| 67 return dib_->GetPlatformCanvas(width_, height_); | 67 return dib_->GetPlatformCanvas(width_, height_); |
| 68 } | 68 } |
| 69 | 69 |
| 70 intptr_t PepperPlatformImage2DImpl::GetSharedMemoryHandle( | 70 intptr_t PepperPlatformImage2DImpl::GetSharedMemoryHandle( |
| 71 uint32* byte_count) const { | 71 uint32* byte_count) const { |
| 72 *byte_count = dib_->size(); | 72 *byte_count = dib_->size(); |
| 73 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
| 74 return reinterpret_cast<intptr_t>(dib_->handle()); | 74 return reinterpret_cast<intptr_t>(dib_->handle()); |
| 75 #elif defined(OS_MACOSX) || defined(OS_ANDROID) | 75 #elif defined(OS_MACOSX) || defined(OS_ANDROID) |
| 76 return static_cast<intptr_t>(dib_->handle().fd); | 76 return static_cast<intptr_t>(dib_->handle().fd); |
| 77 #elif defined(OS_POSIX) | 77 #elif defined(OS_POSIX) |
| 78 return static_cast<intptr_t>(dib_->handle()); | 78 return static_cast<intptr_t>(dib_->handle()); |
| 79 #endif | 79 #endif |
| 80 } | 80 } |
| 81 | 81 |
| 82 TransportDIB* PepperPlatformImage2DImpl::GetTransportDIB() const { | 82 TransportDIB* PepperPlatformImage2DImpl::GetTransportDIB() const { |
| 83 return dib_.get(); | 83 return dib_.get(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace content | 86 } // namespace content |
| OLD | NEW |