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