| 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/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 public: | 41 public: |
| 42 virtual void SetFullRootLayerDamage() = 0; | 42 virtual void SetFullRootLayerDamage() = 0; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class CC_EXPORT Renderer { | 45 class CC_EXPORT Renderer { |
| 46 public: | 46 public: |
| 47 virtual ~Renderer() {} | 47 virtual ~Renderer() {} |
| 48 | 48 |
| 49 virtual const RendererCapabilitiesImpl& Capabilities() const = 0; | 49 virtual const RendererCapabilitiesImpl& Capabilities() const = 0; |
| 50 | 50 |
| 51 virtual bool CanReadPixels() const = 0; | |
| 52 | |
| 53 virtual void DecideRenderPassAllocationsForFrame( | 51 virtual void DecideRenderPassAllocationsForFrame( |
| 54 const RenderPassList& render_passes_in_draw_order) {} | 52 const RenderPassList& render_passes_in_draw_order) {} |
| 55 virtual bool HasAllocatedResourcesForTesting(RenderPass::Id id) const; | 53 virtual bool HasAllocatedResourcesForTesting(RenderPass::Id id) const; |
| 56 | 54 |
| 57 // This passes ownership of the render passes to the renderer. It should | 55 // This passes ownership of the render passes to the renderer. It should |
| 58 // consume them, and empty the list. The parameters here may change from frame | 56 // consume them, and empty the list. The parameters here may change from frame |
| 59 // to frame and should not be cached. | 57 // to frame and should not be cached. |
| 60 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped | 58 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped |
| 61 // window space. | 59 // window space. |
| 62 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, | 60 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, |
| 63 float device_scale_factor, | 61 float device_scale_factor, |
| 64 const gfx::Rect& device_viewport_rect, | 62 const gfx::Rect& device_viewport_rect, |
| 65 const gfx::Rect& device_clip_rect, | 63 const gfx::Rect& device_clip_rect, |
| 66 bool disable_picture_quad_image_filtering) = 0; | 64 bool disable_picture_quad_image_filtering) = 0; |
| 67 | 65 |
| 68 // Waits for rendering to finish. | 66 // Waits for rendering to finish. |
| 69 virtual void Finish() = 0; | 67 virtual void Finish() = 0; |
| 70 | 68 |
| 71 virtual void DoNoOp() {} | 69 virtual void DoNoOp() {} |
| 72 | 70 |
| 73 // Puts backbuffer onscreen. | 71 // Puts backbuffer onscreen. |
| 74 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) = 0; | 72 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) = 0; |
| 75 virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {} | 73 virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {} |
| 76 | 74 |
| 77 virtual void GetFramebufferPixels(void* pixels, const gfx::Rect& rect) = 0; | |
| 78 | |
| 79 virtual bool IsContextLost(); | 75 virtual bool IsContextLost(); |
| 80 | 76 |
| 81 bool visible() const { return visible_; } | 77 bool visible() const { return visible_; } |
| 82 void SetVisible(bool visible); | 78 void SetVisible(bool visible); |
| 83 | 79 |
| 84 virtual void SendManagedMemoryStats(size_t bytes_visible, | 80 virtual void SendManagedMemoryStats(size_t bytes_visible, |
| 85 size_t bytes_visible_and_nearby, | 81 size_t bytes_visible_and_nearby, |
| 86 size_t bytes_allocated) = 0; | 82 size_t bytes_allocated) = 0; |
| 87 | 83 |
| 88 protected: | 84 protected: |
| 89 explicit Renderer(RendererClient* client, const LayerTreeSettings* settings) | 85 explicit Renderer(RendererClient* client, const LayerTreeSettings* settings) |
| 90 : client_(client), settings_(settings), visible_(true) {} | 86 : client_(client), settings_(settings), visible_(true) {} |
| 91 | 87 |
| 92 virtual void DidChangeVisibility() = 0; | 88 virtual void DidChangeVisibility() = 0; |
| 93 | 89 |
| 94 RendererClient* client_; | 90 RendererClient* client_; |
| 95 const LayerTreeSettings* settings_; | 91 const LayerTreeSettings* settings_; |
| 96 bool visible_; | 92 bool visible_; |
| 97 | 93 |
| 98 private: | 94 private: |
| 99 DISALLOW_COPY_AND_ASSIGN(Renderer); | 95 DISALLOW_COPY_AND_ASSIGN(Renderer); |
| 100 }; | 96 }; |
| 101 | 97 |
| 102 } // namespace cc | 98 } // namespace cc |
| 103 | 99 |
| 104 #endif // CC_OUTPUT_RENDERER_H_ | 100 #endif // CC_OUTPUT_RENDERER_H_ |
| OLD | NEW |