OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 } // namespace | 232 } // namespace |
233 | 233 |
234 | 234 |
235 // PluginObject ---------------------------------------------------------------- | 235 // PluginObject ---------------------------------------------------------------- |
236 | 236 |
237 PluginObject::PluginObject(NPP npp) | 237 PluginObject::PluginObject(NPP npp) |
238 : npp_(npp), | 238 : npp_(npp), |
239 test_object_(browser->createobject(npp, GetTestClass())) { | 239 test_object_(browser->createobject(npp, GetTestClass())) { |
240 if (!initialize_render_context) { | 240 if (!initialize_render_context || !flush_render_context) { |
241 browser->getvalue(npp_, NPNVInitializeRenderContextFunc, | 241 NPPepperExtensions* extensions; |
242 reinterpret_cast<void*>(&initialize_render_context)); | 242 browser->getvalue(npp_, NPNVPepperExtensions, |
| 243 reinterpret_cast<void*>(&extensions)); |
| 244 CHECK(extensions); |
| 245 initialize_render_context = extensions->initializeRender; |
243 CHECK(initialize_render_context); | 246 CHECK(initialize_render_context); |
244 } | 247 flush_render_context = extensions->flushRender; |
245 if (!flush_render_context) { | |
246 browser->getvalue(npp_, NPNVFlushRenderContextFunc, | |
247 reinterpret_cast<void*>(&flush_render_context)); | |
248 CHECK(flush_render_context); | 248 CHECK(flush_render_context); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 PluginObject::~PluginObject() { | 252 PluginObject::~PluginObject() { |
253 browser->releaseobject(test_object_); | 253 browser->releaseobject(test_object_); |
254 } | 254 } |
255 | 255 |
256 // static | 256 // static |
257 NPClass* PluginObject::GetPluginClass() { | 257 NPClass* PluginObject::GetPluginClass() { |
(...skipping 13 matching lines...) Expand all Loading... |
271 | 271 |
272 SkCanvas canvas(bitmap); | 272 SkCanvas canvas(bitmap); |
273 DrawSampleBitmap(canvas, window.width, window.height); | 273 DrawSampleBitmap(canvas, window.width, window.height); |
274 | 274 |
275 // TODO(brettw) figure out why this cast is necessary, the functions seem to | 275 // TODO(brettw) figure out why this cast is necessary, the functions seem to |
276 // match. Could be a calling convention mismatch? | 276 // match. Could be a calling convention mismatch? |
277 NPFlushRenderContextCallbackPtr callback = | 277 NPFlushRenderContextCallbackPtr callback = |
278 reinterpret_cast<NPFlushRenderContextCallbackPtr>(&FlushCallback); | 278 reinterpret_cast<NPFlushRenderContextCallbackPtr>(&FlushCallback); |
279 flush_render_context(npp_, &context, callback, NULL); | 279 flush_render_context(npp_, &context, callback, NULL); |
280 } | 280 } |
OLD | NEW |