Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Unified Diff: ppapi/native_client/tests/earth/pepper_c.c

Issue 8951014: Change the DidChangeView update to take a new ViewChanged resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More nacl fixes Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/tests/earth/pepper_c.c
diff --git a/ppapi/native_client/tests/earth/pepper_c.c b/ppapi/native_client/tests/earth/pepper_c.c
index 697675d8f8f2c75e76d3a5081f534b1a1e12f6dd..44e81d9e7296066105b83ae443f3dcaa5a1bf14d 100644
--- a/ppapi/native_client/tests/earth/pepper_c.c
+++ b/ppapi/native_client/tests/earth/pepper_c.c
@@ -25,6 +25,7 @@
#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"
@@ -46,6 +47,7 @@ struct PepperState {
const struct PPB_Graphics2D* graphics_2d_interface;
const struct PPB_ImageData* image_data_interface;
const struct PPB_Instance* instance_interface;
+ const struct PPB_View* view_interface;
PP_Resource device_context;
int32_t which_image;
PP_Resource image[NUMBER_OF_IMAGES];
@@ -129,16 +131,15 @@ static PP_Resource MakeAndBindDeviceContext(PP_Instance instance,
}
static void Instance_DidChangeView(PP_Instance pp_instance,
- const struct PP_Rect* position,
- const struct PP_Rect* clip) {
+ PP_Resource pp_view) {
DebugPrintf("DidChangeView(%x)\n", pp_instance);
assert(g_MyStateIsValid == true);
assert(g_MyState.instance == pp_instance);
- g_MyState.position = *position;
+ g_MyState.view_interface->GetRect(pp_view, &g_MyState.position);
if (g_MyState.ready == false) {
g_MyState.device_context =
- MakeAndBindDeviceContext(pp_instance, &position->size);
+ MakeAndBindDeviceContext(pp_instance, &g_MyState.position.size);
/* create device context */
if (!g_MyState.device_context) {
DebugPrintf("device_context is null!\n");
@@ -154,7 +155,7 @@ static void Instance_DidChangeView(PP_Instance pp_instance,
for (int i = 0; i < NUMBER_OF_IMAGES; ++i) {
g_MyState.image[i] =
g_MyState.image_data_interface->Create(pp_instance,
- PP_IMAGEDATAFORMAT_BGRA_PREMUL, &position->size, PP_TRUE);
+ PP_IMAGEDATAFORMAT_BGRA_PREMUL, &g_MyState.position.size, PP_TRUE);
if (!g_MyState.image[i]) {
DebugPrintf("image resource is invalid!\n");
return;
@@ -165,8 +166,8 @@ static void Instance_DidChangeView(PP_Instance pp_instance,
DebugPrintf("could not allocate image_data\n");
return;
}
- size_t size_in_bytes = position->size.width * position->size.height *
- sizeof(uint32_t);
+ size_t size_in_bytes = g_MyState.position.size.width *
+ g_MyState.position.size.height * sizeof(uint32_t);
memset(g_MyState.image_data[i], 0, size_in_bytes);
}
g_MyState.ready = true;
@@ -206,10 +207,13 @@ PP_EXPORT int32_t PPP_InitializeModule(PP_Module module,
get_browser_interface(PPB_IMAGEDATA_INTERFACE);
g_MyState.graphics_2d_interface = (const struct PPB_Graphics2D*)
get_browser_interface(PPB_GRAPHICS_2D_INTERFACE);
+ g_MyState.view_interface = (const struct PPB_View*)
+ get_browser_interface(PPB_VIEW_INTERFACE);
if (!g_MyState.core_interface ||
!g_MyState.instance_interface ||
!g_MyState.image_data_interface ||
- !g_MyState.graphics_2d_interface)
+ !g_MyState.graphics_2d_interface ||
+ !g_MyState.view_interface)
return -1;
return PP_OK;

Powered by Google App Engine
This is Rietveld 408576698