| 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_SOFTWARE_RENDERER_H_ | 5 #ifndef CC_OUTPUT_SOFTWARE_RENDERER_H_ |
| 6 #define CC_OUTPUT_SOFTWARE_RENDERER_H_ | 6 #define CC_OUTPUT_SOFTWARE_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/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 static scoped_ptr<SoftwareRenderer> Create( | 30 static scoped_ptr<SoftwareRenderer> Create( |
| 31 RendererClient* client, | 31 RendererClient* client, |
| 32 const LayerTreeSettings* settings, | 32 const LayerTreeSettings* settings, |
| 33 OutputSurface* output_surface, | 33 OutputSurface* output_surface, |
| 34 ResourceProvider* resource_provider); | 34 ResourceProvider* resource_provider); |
| 35 | 35 |
| 36 virtual ~SoftwareRenderer(); | 36 virtual ~SoftwareRenderer(); |
| 37 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 37 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
| 38 virtual void Finish() OVERRIDE; | 38 virtual void Finish() OVERRIDE; |
| 39 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; | 39 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; |
| 40 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; | 40 virtual void GetFramebufferPixels(void* pixels, |
| 41 const gfx::Rect& rect) OVERRIDE; |
| 41 virtual void SetVisible(bool visible) OVERRIDE; | 42 virtual void SetVisible(bool visible) OVERRIDE; |
| 42 virtual void SendManagedMemoryStats( | 43 virtual void SendManagedMemoryStats( |
| 43 size_t bytes_visible, | 44 size_t bytes_visible, |
| 44 size_t bytes_visible_and_nearby, | 45 size_t bytes_visible_and_nearby, |
| 45 size_t bytes_allocated) OVERRIDE {} | 46 size_t bytes_allocated) OVERRIDE {} |
| 46 virtual void ReceiveSwapBuffersAck( | 47 virtual void ReceiveSwapBuffersAck( |
| 47 const CompositorFrameAck& ack) OVERRIDE; | 48 const CompositorFrameAck& ack) OVERRIDE; |
| 48 virtual void DiscardBackbuffer() OVERRIDE; | 49 virtual void DiscardBackbuffer() OVERRIDE; |
| 49 virtual void EnsureBackbuffer() OVERRIDE; | 50 virtual void EnsureBackbuffer() OVERRIDE; |
| 50 | 51 |
| 51 protected: | 52 protected: |
| 52 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; | 53 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; |
| 53 virtual bool BindFramebufferToTexture( | 54 virtual bool BindFramebufferToTexture( |
| 54 DrawingFrame* frame, | 55 DrawingFrame* frame, |
| 55 const ScopedResource* texture, | 56 const ScopedResource* texture, |
| 56 gfx::Rect target_rect) OVERRIDE; | 57 const gfx::Rect& target_rect) OVERRIDE; |
| 57 virtual void SetDrawViewport(gfx::Rect window_space_viewport) OVERRIDE; | 58 virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) OVERRIDE; |
| 58 virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; | 59 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) OVERRIDE; |
| 59 virtual void DiscardPixels(bool has_external_stencil_test, | 60 virtual void DiscardPixels(bool has_external_stencil_test, |
| 60 bool draw_rect_covers_full_surface) OVERRIDE; | 61 bool draw_rect_covers_full_surface) OVERRIDE; |
| 61 virtual void ClearFramebuffer(DrawingFrame* frame, | 62 virtual void ClearFramebuffer(DrawingFrame* frame, |
| 62 bool has_external_stencil_test) OVERRIDE; | 63 bool has_external_stencil_test) OVERRIDE; |
| 63 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) OVERRIDE; | 64 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) OVERRIDE; |
| 64 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; | 65 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; |
| 65 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; | 66 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; |
| 66 virtual bool FlippedFramebuffer() const OVERRIDE; | 67 virtual bool FlippedFramebuffer() const OVERRIDE; |
| 67 virtual void EnsureScissorTestEnabled() OVERRIDE; | 68 virtual void EnsureScissorTestEnabled() OVERRIDE; |
| 68 virtual void EnsureScissorTestDisabled() OVERRIDE; | 69 virtual void EnsureScissorTestDisabled() OVERRIDE; |
| 69 virtual void CopyCurrentRenderPassToBitmap( | 70 virtual void CopyCurrentRenderPassToBitmap( |
| 70 DrawingFrame* frame, | 71 DrawingFrame* frame, |
| 71 scoped_ptr<CopyOutputRequest> request) OVERRIDE; | 72 scoped_ptr<CopyOutputRequest> request) OVERRIDE; |
| 72 | 73 |
| 73 SoftwareRenderer(RendererClient* client, | 74 SoftwareRenderer(RendererClient* client, |
| 74 const LayerTreeSettings* settings, | 75 const LayerTreeSettings* settings, |
| 75 OutputSurface* output_surface, | 76 OutputSurface* output_surface, |
| 76 ResourceProvider* resource_provider); | 77 ResourceProvider* resource_provider); |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 void ClearCanvas(SkColor color); | 80 void ClearCanvas(SkColor color); |
| 80 void SetClipRect(gfx::Rect rect); | 81 void SetClipRect(const gfx::Rect& rect); |
| 81 bool IsSoftwareResource(ResourceProvider::ResourceId resource_id) const; | 82 bool IsSoftwareResource(ResourceProvider::ResourceId resource_id) const; |
| 82 | 83 |
| 83 void DrawCheckerboardQuad(const DrawingFrame* frame, | 84 void DrawCheckerboardQuad(const DrawingFrame* frame, |
| 84 const CheckerboardDrawQuad* quad); | 85 const CheckerboardDrawQuad* quad); |
| 85 void DrawDebugBorderQuad(const DrawingFrame* frame, | 86 void DrawDebugBorderQuad(const DrawingFrame* frame, |
| 86 const DebugBorderDrawQuad* quad); | 87 const DebugBorderDrawQuad* quad); |
| 87 void DrawPictureQuad(const DrawingFrame* frame, | 88 void DrawPictureQuad(const DrawingFrame* frame, |
| 88 const PictureDrawQuad* quad); | 89 const PictureDrawQuad* quad); |
| 89 void DrawRenderPassQuad(const DrawingFrame* frame, | 90 void DrawRenderPassQuad(const DrawingFrame* frame, |
| 90 const RenderPassDrawQuad* quad); | 91 const RenderPassDrawQuad* quad); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 110 scoped_ptr<ResourceProvider::ScopedWriteLockSoftware> | 111 scoped_ptr<ResourceProvider::ScopedWriteLockSoftware> |
| 111 current_framebuffer_lock_; | 112 current_framebuffer_lock_; |
| 112 scoped_ptr<SoftwareFrameData> current_frame_data_; | 113 scoped_ptr<SoftwareFrameData> current_frame_data_; |
| 113 | 114 |
| 114 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); | 115 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace cc | 118 } // namespace cc |
| 118 | 119 |
| 119 #endif // CC_OUTPUT_SOFTWARE_RENDERER_H_ | 120 #endif // CC_OUTPUT_SOFTWARE_RENDERER_H_ |
| OLD | NEW |