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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 bool allow_empty_swap; | 42 bool allow_empty_swap; |
43 bool using_egl_image; | 43 bool using_egl_image; |
44 bool using_image; | 44 bool using_image; |
45 bool using_discard_framebuffer; | 45 bool using_discard_framebuffer; |
46 bool allow_rasterize_on_demand; | 46 bool allow_rasterize_on_demand; |
47 int max_msaa_samples; | 47 int max_msaa_samples; |
48 | 48 |
49 RendererCapabilities MainThreadCapabilities() const; | 49 RendererCapabilities MainThreadCapabilities() const; |
50 }; | 50 }; |
51 | 51 |
52 class CC_EXPORT RendererClient { | |
53 public: | |
54 virtual void SetFullRootLayerDamage() = 0; | |
55 }; | |
56 | |
57 class CC_EXPORT Renderer { | 52 class CC_EXPORT Renderer { |
58 public: | 53 public: |
59 virtual ~Renderer() {} | 54 virtual ~Renderer() {} |
60 | 55 |
61 virtual const RendererCapabilitiesImpl& Capabilities() const = 0; | 56 virtual const RendererCapabilitiesImpl& Capabilities() const = 0; |
62 | 57 |
63 virtual void DecideRenderPassAllocationsForFrame( | 58 virtual void DecideRenderPassAllocationsForFrame( |
64 const RenderPassList& render_passes_in_draw_order) {} | 59 const RenderPassList& render_passes_in_draw_order) {} |
65 virtual bool HasAllocatedResourcesForTesting(RenderPassId id) const; | 60 virtual bool HasAllocatedResourcesForTesting(RenderPassId id) const; |
66 | 61 |
67 // This passes ownership of the render passes to the renderer. It should | 62 // This passes ownership of the render passes to the renderer. It should |
68 // consume them, and empty the list. The parameters here may change from frame | 63 // consume them, and empty the list. The parameters here may change from frame |
69 // to frame and should not be cached. | 64 // to frame and should not be cached. |
70 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped | 65 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped |
71 // window space. | 66 // window space. |
72 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, | 67 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, |
73 float device_scale_factor, | 68 float device_scale_factor, |
74 const gfx::ColorSpace& device_color_space, | 69 const gfx::ColorSpace& device_color_space, |
75 const gfx::Rect& device_viewport_rect, | 70 const gfx::Rect& device_viewport_rect, |
76 const gfx::Rect& device_clip_rect) = 0; | 71 const gfx::Rect& device_clip_rect) = 0; |
77 | 72 |
78 // Puts backbuffer onscreen. | 73 // Puts backbuffer onscreen. |
79 virtual void SwapBuffers(CompositorFrameMetadata metadata) = 0; | 74 virtual void SwapBuffers(CompositorFrameMetadata metadata) = 0; |
80 virtual void ReclaimResources(const ReturnedResourceArray& resources) {} | 75 virtual void ReclaimResources(const ReturnedResourceArray& resources) {} |
81 | 76 |
82 bool visible() const { return visible_; } | 77 bool visible() const { return visible_; } |
83 void SetVisible(bool visible); | 78 void SetVisible(bool visible); |
84 | 79 |
85 protected: | 80 protected: |
86 Renderer(RendererClient* client, const RendererSettings* settings) | 81 explicit Renderer(const RendererSettings* settings) |
87 : client_(client), settings_(settings), visible_(false) {} | 82 : settings_(settings), visible_(false) {} |
88 | 83 |
89 virtual void DidChangeVisibility() = 0; | 84 virtual void DidChangeVisibility() {} |
90 | 85 |
91 RendererClient* client_; | |
92 const RendererSettings* settings_; | 86 const RendererSettings* settings_; |
93 bool visible_; | 87 bool visible_; |
94 | 88 |
95 private: | 89 private: |
96 DISALLOW_COPY_AND_ASSIGN(Renderer); | 90 DISALLOW_COPY_AND_ASSIGN(Renderer); |
97 }; | 91 }; |
98 | 92 |
99 } // namespace cc | 93 } // namespace cc |
100 | 94 |
101 #endif // CC_OUTPUT_RENDERER_H_ | 95 #endif // CC_OUTPUT_RENDERER_H_ |
OLD | NEW |