| 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 // Draw viewport in non-y-flipped window space. Note that while a draw is in |
| 24 // progress, this is guaranteed to be contained within the output surface |
| 25 // size. |
| 26 virtual gfx::Rect DeviceViewport() const = 0; |
| 27 |
| 24 virtual float DeviceScaleFactor() const = 0; | 28 virtual float DeviceScaleFactor() const = 0; |
| 25 virtual const LayerTreeSettings& Settings() const = 0; | 29 virtual const LayerTreeSettings& Settings() const = 0; |
| 26 virtual void SetFullRootLayerDamage() = 0; | 30 virtual void SetFullRootLayerDamage() = 0; |
| 27 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; | 31 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; |
| 28 virtual void EnforceManagedMemoryPolicy( | 32 virtual void EnforceManagedMemoryPolicy( |
| 29 const ManagedMemoryPolicy& policy) = 0; | 33 const ManagedMemoryPolicy& policy) = 0; |
| 30 virtual bool HasImplThread() const = 0; | 34 virtual bool HasImplThread() const = 0; |
| 31 virtual bool ShouldClearRootRenderPass() const = 0; | 35 virtual bool ShouldClearRootRenderPass() const = 0; |
| 32 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const = 0; | 36 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const = 0; |
| 33 virtual bool AllowPartialSwap() const = 0; | 37 virtual bool AllowPartialSwap() const = 0; |
| 34 | 38 |
| 35 protected: | 39 protected: |
| 36 virtual ~RendererClient() {} | 40 virtual ~RendererClient() {} |
| 37 }; | 41 }; |
| 38 | 42 |
| 39 class CC_EXPORT Renderer { | 43 class CC_EXPORT Renderer { |
| 40 public: | 44 public: |
| 41 virtual ~Renderer() {} | 45 virtual ~Renderer() {} |
| 42 | 46 |
| 43 virtual const RendererCapabilities& Capabilities() const = 0; | 47 virtual const RendererCapabilities& Capabilities() const = 0; |
| 44 | 48 |
| 45 const LayerTreeSettings& Settings() const { return client_->Settings(); } | 49 const LayerTreeSettings& Settings() const { return client_->Settings(); } |
| 46 | 50 |
| 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() {} | 51 virtual void ViewportChanged() {} |
| 54 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {} | 52 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {} |
| 55 | 53 |
| 56 virtual bool CanReadPixels() const = 0; | 54 virtual bool CanReadPixels() const = 0; |
| 57 | 55 |
| 58 virtual void DecideRenderPassAllocationsForFrame( | 56 virtual void DecideRenderPassAllocationsForFrame( |
| 59 const RenderPassList& render_passes_in_draw_order) {} | 57 const RenderPassList& render_passes_in_draw_order) {} |
| 60 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const; | 58 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const; |
| 61 | 59 |
| 62 // This passes ownership of the render passes to the renderer. It should | 60 // This passes ownership of the render passes to the renderer. It should |
| (...skipping 23 matching lines...) Expand all Loading... |
| 86 : client_(client) {} | 84 : client_(client) {} |
| 87 | 85 |
| 88 RendererClient* client_; | 86 RendererClient* client_; |
| 89 | 87 |
| 90 DISALLOW_COPY_AND_ASSIGN(Renderer); | 88 DISALLOW_COPY_AND_ASSIGN(Renderer); |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 } // namespace cc | 91 } // namespace cc |
| 94 | 92 |
| 95 #endif // CC_OUTPUT_RENDERER_H_ | 93 #endif // CC_OUTPUT_RENDERER_H_ |
| OLD | NEW |