| OLD | NEW |
| 1 // Copyright (c) 2009 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2009 The Native Client 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 // NaCl Drawing demo | 5 // NaCl Drawing demo |
| 6 // Uses Anti-Grain Geometry open source rendering library to render using | 6 // Uses Anti-Grain Geometry open source rendering library to render using |
| 7 // the Pepper Graphics2D interface and ppapi_simple. | 7 // the Pepper Graphics2D interface and ppapi_simple. |
| 8 // | 8 // |
| 9 // See http://www.antigrain.com for more information on Anti-Grain Geometry | 9 // See http://www.antigrain.com for more information on Anti-Grain Geometry |
| 10 | 10 |
| 11 #include <errno.h> | 11 #include <errno.h> |
| 12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 | 13 |
| 14 #include <agg-2.5/agg_basics.h> | 14 #include <agg-2.5/agg_basics.h> |
| 15 #include <agg-2.5/agg_conv_stroke.h> | 15 #include <agg-2.5/agg_conv_stroke.h> |
| 16 #include <agg-2.5/agg_conv_transform.h> | 16 #include <agg-2.5/agg_conv_transform.h> |
| 17 #include <agg-2.5/agg_ellipse.h> | 17 #include <agg-2.5/agg_ellipse.h> |
| 18 #include <agg-2.5/agg_path_storage.h> | 18 #include <agg-2.5/agg_path_storage.h> |
| 19 #include <agg-2.5/agg_pixfmt_rgba.h> | 19 #include <agg-2.5/agg_pixfmt_rgba.h> |
| 20 #include <agg-2.5/agg_rendering_buffer.h> | 20 #include <agg-2.5/agg_rendering_buffer.h> |
| 21 #include <agg-2.5/agg_rasterizer_outline_aa.h> | 21 #include <agg-2.5/agg_rasterizer_outline_aa.h> |
| 22 #include <agg-2.5/agg_rasterizer_scanline_aa.h> | 22 #include <agg-2.5/agg_rasterizer_scanline_aa.h> |
| 23 #include <agg-2.5/agg_renderer_scanline.h> | 23 #include <agg-2.5/agg_renderer_scanline.h> |
| 24 #include <agg-2.5/agg_scanline_u.h> | 24 #include <agg-2.5/agg_scanline_u.h> |
| 25 | 25 |
| 26 #include "ppapi_simple/ps_context_2d.h" | 26 #include "ppapi_simple/ps_context_2d.h" |
| 27 #include "ppapi_simple/ps_main.h" | |
| 28 | 27 |
| 29 | 28 |
| 30 // Drawing class holds information and functionality needed to render | 29 // Drawing class holds information and functionality needed to render |
| 31 class DrawingDemo { | 30 class DrawingDemo { |
| 32 public: | 31 public: |
| 33 DrawingDemo(); ~DrawingDemo(); | 32 DrawingDemo(); ~DrawingDemo(); |
| 34 void Display(); | 33 void Display(); |
| 35 void Update(); | 34 void Update(); |
| 36 bool PumpEvents(); | 35 bool PumpEvents(); |
| 37 void Run(); | 36 void Run(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 Update(); | 155 Update(); |
| 157 PSContext2DSwapBuffer(ps_context_); | 156 PSContext2DSwapBuffer(ps_context_); |
| 158 printf("Frame: %04d\b\b\b\b\b\b\b\b\b\b\b", i); | 157 printf("Frame: %04d\b\b\b\b\b\b\b\b\b\b\b", i); |
| 159 fflush(stdout); | 158 fflush(stdout); |
| 160 } | 159 } |
| 161 | 160 |
| 162 printf("\nDone\n"); | 161 printf("\nDone\n"); |
| 163 } | 162 } |
| 164 | 163 |
| 165 | 164 |
| 166 int example_main(int argc, char **argv) { | 165 int main(int argc, char **argv) { |
| 167 DrawingDemo demo; | 166 DrawingDemo demo; |
| 168 demo.Run(); | 167 demo.Run(); |
| 169 return 0; | 168 return 0; |
| 170 } | 169 } |
| 171 | |
| 172 | |
| 173 PPAPI_SIMPLE_REGISTER_MAIN(example_main); | |
| OLD | NEW |