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" |
11 #include "cc/resources/managed_memory_policy.h" | 11 #include "cc/resources/managed_memory_policy.h" |
12 #include "cc/trees/layer_tree_host.h" | 12 #include "cc/trees/layer_tree_host.h" |
13 #include "ui/base/latency_info.h" | 13 #include "ui/base/latency_info.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class CompositorFrameAck; | 17 class CompositorFrameAck; |
18 class CompositorFrameMetadata; | 18 class CompositorFrameMetadata; |
19 class ScopedResource; | 19 class ScopedResource; |
20 | 20 |
21 class CC_EXPORT RendererClient { | 21 class CC_EXPORT RendererClient { |
22 public: | 22 public: |
23 virtual gfx::Size DeviceViewportSize() const = 0; | 23 virtual gfx::Rect DeviceViewport() const = 0; |
24 virtual float DeviceScaleFactor() const = 0; | 24 virtual float DeviceScaleFactor() const = 0; |
25 virtual const LayerTreeSettings& Settings() const = 0; | 25 virtual const LayerTreeSettings& Settings() const = 0; |
26 virtual void SetFullRootLayerDamage() = 0; | 26 virtual void SetFullRootLayerDamage() = 0; |
27 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; | 27 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; |
28 virtual void EnforceManagedMemoryPolicy( | 28 virtual void EnforceManagedMemoryPolicy( |
29 const ManagedMemoryPolicy& policy) = 0; | 29 const ManagedMemoryPolicy& policy) = 0; |
30 virtual bool HasImplThread() const = 0; | 30 virtual bool HasImplThread() const = 0; |
31 virtual bool ShouldClearRootRenderPass() const = 0; | 31 virtual bool ShouldClearRootRenderPass() const = 0; |
32 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const = 0; | 32 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const = 0; |
33 virtual bool AllowPartialSwap() const = 0; | 33 virtual bool AllowPartialSwap() const = 0; |
34 | 34 |
35 protected: | 35 protected: |
36 virtual ~RendererClient() {} | 36 virtual ~RendererClient() {} |
37 }; | 37 }; |
38 | 38 |
39 class CC_EXPORT Renderer { | 39 class CC_EXPORT Renderer { |
40 public: | 40 public: |
41 virtual ~Renderer() {} | 41 virtual ~Renderer() {} |
42 | 42 |
43 virtual const RendererCapabilities& Capabilities() const = 0; | 43 virtual const RendererCapabilities& Capabilities() const = 0; |
44 | 44 |
45 const LayerTreeSettings& Settings() const { return client_->Settings(); } | 45 const LayerTreeSettings& Settings() const { return client_->Settings(); } |
46 | 46 |
47 gfx::Size ViewportSize() const { return client_->DeviceViewportSize(); } | |
48 int ViewportWidth() const { return ViewportSize().width(); } | |
49 int ViewportHeight() const { return ViewportSize().height(); } | |
50 | |
51 float DeviceScaleFactor() const { return client_->DeviceScaleFactor(); } | |
52 | |
53 virtual void ViewportChanged() {} | 47 virtual void ViewportChanged() {} |
54 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {} | 48 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {} |
55 | 49 |
56 virtual bool CanReadPixels() const = 0; | 50 virtual bool CanReadPixels() const = 0; |
57 | 51 |
58 virtual void DecideRenderPassAllocationsForFrame( | 52 virtual void DecideRenderPassAllocationsForFrame( |
59 const RenderPassList& render_passes_in_draw_order) {} | 53 const RenderPassList& render_passes_in_draw_order) {} |
60 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const; | 54 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const; |
61 | 55 |
62 // This passes ownership of the render passes to the renderer. It should | 56 // This passes ownership of the render passes to the renderer. It should |
(...skipping 23 matching lines...) Expand all Loading... |
86 : client_(client) {} | 80 : client_(client) {} |
87 | 81 |
88 RendererClient* client_; | 82 RendererClient* client_; |
89 | 83 |
90 DISALLOW_COPY_AND_ASSIGN(Renderer); | 84 DISALLOW_COPY_AND_ASSIGN(Renderer); |
91 }; | 85 }; |
92 | 86 |
93 } // namespace cc | 87 } // namespace cc |
94 | 88 |
95 #endif // CC_OUTPUT_RENDERER_H_ | 89 #endif // CC_OUTPUT_RENDERER_H_ |
OLD | NEW |