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

Side by Side Diff: native_client_sdk/src/libraries/ppapi_simple/ppapi_simple_main2d.cc

Issue 15011003: ppapi_simple (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore images Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 #include "ppapi/c/pp_instance.h"
7 #include "ppapi/c/pp_module.h"
8
9
10 #include "ppapi_simple/ppapi_simple_instance2d.h"
11 #include "ppapi_simple/ppapi_simple_main2d.h"
12
13
14 PP_Bool PSUpdate2DContext(PSEvent* event, PS2DContext_t* context) {
15 PP_Bool updated = PP_FALSE;
16 // Process all view updates to keep context bound
17 if (event->type_ == PS_VIEW_EVENT) {
18 struct PP_Rect rect;
19 int32_t width;
20 int32_t height;
21 if (g_Context.ctx_) {
22 g_pCore->ReleaseResource(g_Context.ctx_);
23 g_Context.ctx_ = 0;
binji 2013/05/23 18:06:49 what is g_Context?
24 }
25
26 g_pView->GetRect(event->resource_, &rect);
27 width = rect.size.width;
28 height = rect.size.height;
29
30 if (width != g_Context.size_.width || height != g_Context.size_.height) {
31 updated = true;
binji 2013/05/23 18:06:49 PP_TRUE
32 }
33
34 if (width != g_Context.size_.width || height != g_Context.size_.height ||
binji 2013/05/23 18:06:49 why not set updated in this block? isn't it update
35 !g_Context.bound_) {
36 g_Context.ctx_ =
37 g_pGraphics2D->Create(PSGetInstanceId(), &rect.size, PP_TRUE);
38 g_Context.bound_ =
39 g_pInstance->BindGraphics(PSGetInstanceId(), g_Context.ctx_);
40 g_Context.size_ = rect.size;
41 }
42 }
43 return updated;
44 }
45
46
47 void PSEnableRender(int enable) {
48 PSInstance* pInst = PSInstance::GetInstance();
49 pInst->EnableRender(enable != 0);
binji 2013/05/23 18:06:49 not implemented anywhere
50 };
51
52 void* PSCreateMain2D(PP_Instance inst, PSMain2DCfg_t* cfg, const char* argv[]) {
53 PSInstance2D* pInst = new PSInstance2D(inst, cfg, argv);
54 return pInst;
55 }
56
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698