| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 206 } |
| 207 | 207 |
| 208 // Invalidate the last rendered frame. | 208 // Invalidate the last rendered frame. |
| 209 void set_need_to_render(bool need_to_render) { | 209 void set_need_to_render(bool need_to_render) { |
| 210 need_to_render_ = need_to_render; | 210 need_to_render_ = need_to_render; |
| 211 } | 211 } |
| 212 | 212 |
| 213 // Handles the plugin resize event. | 213 // Handles the plugin resize event. |
| 214 virtual void Resize(int width, int height) = 0; | 214 virtual void Resize(int width, int height) = 0; |
| 215 | 215 |
| 216 // Turns fullscreen display on or off. | 216 // Turns fullscreen display on. |
| 217 // Parameters: | 217 // Parameters: |
| 218 // fullscreen: true for fullscreen, false for in-plugin display | |
| 219 // display: a platform-specific display identifier | 218 // display: a platform-specific display identifier |
| 220 // mode_id: a mode returned by GetDisplayModes, for fullscreen use. Ignored | 219 // mode_id: a mode returned by GetDisplayModes |
| 221 // in non-fullscreen mode. | |
| 222 // Returns true on success, false on failure. | 220 // Returns true on success, false on failure. |
| 223 // TODO: Make this pure virtual once it's implemented everywhere. | 221 // TODO(o3d): Make this pure virtual once it's implemented everywhere. |
| 224 virtual bool SetFullscreen(bool fullscreen, const DisplayWindow& display, | 222 virtual bool GoFullscreen(const DisplayWindow& display, |
| 225 int mode_id) { | 223 int mode_id) { |
| 224 return false; |
| 225 } |
| 226 |
| 227 // Cancels fullscreen display. Restores rendering to windowed mode |
| 228 // with the given width and height. |
| 229 // Parameters: |
| 230 // display: a platform-specific display identifier |
| 231 // width: the width to which to restore windowed rendering |
| 232 // height: the height to which to restore windowed rendering |
| 233 // Returns true on success, false on failure. |
| 234 // TODO(o3d): Make this pure virtual once it's implemented everywhere. |
| 235 virtual bool CancelFullscreen(const DisplayWindow& display, |
| 236 int width, int height) { |
| 226 return false; | 237 return false; |
| 227 } | 238 } |
| 228 | 239 |
| 229 // Tells whether we're currently displayed fullscreen or not. | 240 // Tells whether we're currently displayed fullscreen or not. |
| 230 virtual bool fullscreen() const { return false; } | 241 virtual bool fullscreen() const { return false; } |
| 231 | 242 |
| 232 // Get a vector of the available fullscreen display modes. | 243 // Get a vector of the available fullscreen display modes. |
| 233 // Clears *modes on error. | 244 // Clears *modes on error. |
| 234 // TODO: Make this pure virtual once it's implemented everywhere. | 245 // TODO: Make this pure virtual once it's implemented everywhere. |
| 235 virtual void GetDisplayModes(std::vector<DisplayMode> *modes) { | 246 virtual void GetDisplayModes(std::vector<DisplayMode> *modes) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 536 } |
| 526 | 537 |
| 527 // Used only by the ColorWriteEnable state handlers. Should not be used | 538 // Used only by the ColorWriteEnable state handlers. Should not be used |
| 528 // elsewhere. | 539 // elsewhere. |
| 529 // Sets the write mask. This must be called by platform specific renderers | 540 // Sets the write mask. This must be called by platform specific renderers |
| 530 // when the color write mask is changed. | 541 // when the color write mask is changed. |
| 531 void SetWriteMask(int mask) { | 542 void SetWriteMask(int mask) { |
| 532 write_mask_ = mask & 0xF; | 543 write_mask_ = mask & 0xF; |
| 533 } | 544 } |
| 534 | 545 |
| 546 // Indicates whether this Renderer has yet presented to the screen. |
| 547 bool presented_once() { |
| 548 return presented_once_; |
| 549 } |
| 550 |
| 535 protected: | 551 protected: |
| 536 typedef vector_map<String, StateHandler*> StateHandlerMap; | 552 typedef vector_map<String, StateHandler*> StateHandlerMap; |
| 537 typedef std::vector<ParamVector> ParamVectorArray; | 553 typedef std::vector<ParamVector> ParamVectorArray; |
| 538 typedef std::vector<State*> StateArray; | 554 typedef std::vector<State*> StateArray; |
| 539 | 555 |
| 540 // Make the constructor protected so that users can only create one | 556 // Make the constructor protected so that users can only create one |
| 541 // using the CreateDefaultRenderer factory method. | 557 // using the CreateDefaultRenderer factory method. |
| 542 explicit Renderer(ServiceLocator* service_locator); | 558 explicit Renderer(ServiceLocator* service_locator); |
| 543 | 559 |
| 544 // Sets whether or not the renderer supports non-power of 2 textures. | 560 // Sets whether or not the renderer supports non-power of 2 textures. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // X and Y offsets for destination rectangle. | 757 // X and Y offsets for destination rectangle. |
| 742 int dest_x_offset_; | 758 int dest_x_offset_; |
| 743 int dest_y_offset_; | 759 int dest_y_offset_; |
| 744 | 760 |
| 745 // Whether or not the underlying API supports non-power-of-two textures. | 761 // Whether or not the underlying API supports non-power-of-two textures. |
| 746 bool supports_npot_; | 762 bool supports_npot_; |
| 747 | 763 |
| 748 // Whether the backbuffer has been cleared this frame. | 764 // Whether the backbuffer has been cleared this frame. |
| 749 bool back_buffer_cleared_; | 765 bool back_buffer_cleared_; |
| 750 | 766 |
| 767 // Whether we have ever completed a call to Present(). |
| 768 bool presented_once_; |
| 769 |
| 751 DISALLOW_COPY_AND_ASSIGN(Renderer); | 770 DISALLOW_COPY_AND_ASSIGN(Renderer); |
| 752 }; | 771 }; |
| 753 | 772 |
| 754 } // namespace o3d | 773 } // namespace o3d |
| 755 | 774 |
| 756 #endif // O3D_CORE_CROSS_RENDERER_H_ | 775 #endif // O3D_CORE_CROSS_RENDERER_H_ |
| OLD | NEW |