| 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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_IMAGE_2D_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_IMAGE_2D_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_IMAGE_2D_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_IMAGE_2D_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "webkit/plugins/ppapi/plugin_delegate.h" | 9 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 // Implements the Image2D using a TransportDIB. | 13 // Implements the Image2D using a TransportDIB. |
| 14 class PepperPlatformImage2DImpl | 14 class PepperPlatformImage2DImpl |
| 15 : public webkit::ppapi::PluginDelegate::PlatformImage2D { | 15 : public webkit::ppapi::PluginDelegate::PlatformImage2D { |
| 16 public: | 16 public: |
| 17 virtual ~PepperPlatformImage2DImpl(); | 17 virtual ~PepperPlatformImage2DImpl(); |
| 18 | 18 |
| 19 // Factory function that properly allocates a TransportDIB according to | 19 // Factory function that properly allocates a TransportDIB according to |
| 20 // the platform. Returns NULL on failure. | 20 // the platform. Returns NULL on failure. |
| 21 static PepperPlatformImage2DImpl* Create(int width, int height); | 21 static PepperPlatformImage2DImpl* Create(int width, int height); |
| 22 | 22 |
| 23 // PlatformImage2D implementation. | 23 // PlatformImage2D implementation. |
| 24 virtual skia::PlatformCanvas* Map() OVERRIDE; | 24 virtual SkCanvas* Map() OVERRIDE; |
| 25 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const OVERRIDE; | 25 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const OVERRIDE; |
| 26 virtual TransportDIB* GetTransportDIB() const OVERRIDE; | 26 virtual TransportDIB* GetTransportDIB() const OVERRIDE; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // This constructor will take ownership of the dib pointer. | 29 // This constructor will take ownership of the dib pointer. |
| 30 // On Mac, we assume that the dib is cached by the browser, so on destruction | 30 // On Mac, we assume that the dib is cached by the browser, so on destruction |
| 31 // we'll tell the browser to free it. | 31 // we'll tell the browser to free it. |
| 32 PepperPlatformImage2DImpl(int width, int height, TransportDIB* dib); | 32 PepperPlatformImage2DImpl(int width, int height, TransportDIB* dib); |
| 33 | 33 |
| 34 int width_; | 34 int width_; |
| 35 int height_; | 35 int height_; |
| 36 scoped_ptr<TransportDIB> dib_; | 36 scoped_ptr<TransportDIB> dib_; |
| 37 | 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(PepperPlatformImage2DImpl); | 38 DISALLOW_COPY_AND_ASSIGN(PepperPlatformImage2DImpl); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace content | 41 } // namespace content |
| 42 | 42 |
| 43 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_IMAGE_2D_IMPL_H_ | 43 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_IMAGE_2D_IMPL_H_ |
| OLD | NEW |