OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ |
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ | 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // GetDelegate()) which represent the consumers of the two roles in plays. | 48 // GetDelegate()) which represent the consumers of the two roles in plays. |
49 // This class can be created only on the main thread, but then becomes pinned | 49 // This class can be created only on the main thread, but then becomes pinned |
50 // to a fixed thread when BindToClient is called. | 50 // to a fixed thread when BindToClient is called. |
51 class SynchronousCompositorOutputSurface | 51 class SynchronousCompositorOutputSurface |
52 : NON_EXPORTED_BASE(public cc::OutputSurface) { | 52 : NON_EXPORTED_BASE(public cc::OutputSurface) { |
53 public: | 53 public: |
54 explicit SynchronousCompositorOutputSurface(int routing_id); | 54 explicit SynchronousCompositorOutputSurface(int routing_id); |
55 virtual ~SynchronousCompositorOutputSurface(); | 55 virtual ~SynchronousCompositorOutputSurface(); |
56 | 56 |
57 // OutputSurface. | 57 // OutputSurface. |
58 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; | |
59 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE; | 58 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE; |
60 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE; | 59 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE; |
61 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; | 60 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; |
62 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; | 61 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; |
63 | 62 |
64 // Partial SynchronousCompositor API implementation. | 63 // Partial SynchronousCompositor API implementation. |
65 bool InitializeHwDraw( | 64 bool InitializeHwDraw( |
66 scoped_refptr<cc::ContextProvider> onscreen_context_provider); | 65 scoped_refptr<cc::ContextProvider> onscreen_context_provider); |
67 void ReleaseHwDraw(); | 66 void ReleaseHwDraw(); |
68 scoped_ptr<cc::CompositorFrame> DemandDrawHw(gfx::Size surface_size, | 67 scoped_ptr<cc::CompositorFrame> DemandDrawHw(gfx::Size surface_size, |
69 const gfx::Transform& transform, | 68 const gfx::Transform& transform, |
70 gfx::Rect viewport, | 69 gfx::Rect viewport, |
71 gfx::Rect clip); | 70 gfx::Rect clip); |
72 void ReturnResources(const cc::CompositorFrameAck& frame_ack); | 71 void ReturnResources(const cc::CompositorFrameAck& frame_ack); |
73 scoped_ptr<cc::CompositorFrame> DemandDrawSw(SkCanvas* canvas); | 72 scoped_ptr<cc::CompositorFrame> DemandDrawSw(SkCanvas* canvas); |
74 void SetMemoryPolicy(const SynchronousCompositorMemoryPolicy& policy); | 73 void SetMemoryPolicy(const SynchronousCompositorMemoryPolicy& policy); |
75 | 74 |
76 private: | 75 private: |
77 class SoftwareDevice; | 76 class SoftwareDevice; |
78 friend class SoftwareDevice; | 77 friend class SoftwareDevice; |
79 | 78 |
80 void InvokeComposite(const gfx::Transform& transform, | 79 void InvokeComposite(const gfx::Transform& transform, |
81 gfx::Rect viewport, | 80 gfx::Rect viewport, |
82 gfx::Rect clip, | 81 gfx::Rect clip, |
83 bool valid_for_tile_management); | 82 bool hardware_draw); |
84 bool CalledOnValidThread() const; | 83 bool CalledOnValidThread() const; |
85 SynchronousCompositorOutputSurfaceDelegate* GetDelegate(); | 84 SynchronousCompositorOutputSurfaceDelegate* GetDelegate(); |
86 | 85 |
87 int routing_id_; | 86 int routing_id_; |
88 bool needs_begin_frame_; | 87 bool needs_begin_frame_; |
89 bool invoking_composite_; | 88 bool invoking_composite_; |
90 | 89 |
91 gfx::Transform cached_hw_transform_; | 90 gfx::Transform cached_hw_transform_; |
92 gfx::Rect cached_hw_viewport_; | 91 gfx::Rect cached_hw_viewport_; |
93 gfx::Rect cached_hw_clip_; | 92 gfx::Rect cached_hw_clip_; |
94 | 93 |
95 // Only valid (non-NULL) during a DemandDrawSw() call. | 94 // Only valid (non-NULL) during a DemandDrawSw() call. |
96 SkCanvas* current_sw_canvas_; | 95 SkCanvas* current_sw_canvas_; |
97 | 96 |
98 cc::ManagedMemoryPolicy memory_policy_; | 97 cc::ManagedMemoryPolicy memory_policy_; |
99 | 98 |
100 cc::OutputSurfaceClient* output_surface_client_; | 99 cc::OutputSurfaceClient* output_surface_client_; |
101 scoped_ptr<cc::CompositorFrame> frame_holder_; | 100 scoped_ptr<cc::CompositorFrame> frame_holder_; |
102 | 101 |
103 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); | 102 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); |
104 }; | 103 }; |
105 | 104 |
106 } // namespace content | 105 } // namespace content |
107 | 106 |
108 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF
ACE_H_ | 107 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF
ACE_H_ |
OLD | NEW |