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