OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "core/cross/tree_traversal.h" | 48 #include "core/cross/tree_traversal.h" |
49 #include "core/cross/draw_pass.h" | 49 #include "core/cross/draw_pass.h" |
50 #include "core/cross/bounding_box.h" | 50 #include "core/cross/bounding_box.h" |
51 #include "core/cross/bitmap.h" | 51 #include "core/cross/bitmap.h" |
52 #include "core/cross/error.h" | 52 #include "core/cross/error.h" |
53 #include "core/cross/evaluation_counter.h" | 53 #include "core/cross/evaluation_counter.h" |
54 #include "core/cross/id_manager.h" | 54 #include "core/cross/id_manager.h" |
55 #include "core/cross/profiler.h" | 55 #include "core/cross/profiler.h" |
56 #include "utils/cross/string_writer.h" | 56 #include "utils/cross/string_writer.h" |
57 #include "utils/cross/json_writer.h" | 57 #include "utils/cross/json_writer.h" |
| 58 #include "utils/cross/dataurl.h" |
58 | 59 |
59 #ifdef OS_WIN | 60 #ifdef OS_WIN |
60 #include "core/cross/core_metrics.h" | 61 #include "core/cross/core_metrics.h" |
61 #endif | 62 #endif |
62 | 63 |
63 using std::map; | 64 using std::map; |
64 using std::vector; | 65 using std::vector; |
65 using std::make_pair; | 66 using std::make_pair; |
66 | 67 |
67 namespace o3d { | 68 namespace o3d { |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 } | 395 } |
395 | 396 |
396 void Client::SetErrorTexture(Texture* texture) { | 397 void Client::SetErrorTexture(Texture* texture) { |
397 renderer_->SetErrorTexture(texture); | 398 renderer_->SetErrorTexture(texture); |
398 } | 399 } |
399 | 400 |
400 void Client::InvalidateAllParameters() { | 401 void Client::InvalidateAllParameters() { |
401 evaluation_counter_->InvalidateAllParameters(); | 402 evaluation_counter_->InvalidateAllParameters(); |
402 } | 403 } |
403 | 404 |
404 bool Client::SaveScreen(const String& file_name) { | 405 String Client::ToDataURL() { |
405 if (!renderer_.IsAvailable()) { | 406 if (!renderer_.IsAvailable()) { |
406 O3D_ERROR(service_locator_) << "No Render Device Available"; | 407 O3D_ERROR(service_locator_) << "No Render Device Available"; |
407 return false; | 408 return dataurl::kEmptyDataURL; |
408 } else { | 409 } else { |
409 return renderer_->SaveScreen(file_name); | 410 Bitmap::Ref bitmap(renderer_->TakeScreenshot()); |
| 411 if (bitmap.IsNull()) { |
| 412 return dataurl::kEmptyDataURL; |
| 413 } else { |
| 414 return bitmap->ToDataURL(); |
| 415 } |
410 } | 416 } |
411 } | 417 } |
412 | 418 |
413 String Client::GetMessageQueueAddress() const { | 419 String Client::GetMessageQueueAddress() const { |
414 if (message_queue_.get()) { | 420 if (message_queue_.get()) { |
415 return message_queue_->GetSocketAddress(); | 421 return message_queue_->GetSocketAddress(); |
416 } else { | 422 } else { |
417 O3D_ERROR(service_locator_) << "Message queue not initialized"; | 423 O3D_ERROR(service_locator_) << "Message queue not initialized"; |
418 return String(""); | 424 return String(""); |
419 } | 425 } |
(...skipping 30 matching lines...) Expand all Loading... |
450 } | 456 } |
451 | 457 |
452 String Client::ProfileToString() { | 458 String Client::ProfileToString() { |
453 StringWriter string_writer(StringWriter::LF); | 459 StringWriter string_writer(StringWriter::LF); |
454 JsonWriter json_writer(&string_writer, 2); | 460 JsonWriter json_writer(&string_writer, 2); |
455 profiler_->Write(&json_writer); | 461 profiler_->Write(&json_writer); |
456 json_writer.Close(); | 462 json_writer.Close(); |
457 return string_writer.ToString(); | 463 return string_writer.ToString(); |
458 } | 464 } |
459 } // namespace o3d | 465 } // namespace o3d |
OLD | NEW |