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

Side by Side Diff: native_client_sdk/src/examples/demo/flock/flock.cc

Issue 23072027: Merge 217400 "Change ppapi_simple to support pixel format select..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1599/src/
Patch Set: Created 7 years, 4 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdio.h> 5 #include <stdio.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/mount.h> 8 #include <sys/mount.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 FILE* fp = fopen("/images/flock_green.raw", "rb"); 109 FILE* fp = fopen("/images/flock_green.raw", "rb");
110 fread(&fmt, sizeof(fmt), 1, fp); 110 fread(&fmt, sizeof(fmt), 1, fp);
111 111
112 len = fmt.width * fmt.height * fmt.channels; 112 len = fmt.width * fmt.height * fmt.channels;
113 buffer = new uint32_t[len]; 113 buffer = new uint32_t[len];
114 fread(buffer, 1, len, fp); 114 fread(buffer, 1, len, fp);
115 fclose(fp); 115 fclose(fp);
116 116
117 g_goose_sprite = new Sprite(buffer, pp::Size(fmt.width, fmt.height), 0); 117 g_goose_sprite = new Sprite(buffer, pp::Size(fmt.width, fmt.height), 0);
118 118
119 PSContext2D_t* ctx = PSContext2DAllocate(); 119 PSContext2D_t* ctx = PSContext2DAllocate(PP_IMAGEDATAFORMAT_BGRA_PREMUL);
120 ResetFlock(ctx, 50); 120 ResetFlock(ctx, 50);
121 while (1) { 121 while (1) {
122 PSEvent* event; 122 PSEvent* event;
123 123
124 // Consume all available events 124 // Consume all available events
125 while ((event = PSEventTryAcquire()) != NULL) { 125 while ((event = PSEventTryAcquire()) != NULL) {
126 PSContext2DHandleEvent(ctx, event); 126 PSContext2DHandleEvent(ctx, event);
127 PSEventRelease(event); 127 PSEventRelease(event);
128 } 128 }
129 129
(...skipping 10 matching lines...) Expand all
140 } 140 }
141 141
142 return 0; 142 return 0;
143 } 143 }
144 144
145 /* 145 /*
146 * Register the function to call once the Instance Object is initialized. 146 * Register the function to call once the Instance Object is initialized.
147 * see: pappi_simple/ps_main.h 147 * see: pappi_simple/ps_main.h
148 */ 148 */
149 PPAPI_SIMPLE_REGISTER_MAIN(example_main); 149 PPAPI_SIMPLE_REGISTER_MAIN(example_main);
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/demo/earth/earth.cc ('k') | native_client_sdk/src/examples/demo/life/life.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698