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 #include "webkit/plugins/ppapi/resource_creation_impl.h" | 5 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
6 | 6 |
7 #include "ppapi/c/pp_size.h" | 7 #include "ppapi/c/pp_size.h" |
| 8 #include "ppapi/shared_impl/font_impl.h" |
8 #include "webkit/plugins/ppapi/common.h" | 9 #include "webkit/plugins/ppapi/common.h" |
| 10 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
9 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 11 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
10 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 12 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
11 | 13 |
12 namespace webkit { | 14 namespace webkit { |
13 namespace ppapi { | 15 namespace ppapi { |
14 | 16 |
15 ResourceCreationImpl::ResourceCreationImpl() { | 17 ResourceCreationImpl::ResourceCreationImpl() { |
16 } | 18 } |
17 | 19 |
18 ResourceCreationImpl::~ResourceCreationImpl() { | 20 ResourceCreationImpl::~ResourceCreationImpl() { |
19 } | 21 } |
20 | 22 |
21 ::ppapi::thunk::ResourceCreationAPI* | 23 ::ppapi::thunk::ResourceCreationAPI* |
22 ResourceCreationImpl::AsResourceCreation() { | 24 ResourceCreationImpl::AsResourceCreation() { |
23 return this; | 25 return this; |
24 } | 26 } |
25 | 27 |
| 28 PP_Resource ResourceCreationImpl::CreateFontObject( |
| 29 PP_Instance pp_instance, |
| 30 const PP_FontDescription_Dev* description) { |
| 31 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
| 32 if (!instance) |
| 33 return 0; |
| 34 |
| 35 if (!pp::shared_impl::FontImpl::IsPPFontDescriptionValid(*description)) |
| 36 return 0; |
| 37 |
| 38 scoped_refptr<PPB_Font_Impl> font(new PPB_Font_Impl(instance, *description)); |
| 39 return font->GetReference(); |
| 40 } |
| 41 |
26 PP_Resource ResourceCreationImpl::CreateGraphics2D( | 42 PP_Resource ResourceCreationImpl::CreateGraphics2D( |
27 PP_Instance pp_instance, | 43 PP_Instance pp_instance, |
28 const PP_Size& size, | 44 const PP_Size& size, |
29 PP_Bool is_always_opaque) { | 45 PP_Bool is_always_opaque) { |
30 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 46 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
31 if (!instance) | 47 if (!instance) |
32 return 0; | 48 return 0; |
33 | 49 |
34 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d( | 50 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d( |
35 new PPB_Graphics2D_Impl(instance)); | 51 new PPB_Graphics2D_Impl(instance)); |
(...skipping 13 matching lines...) Expand all Loading... |
49 return 0; | 65 return 0; |
50 | 66 |
51 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); | 67 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); |
52 if (!data->Init(format, size.width, size.height, !!init_to_zero)) | 68 if (!data->Init(format, size.width, size.height, !!init_to_zero)) |
53 return 0; | 69 return 0; |
54 return data->GetReference(); | 70 return data->GetReference(); |
55 } | 71 } |
56 | 72 |
57 } // namespace ppapi | 73 } // namespace ppapi |
58 } // namespace webkit | 74 } // namespace webkit |
OLD | NEW |