| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <math.h> | 5 #include <math.h> |
| 6 #include <stdio.h> // FIXME(brettw) erase me. | 6 #include <stdio.h> // FIXME(brettw) erase me. |
| 7 #ifndef _WIN32 | 7 #ifndef _WIN32 |
| 8 #include <sys/time.h> | 8 #include <sys/time.h> |
| 9 #else | 9 #else |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 char fps_text[64]; | 321 char fps_text[64]; |
| 322 sprintf(fps_text, "%g fps", | 322 sprintf(fps_text, "%g fps", |
| 323 kStepsPerCircle / (time_now - time_at_last_check_)); | 323 kStepsPerCircle / (time_now - time_at_last_check_)); |
| 324 fps.SetProperty("innerHTML", fps_text); | 324 fps.SetProperty("innerHTML", fps_text); |
| 325 } | 325 } |
| 326 | 326 |
| 327 time_at_last_check_ = time_now; | 327 time_at_last_check_ = time_now; |
| 328 } | 328 } |
| 329 | 329 |
| 330 // Print interfaces. | 330 // Print interfaces. |
| 331 // TODO(mball,dmichael) Replace this with the PPP_PRINTING_DEV_USE_0_4 version | 331 virtual uint32_t QuerySupportedPrintOutputFormats() { |
| 332 virtual PP_PrintOutputFormat_Dev* QuerySupportedPrintOutputFormats( | 332 return PP_PRINTOUTPUTFORMAT_RASTER; |
| 333 uint32_t* format_count) { | |
| 334 pp::Memory_Dev memory; | |
| 335 PP_PrintOutputFormat_Dev* format = | |
| 336 static_cast<PP_PrintOutputFormat_Dev*>( | |
| 337 memory.MemAlloc(sizeof(PP_PrintOutputFormat_Dev))); | |
| 338 *format = PP_PRINTOUTPUTFORMAT_RASTER; | |
| 339 *format_count = 1; | |
| 340 return format; | |
| 341 } | 333 } |
| 342 | 334 |
| 343 virtual int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) { | 335 virtual int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) { |
| 344 if (print_settings_.format != PP_PRINTOUTPUTFORMAT_RASTER) | 336 if (print_settings_.format != PP_PRINTOUTPUTFORMAT_RASTER) |
| 345 return 0; | 337 return 0; |
| 346 | 338 |
| 347 print_settings_ = print_settings; | 339 print_settings_ = print_settings; |
| 348 print_settings_valid_ = true; | 340 print_settings_valid_ = true; |
| 349 return 1; | 341 return 1; |
| 350 } | 342 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 371 (print_settings_.printable_area.size.height / 72.0) * | 363 (print_settings_.printable_area.size.height / 72.0) * |
| 372 print_settings_.dpi); | 364 print_settings_.dpi); |
| 373 | 365 |
| 374 return PaintImage(width, height); | 366 return PaintImage(width, height); |
| 375 } | 367 } |
| 376 | 368 |
| 377 virtual void PrintEnd() { | 369 virtual void PrintEnd() { |
| 378 print_settings_valid_ = false; | 370 print_settings_valid_ = false; |
| 379 } | 371 } |
| 380 | 372 |
| 373 virtual bool IsScalingDisabled() { |
| 374 return false; |
| 375 } |
| 376 |
| 381 void OnFlush() { | 377 void OnFlush() { |
| 382 if (animation_counter_ % kStepsPerCircle == 0) | 378 if (animation_counter_ % kStepsPerCircle == 0) |
| 383 UpdateFps(); | 379 UpdateFps(); |
| 384 animation_counter_++; | 380 animation_counter_++; |
| 385 Paint(); | 381 Paint(); |
| 386 } | 382 } |
| 387 | 383 |
| 388 private: | 384 private: |
| 389 void SayHello() { | 385 void SayHello() { |
| 390 pp::VarPrivate window = GetWindowObject(); | 386 pp::VarPrivate window = GetWindowObject(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 }; | 482 }; |
| 487 | 483 |
| 488 namespace pp { | 484 namespace pp { |
| 489 | 485 |
| 490 // Factory function for your specialization of the Module object. | 486 // Factory function for your specialization of the Module object. |
| 491 Module* CreateModule() { | 487 Module* CreateModule() { |
| 492 return new MyModule(); | 488 return new MyModule(); |
| 493 } | 489 } |
| 494 | 490 |
| 495 } // namespace pp | 491 } // namespace pp |
| OLD | NEW |