| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef CC_OUTPUT_RENDERER_H_ | 5 #ifndef CC_OUTPUT_RENDERER_H_ |
| 6 #define CC_OUTPUT_RENDERER_H_ | 6 #define CC_OUTPUT_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/output/renderer_capabilities.h" | 10 #include "cc/output/renderer_capabilities.h" |
| 11 #include "cc/output/renderer_settings.h" | 11 #include "cc/output/renderer_settings.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class CompositorFrameAck; | 16 class CompositorFrameAck; |
| 17 class CompositorFrameMetadata; | 17 class CompositorFrameMetadata; |
| 18 class RenderPass; | 18 class RenderPass; |
| 19 class RenderPassId; | 19 class RenderPassId; |
| 20 class ScopedResource; | 20 class ScopedResource; |
| 21 class Task; | 21 class Task; |
| 22 | 22 |
| 23 typedef std::vector<scoped_ptr<RenderPass>> RenderPassList; | 23 typedef std::vector<scoped_ptr<RenderPass>> RenderPassList; |
| 24 | 24 |
| 25 enum class DrawFrameResult { |
| 26 DID_DRAW, |
| 27 // No drawing was done because overlay planes accounted for the damage. |
| 28 DAMAGE_DRAWN_BY_OVERLAYS, |
| 29 }; |
| 30 |
| 25 struct RendererCapabilitiesImpl { | 31 struct RendererCapabilitiesImpl { |
| 26 RendererCapabilitiesImpl(); | 32 RendererCapabilitiesImpl(); |
| 27 ~RendererCapabilitiesImpl(); | 33 ~RendererCapabilitiesImpl(); |
| 28 | 34 |
| 29 // Capabilities copied to main thread. | 35 // Capabilities copied to main thread. |
| 30 ResourceFormat best_texture_format; | 36 ResourceFormat best_texture_format; |
| 31 bool allow_partial_texture_updates; | 37 bool allow_partial_texture_updates; |
| 32 int max_texture_size; | 38 int max_texture_size; |
| 33 bool using_shared_memory_resources; | 39 bool using_shared_memory_resources; |
| 34 | 40 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 | 62 |
| 57 virtual void DecideRenderPassAllocationsForFrame( | 63 virtual void DecideRenderPassAllocationsForFrame( |
| 58 const RenderPassList& render_passes_in_draw_order) {} | 64 const RenderPassList& render_passes_in_draw_order) {} |
| 59 virtual bool HasAllocatedResourcesForTesting(RenderPassId id) const; | 65 virtual bool HasAllocatedResourcesForTesting(RenderPassId id) const; |
| 60 | 66 |
| 61 // This passes ownership of the render passes to the renderer. It should | 67 // This passes ownership of the render passes to the renderer. It should |
| 62 // consume them, and empty the list. The parameters here may change from frame | 68 // consume them, and empty the list. The parameters here may change from frame |
| 63 // to frame and should not be cached. | 69 // to frame and should not be cached. |
| 64 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped | 70 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped |
| 65 // window space. | 71 // window space. |
| 66 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, | 72 virtual DrawFrameResult DrawFrame( |
| 67 float device_scale_factor, | 73 RenderPassList* render_passes_in_draw_order, |
| 68 const gfx::Rect& device_viewport_rect, | 74 float device_scale_factor, |
| 69 const gfx::Rect& device_clip_rect, | 75 const gfx::Rect& device_viewport_rect, |
| 70 bool disable_picture_quad_image_filtering) = 0; | 76 const gfx::Rect& device_clip_rect, |
| 77 bool disable_picture_quad_image_filtering) = 0; |
| 71 | 78 |
| 72 // Waits for rendering to finish. | 79 // Waits for rendering to finish. |
| 73 virtual void Finish() = 0; | 80 virtual void Finish() = 0; |
| 74 | 81 |
| 75 // Puts backbuffer onscreen. | 82 // Puts backbuffer onscreen. |
| 76 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) = 0; | 83 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) = 0; |
| 77 virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {} | 84 virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {} |
| 78 | 85 |
| 79 bool visible() const { return visible_; } | 86 bool visible() const { return visible_; } |
| 80 void SetVisible(bool visible); | 87 void SetVisible(bool visible); |
| 81 | 88 |
| 82 protected: | 89 protected: |
| 83 Renderer(RendererClient* client, const RendererSettings* settings) | 90 Renderer(RendererClient* client, const RendererSettings* settings) |
| 84 : client_(client), settings_(settings), visible_(true) {} | 91 : client_(client), settings_(settings), visible_(true) {} |
| 85 | 92 |
| 86 virtual void DidChangeVisibility() = 0; | 93 virtual void DidChangeVisibility() = 0; |
| 87 | 94 |
| 88 RendererClient* client_; | 95 RendererClient* client_; |
| 89 const RendererSettings* settings_; | 96 const RendererSettings* settings_; |
| 90 bool visible_; | 97 bool visible_; |
| 91 | 98 |
| 92 private: | 99 private: |
| 93 DISALLOW_COPY_AND_ASSIGN(Renderer); | 100 DISALLOW_COPY_AND_ASSIGN(Renderer); |
| 94 }; | 101 }; |
| 95 | 102 |
| 96 } // namespace cc | 103 } // namespace cc |
| 97 | 104 |
| 98 #endif // CC_OUTPUT_RENDERER_H_ | 105 #endif // CC_OUTPUT_RENDERER_H_ |
| OLD | NEW |