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 |
| 5 #ifndef CCRendererSoftware_h |
| 6 #define CCRendererSoftware_h |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "CCDirectRenderer.h" |
| 10 #include "CCLayerTreeHost.h" |
| 11 #include <public/WebCompositorSoftwareOutputDevice.h> |
| 12 |
| 13 namespace cc { |
| 14 |
| 15 class CCDebugBorderDrawQuad; |
| 16 class CCRendererClient; |
| 17 class CCResourceProvider; |
| 18 class CCSolidColorDrawQuad; |
| 19 class CCTextureDrawQuad; |
| 20 class CCTileDrawQuad; |
| 21 |
| 22 class CCRendererSoftware : public CCDirectRenderer { |
| 23 public: |
| 24 static PassOwnPtr<CCRendererSoftware> create(CCRendererClient*, CCResourcePr
ovider*, WebKit::WebCompositorSoftwareOutputDevice*); |
| 25 virtual ~CCRendererSoftware(); |
| 26 |
| 27 virtual const RendererCapabilities& capabilities() const OVERRIDE; |
| 28 |
| 29 virtual void viewportChanged() OVERRIDE; |
| 30 |
| 31 virtual void finish() OVERRIDE; |
| 32 |
| 33 virtual bool swapBuffers() OVERRIDE; |
| 34 |
| 35 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; |
| 36 |
| 37 virtual void setVisible(bool) OVERRIDE; |
| 38 |
| 39 protected: |
| 40 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; |
| 41 virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*,
const IntRect& framebufferRect) OVERRIDE; |
| 42 virtual void setDrawViewportSize(const IntSize&) OVERRIDE; |
| 43 virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE; |
| 44 virtual void disableScissorTest() OVERRIDE; |
| 45 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; |
| 46 virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE; |
| 47 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; |
| 48 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; |
| 49 virtual bool flippedFramebuffer() const OVERRIDE; |
| 50 |
| 51 private: |
| 52 CCRendererSoftware(CCRendererClient*, CCResourceProvider*, WebKit::WebCompos
itorSoftwareOutputDevice*); |
| 53 |
| 54 bool isSoftwareResource(CCResourceProvider::ResourceId) const; |
| 55 |
| 56 void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*); |
| 57 void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*); |
| 58 void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*); |
| 59 void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*); |
| 60 void drawUnsupportedQuad(const DrawingFrame&, const CCDrawQuad*); |
| 61 |
| 62 RendererCapabilities m_capabilities; |
| 63 bool m_visible; |
| 64 |
| 65 WebKit::WebCompositorSoftwareOutputDevice* m_outputDevice; |
| 66 OwnPtr<SkCanvas> m_skRootCanvas; |
| 67 SkCanvas* m_skCurrentCanvas; |
| 68 SkPaint m_skCurrentPaint; |
| 69 OwnPtr<CCResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLock
; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(CCRendererSoftware); |
| 72 }; |
| 73 |
| 74 } |
| 75 |
| 76 #endif |
OLD | NEW |