| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ppapi/c/ppb_image_data.h" | 10 #include "ppapi/c/ppb_image_data.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 PP_ImageDataFormat format() const { return format_; } | 41 PP_ImageDataFormat format() const { return format_; } |
| 42 | 42 |
| 43 // Returns true if this image is mapped. False means that the image is either | 43 // Returns true if this image is mapped. False means that the image is either |
| 44 // invalid or not mapped. See ImageDataAutoMapper below. | 44 // invalid or not mapped. See ImageDataAutoMapper below. |
| 45 bool is_mapped() const { return !!mapped_canvas_.get(); } | 45 bool is_mapped() const { return !!mapped_canvas_.get(); } |
| 46 | 46 |
| 47 PluginDelegate::PlatformImage2D* platform_image() const { | 47 PluginDelegate::PlatformImage2D* platform_image() const { |
| 48 return platform_image_.get(); | 48 return platform_image_.get(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Returns a pointer to the interface implementing PPB_ImageData that is | 51 virtual ::ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE; |
| 52 // exposed to the plugin. | |
| 53 static const PPB_ImageData* GetInterface(); | |
| 54 static const PPB_ImageDataTrusted* GetTrustedInterface(); | |
| 55 | |
| 56 virtual ::ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API(); | |
| 57 | 52 |
| 58 // Resource overrides. | 53 // Resource overrides. |
| 59 virtual PPB_ImageData_Impl* AsPPB_ImageData_Impl(); | 54 virtual PPB_ImageData_Impl* AsPPB_ImageData_Impl() OVERRIDE; |
| 60 | 55 |
| 61 // PPB_ImageData_API implementation. | 56 // PPB_ImageData_API implementation. |
| 62 virtual PP_Bool Describe(PP_ImageDataDesc* desc); | 57 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE; |
| 63 virtual void* Map(); | 58 virtual void* Map() OVERRIDE; |
| 64 virtual void Unmap(); | 59 virtual void Unmap() OVERRIDE; |
| 65 | 60 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE; |
| 66 // PPB_ImageDataTrusted implementation. | |
| 67 int GetSharedMemoryHandle(uint32* byte_count) const; | |
| 68 | 61 |
| 69 // The mapped bitmap and canvas will be NULL if the image is not mapped. | 62 // The mapped bitmap and canvas will be NULL if the image is not mapped. |
| 70 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); } | 63 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); } |
| 71 const SkBitmap* GetMappedBitmap() const; | 64 const SkBitmap* GetMappedBitmap() const; |
| 72 | 65 |
| 73 // Swaps the guts of this image data with another. | 66 // Swaps the guts of this image data with another. |
| 74 void Swap(PPB_ImageData_Impl* other); | 67 void Swap(PPB_ImageData_Impl* other); |
| 75 | 68 |
| 76 private: | 69 private: |
| 77 // This will be NULL before initialization, and if this PPB_ImageData_Impl is | 70 // This will be NULL before initialization, and if this PPB_ImageData_Impl is |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 bool is_valid_; | 117 bool is_valid_; |
| 125 bool needs_unmap_; | 118 bool needs_unmap_; |
| 126 | 119 |
| 127 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); | 120 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); |
| 128 }; | 121 }; |
| 129 | 122 |
| 130 } // namespace ppapi | 123 } // namespace ppapi |
| 131 } // namespace webkit | 124 } // namespace webkit |
| 132 | 125 |
| 133 #endif // WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ | 126 #endif // WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ |
| OLD | NEW |