OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_plugin_instance.h" | 5 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "gfx/rect.h" | 9 #include "gfx/rect.h" |
10 #include "third_party/ppapi/c/pp_instance.h" | 10 #include "third_party/ppapi/c/pp_instance.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 module_->InstanceDeleted(this); | 151 module_->InstanceDeleted(this); |
152 } | 152 } |
153 | 153 |
154 // static | 154 // static |
155 const PPB_Instance* PluginInstance::GetInterface() { | 155 const PPB_Instance* PluginInstance::GetInterface() { |
156 return &ppb_instance; | 156 return &ppb_instance; |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 PluginInstance* PluginInstance::FromPPInstance(PP_Instance instance) { | 160 PluginInstance* PluginInstance::FromPPInstance(PP_Instance instance) { |
161 return reinterpret_cast<PluginInstance*>(instance.id); | 161 return reinterpret_cast<PluginInstance*>(instance); |
162 } | 162 } |
163 | 163 |
164 PP_Instance PluginInstance::GetPPInstance() { | 164 PP_Instance PluginInstance::GetPPInstance() { |
165 PP_Instance ret; | 165 return reinterpret_cast<intptr_t>(this); |
166 ret.id = reinterpret_cast<intptr_t>(this); | |
167 return ret; | |
168 } | 166 } |
169 | 167 |
170 void PluginInstance::Paint(WebKit::WebCanvas* canvas, | 168 void PluginInstance::Paint(WebKit::WebCanvas* canvas, |
171 const gfx::Rect& plugin_rect, | 169 const gfx::Rect& plugin_rect, |
172 const gfx::Rect& paint_rect) { | 170 const gfx::Rect& paint_rect) { |
173 if (device_context_2d_) | 171 if (device_context_2d_) |
174 device_context_2d_->Paint(canvas, plugin_rect, paint_rect); | 172 device_context_2d_->Paint(canvas, plugin_rect, paint_rect); |
175 } | 173 } |
176 | 174 |
177 PP_Var PluginInstance::GetWindowObject() { | 175 PP_Var PluginInstance::GetWindowObject() { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 266 |
269 void PluginInstance::ViewChanged(const gfx::Rect& position, | 267 void PluginInstance::ViewChanged(const gfx::Rect& position, |
270 const gfx::Rect& clip) { | 268 const gfx::Rect& clip) { |
271 PP_Rect pp_position, pp_clip; | 269 PP_Rect pp_position, pp_clip; |
272 RectToPPRect(position, &pp_position); | 270 RectToPPRect(position, &pp_position); |
273 RectToPPRect(clip, &pp_clip); | 271 RectToPPRect(clip, &pp_clip); |
274 instance_interface_->ViewChanged(GetPPInstance(), &pp_position, &pp_clip); | 272 instance_interface_->ViewChanged(GetPPInstance(), &pp_position, &pp_clip); |
275 } | 273 } |
276 | 274 |
277 } // namespace pepper | 275 } // namespace pepper |
OLD | NEW |