| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_OUTPUT_RENDERER_H_ | |
| 6 #define CC_OUTPUT_RENDERER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "cc/base/scoped_ptr_vector.h" | |
| 10 #include "cc/output/renderer_capabilities.h" | |
| 11 #include "cc/output/renderer_settings.h" | |
| 12 #include "ui/gfx/geometry/rect.h" | |
| 13 | |
| 14 namespace cc { | |
| 15 | |
| 16 class CompositorFrameAck; | |
| 17 class CompositorFrameMetadata; | |
| 18 class RenderPass; | |
| 19 class RenderPassId; | |
| 20 class ScopedResource; | |
| 21 class Task; | |
| 22 | |
| 23 typedef ScopedPtrVector<RenderPass> RenderPassList; | |
| 24 | |
| 25 struct RendererCapabilitiesImpl { | |
| 26 RendererCapabilitiesImpl(); | |
| 27 ~RendererCapabilitiesImpl(); | |
| 28 | |
| 29 // Capabilities copied to main thread. | |
| 30 ResourceFormat best_texture_format; | |
| 31 bool allow_partial_texture_updates; | |
| 32 int max_texture_size; | |
| 33 bool using_shared_memory_resources; | |
| 34 | |
| 35 // Capabilities used on compositor thread only. | |
| 36 bool using_partial_swap; | |
| 37 bool using_egl_image; | |
| 38 bool using_image; | |
| 39 bool using_discard_framebuffer; | |
| 40 bool allow_rasterize_on_demand; | |
| 41 | |
| 42 RendererCapabilities MainThreadCapabilities() const; | |
| 43 }; | |
| 44 | |
| 45 class RendererClient { | |
| 46 public: | |
| 47 virtual void SetFullRootLayerDamage() = 0; | |
| 48 }; | |
| 49 | |
| 50 class Renderer { | |
| 51 public: | |
| 52 virtual ~Renderer() {} | |
| 53 | |
| 54 virtual const RendererCapabilitiesImpl& Capabilities() const = 0; | |
| 55 | |
| 56 virtual void DecideRenderPassAllocationsForFrame( | |
| 57 const RenderPassList& render_passes_in_draw_order) {} | |
| 58 virtual bool HasAllocatedResourcesForTesting(RenderPassId id) const; | |
| 59 | |
| 60 // This passes ownership of the render passes to the renderer. It should | |
| 61 // consume them, and empty the list. The parameters here may change from frame | |
| 62 // to frame and should not be cached. | |
| 63 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped | |
| 64 // window space. | |
| 65 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, | |
| 66 float device_scale_factor, | |
| 67 const gfx::Rect& device_viewport_rect, | |
| 68 const gfx::Rect& device_clip_rect, | |
| 69 bool disable_picture_quad_image_filtering) = 0; | |
| 70 | |
| 71 // Waits for rendering to finish. | |
| 72 virtual void Finish() = 0; | |
| 73 | |
| 74 virtual void DoNoOp() {} | |
| 75 | |
| 76 // Puts backbuffer onscreen. | |
| 77 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) = 0; | |
| 78 virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {} | |
| 79 | |
| 80 bool visible() const { return visible_; } | |
| 81 void SetVisible(bool visible); | |
| 82 | |
| 83 protected: | |
| 84 Renderer(RendererClient* client, const RendererSettings* settings) | |
| 85 : client_(client), settings_(settings), visible_(true) {} | |
| 86 | |
| 87 virtual void DidChangeVisibility() = 0; | |
| 88 | |
| 89 RendererClient* client_; | |
| 90 const RendererSettings* settings_; | |
| 91 bool visible_; | |
| 92 | |
| 93 private: | |
| 94 DISALLOW_COPY_AND_ASSIGN(Renderer); | |
| 95 }; | |
| 96 | |
| 97 } // namespace cc | |
| 98 | |
| 99 #endif // CC_OUTPUT_RENDERER_H_ | |
| OLD | NEW |