| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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); |
| OLD | NEW |