| 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 CCRendererSoftware_h | 5 #ifndef CCRendererSoftware_h |
| 6 #define CCRendererSoftware_h | 6 #define CCRendererSoftware_h |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "CCDirectRenderer.h" | 9 #include "CCDirectRenderer.h" |
| 10 #include <public/WebCompositorSoftwareOutputDevice.h> | 10 #include <public/WebCompositorSoftwareOutputDevice.h> |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 class DebugBorderDrawQuad; | 14 class DebugBorderDrawQuad; |
| 15 class RendererClient; | 15 class RendererClient; |
| 16 class ResourceProvider; | 16 class ResourceProvider; |
| 17 class SolidColorDrawQuad; | 17 class SolidColorDrawQuad; |
| 18 class TextureDrawQuad; | 18 class TextureDrawQuad; |
| 19 class TileDrawQuad; | 19 class TileDrawQuad; |
| 20 class RenderPassDrawQuad; | 20 class RenderPassDrawQuad; |
| 21 | 21 |
| 22 class SoftwareRenderer : public DirectRenderer { | 22 class SoftwareRenderer : public DirectRenderer { |
| 23 public: | 23 public: |
| 24 static scoped_ptr<SoftwareRenderer> create(RendererClient*, ResourceProvider
*, WebKit::WebCompositorSoftwareOutputDevice*); | 24 static scoped_ptr<SoftwareRenderer> create(RendererClient*, ResourceProvider
*, WebKit::WebCompositorSoftwareOutputDevice*, bool hasImplThread); |
| 25 virtual ~SoftwareRenderer(); | 25 virtual ~SoftwareRenderer(); |
| 26 | 26 |
| 27 virtual const RendererCapabilities& capabilities() const OVERRIDE; | 27 virtual const RendererCapabilities& capabilities() const OVERRIDE; |
| 28 | 28 |
| 29 virtual void viewportChanged() OVERRIDE; | 29 virtual void viewportChanged() OVERRIDE; |
| 30 | 30 |
| 31 virtual void finish() OVERRIDE; | 31 virtual void finish() OVERRIDE; |
| 32 | 32 |
| 33 virtual bool swapBuffers() OVERRIDE; | 33 virtual bool swapBuffers() OVERRIDE; |
| 34 | 34 |
| 35 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; | 35 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; |
| 36 | 36 |
| 37 virtual void setVisible(bool) OVERRIDE; | 37 virtual void setVisible(bool) OVERRIDE; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; | 40 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; |
| 41 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedTexture*, c
onst gfx::Rect& framebufferRect) OVERRIDE; | 41 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedTexture*, c
onst gfx::Rect& framebufferRect) OVERRIDE; |
| 42 virtual void setDrawViewportSize(const gfx::Size&) OVERRIDE; | 42 virtual void setDrawViewportSize(const gfx::Size&) OVERRIDE; |
| 43 virtual void enableScissorTestRect(const gfx::Rect& scissorRect) OVERRIDE; | 43 virtual void enableScissorTestRect(const gfx::Rect& scissorRect) OVERRIDE; |
| 44 virtual void disableScissorTest() OVERRIDE; | 44 virtual void disableScissorTest() OVERRIDE; |
| 45 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; | 45 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; |
| 46 virtual void drawQuad(DrawingFrame&, const DrawQuad*) OVERRIDE; | 46 virtual void drawQuad(DrawingFrame&, const DrawQuad*) OVERRIDE; |
| 47 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; | 47 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; |
| 48 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; | 48 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; |
| 49 virtual bool flippedFramebuffer() const OVERRIDE; | 49 virtual bool flippedFramebuffer() const OVERRIDE; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 SoftwareRenderer(RendererClient*, ResourceProvider*, WebKit::WebCompositorSo
ftwareOutputDevice*); | 52 SoftwareRenderer(RendererClient*, ResourceProvider*, WebKit::WebCompositorSo
ftwareOutputDevice*, bool hasImplThread); |
| 53 | 53 |
| 54 bool isSoftwareResource(ResourceProvider::ResourceId) const; | 54 bool isSoftwareResource(ResourceProvider::ResourceId) const; |
| 55 | 55 |
| 56 void drawDebugBorderQuad(const DrawingFrame&, const DebugBorderDrawQuad*); | 56 void drawDebugBorderQuad(const DrawingFrame&, const DebugBorderDrawQuad*); |
| 57 void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); | 57 void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); |
| 58 void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); | 58 void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); |
| 59 void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); | 59 void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); |
| 60 void drawRenderPassQuad(const DrawingFrame& frame, const RenderPassDrawQuad*
); | 60 void drawRenderPassQuad(const DrawingFrame& frame, const RenderPassDrawQuad*
); |
| 61 void drawUnsupportedQuad(const DrawingFrame&, const DrawQuad*); | 61 void drawUnsupportedQuad(const DrawingFrame&, const DrawQuad*); |
| 62 | 62 |
| 63 RendererCapabilities m_capabilities; | 63 RendererCapabilities m_capabilities; |
| 64 bool m_hasImplThread; |
| 64 bool m_visible; | 65 bool m_visible; |
| 65 | 66 |
| 66 WebKit::WebCompositorSoftwareOutputDevice* m_outputDevice; | 67 WebKit::WebCompositorSoftwareOutputDevice* m_outputDevice; |
| 67 scoped_ptr<SkCanvas> m_skRootCanvas; | 68 scoped_ptr<SkCanvas> m_skRootCanvas; |
| 68 SkCanvas* m_skCurrentCanvas; | 69 SkCanvas* m_skCurrentCanvas; |
| 69 SkPaint m_skCurrentPaint; | 70 SkPaint m_skCurrentPaint; |
| 70 scoped_ptr<ResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLo
ck; | 71 scoped_ptr<ResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLo
ck; |
| 71 | 72 |
| 72 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); | 73 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 } | 76 } |
| 76 | 77 |
| 77 #endif | 78 #endif |
| OLD | NEW |