diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 17:43:36 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 17:43:36 +0000 |
commit | e8f07ac77c1b27633eb7c6c2793d5b465e023f9f (patch) | |
tree | 6b1aa7de84dcb5f18adac114bba01c4f77a71e6b /ppapi/examples | |
parent | 08d9dfe8c279ec894cdacdf5f0a89bd8c85a92fc (diff) | |
download | chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.zip chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.tar.gz chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.tar.bz2 |
Change the DidChangeView update to take a new ViewChanged resource.
This will allow us to be more flexible about adding data to view changed updates in the future. For now, I've incorporated fullscreen and tab foreground state into the view state.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8951014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/examples')
-rw-r--r-- | ppapi/examples/2d/graphics_2d_example.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/ppapi/examples/2d/graphics_2d_example.c b/ppapi/examples/2d/graphics_2d_example.c index 6495cdc..6a3b12d 100644 --- a/ppapi/examples/2d/graphics_2d_example.c +++ b/ppapi/examples/2d/graphics_2d_example.c @@ -9,13 +9,14 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb.h" #include "ppapi/c/ppb_core.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_view.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" @@ -25,6 +26,7 @@ const struct PPB_Core* g_core_interface; const struct PPB_Graphics2D* g_graphics_2d_interface; const struct PPB_ImageData* g_image_data_interface; const struct PPB_Instance* g_instance_interface; +const struct PPB_View* g_view_interface; /* PPP_Instance implementation -----------------------------------------------*/ @@ -139,18 +141,21 @@ void Instance_DidDestroy(PP_Instance instance) { } void Instance_DidChangeView(PP_Instance pp_instance, - const struct PP_Rect* position, - const struct PP_Rect* clip) { + PP_Resource view) { + struct PP_Rect position; struct InstanceInfo* info = FindInstance(pp_instance); if (!info) return; - if (info->last_size.width != position->size.width || - info->last_size.height != position->size.height) { + if (g_view_interface->GetRect(view, &position) == PP_FALSE) + return; + + if (info->last_size.width != position.size.width || + info->last_size.height != position.size.height) { /* Got a resize, repaint the plugin. */ - Repaint(info, &position->size); - info->last_size.width = position->size.width; - info->last_size.height = position->size.height; + Repaint(info, &position.size); + info->last_size.width = position.size.width; + info->last_size.height = position.size.height; } } @@ -185,8 +190,10 @@ PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, get_browser_interface(PPB_IMAGEDATA_INTERFACE); g_graphics_2d_interface = (const struct PPB_Graphics2D*) get_browser_interface(PPB_GRAPHICS_2D_INTERFACE); + g_view_interface = (const struct PPB_View*) + get_browser_interface(PPB_VIEW_INTERFACE); if (!g_core_interface || !g_instance_interface || !g_image_data_interface || - !g_graphics_2d_interface) + !g_graphics_2d_interface || !g_view_interface) return -1; return PP_OK; |