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" |
11 #include "ppapi/shared_impl/image_data_impl.h" | 11 #include "ppapi/shared_impl/image_data_impl.h" |
12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
13 #include "ppapi/thunk/ppb_image_data_api.h" | 13 #include "ppapi/thunk/ppb_image_data_api.h" |
14 #include "webkit/plugins/ppapi/plugin_delegate.h" | 14 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 15 #include "webkit/plugins/webkit_plugins_export.h" |
15 | 16 |
16 namespace skia { | 17 namespace skia { |
17 class PlatformCanvas; | 18 class PlatformCanvas; |
18 } | 19 } |
19 | 20 |
20 class SkBitmap; | 21 class SkBitmap; |
21 | 22 |
22 namespace webkit { | 23 namespace webkit { |
23 namespace ppapi { | 24 namespace ppapi { |
24 | 25 |
25 class PPB_ImageData_Impl : public ::ppapi::Resource, | 26 class PPB_ImageData_Impl : public ::ppapi::Resource, |
26 public ::ppapi::ImageDataImpl, | 27 public ::ppapi::ImageDataImpl, |
27 public ::ppapi::thunk::PPB_ImageData_API { | 28 public ::ppapi::thunk::PPB_ImageData_API { |
28 public: | 29 public: |
29 // If you call this constructor, you must also call Init before use. Normally | 30 // If you call this constructor, you must also call Init before use. Normally |
30 // you should use the static Create function, but this constructor is needed | 31 // you should use the static Create function, but this constructor is needed |
31 // for some internal uses of ImageData (like Graphics2D). | 32 // for some internal uses of ImageData (like Graphics2D). |
32 explicit PPB_ImageData_Impl(PP_Instance instance); | 33 WEBKIT_PLUGINS_EXPORT explicit PPB_ImageData_Impl(PP_Instance instance); |
33 virtual ~PPB_ImageData_Impl(); | 34 virtual ~PPB_ImageData_Impl(); |
34 | 35 |
35 static PP_Resource Create(PP_Instance pp_instance, | 36 static PP_Resource Create(PP_Instance pp_instance, |
36 PP_ImageDataFormat format, | 37 PP_ImageDataFormat format, |
37 const PP_Size& size, | 38 const PP_Size& size, |
38 PP_Bool init_to_zero); | 39 PP_Bool init_to_zero); |
39 | 40 |
40 bool Init(PP_ImageDataFormat format, | 41 WEBKIT_PLUGINS_EXPORT bool Init(PP_ImageDataFormat format, |
41 int width, int height, | 42 int width, int height, |
42 bool init_to_zero); | 43 bool init_to_zero); |
43 | 44 |
44 int width() const { return width_; } | 45 int width() const { return width_; } |
45 int height() const { return height_; } | 46 int height() const { return height_; } |
46 | 47 |
47 // Returns the image format. | 48 // Returns the image format. |
48 PP_ImageDataFormat format() const { return format_; } | 49 PP_ImageDataFormat format() const { return format_; } |
49 | 50 |
50 // Returns true if this image is mapped. False means that the image is either | 51 // Returns true if this image is mapped. False means that the image is either |
51 // invalid or not mapped. See ImageDataAutoMapper below. | 52 // invalid or not mapped. See ImageDataAutoMapper below. |
52 bool is_mapped() const { return !!mapped_canvas_.get(); } | 53 bool is_mapped() const { return !!mapped_canvas_.get(); } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 bool is_valid_; | 122 bool is_valid_; |
122 bool needs_unmap_; | 123 bool needs_unmap_; |
123 | 124 |
124 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); | 125 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); |
125 }; | 126 }; |
126 | 127 |
127 } // namespace ppapi | 128 } // namespace ppapi |
128 } // namespace webkit | 129 } // namespace webkit |
129 | 130 |
130 #endif // WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ | 131 #endif // WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ |
OLD | NEW |