summaryrefslogtreecommitdiffstats
path: root/cc/CCDirectRenderer.h
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-25 00:09:14 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-25 00:09:14 +0000
commit94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679 (patch)
tree530f51d5c75459999e4adf2a6895884ce1c15ce0 /cc/CCDirectRenderer.h
parent56235947f2b023fc63cfad692c56df4e92199848 (diff)
downloadchromium_src-94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679.zip
chromium_src-94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679.tar.gz
chromium_src-94f206c1c75eb8cc4df2225a1c5c9c7b6fc96679.tar.bz2
Here are gyp targets and stubs for compiling libcc and the webkit_compositor bindings in chromium. Everything is guarded behind the off-by-default use_libcc_for_compositor gyp variable. I haven't included the actual code here, but there are scripts to sync. I plan to land + manually sync the code into place until we're ready to flip the gyp switch.
Snapshot from r126652 BUG= Review URL: https://chromiumcodereview.appspot.com/10828381 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/CCDirectRenderer.h')
-rw-r--r--cc/CCDirectRenderer.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/cc/CCDirectRenderer.h b/cc/CCDirectRenderer.h
new file mode 100644
index 0000000..097d5fa
--- /dev/null
+++ b/cc/CCDirectRenderer.h
@@ -0,0 +1,106 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CCDirectRenderer_h
+#define CCDirectRenderer_h
+
+#include "CCRenderer.h"
+#include "CCResourceProvider.h"
+#include "CCScopedTexture.h"
+
+namespace WebCore {
+
+class CCResourceProvider;
+
+// This is the base class for code shared between the GL and software
+// renderer implementations. "Direct" refers to the fact that it does not
+// delegate rendering to another compositor.
+class CCDirectRenderer : public CCRenderer {
+ WTF_MAKE_NONCOPYABLE(CCDirectRenderer);
+public:
+ virtual ~CCDirectRenderer() { }
+
+ CCResourceProvider* resourceProvider() const { return m_resourceProvider; }
+
+ virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder) OVERRIDE;
+ virtual bool haveCachedResourcesForRenderPassId(int id) const OVERRIDE;
+ virtual void drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById) OVERRIDE;
+
+protected:
+ CCDirectRenderer(CCRendererClient* client, CCResourceProvider* resourceProvider)
+ : CCRenderer(client)
+ , m_resourceProvider(resourceProvider)
+ {
+ }
+
+ struct DrawingFrame {
+ const CCRenderPassIdHashMap* renderPassesById;
+ const CCRenderPass* rootRenderPass;
+ const CCRenderPass* currentRenderPass;
+ const CCScopedTexture* currentTexture;
+
+ FloatRect rootDamageRect;
+
+ WebKit::WebTransformationMatrix projectionMatrix;
+ WebKit::WebTransformationMatrix windowMatrix;
+ bool flippedY;
+ FloatRect scissorRectInRenderPassSpace;
+
+ DrawingFrame()
+ : rootRenderPass(0)
+ , currentRenderPass(0)
+ , currentTexture(0)
+ , flippedY(false)
+ { }
+ };
+
+ class CachedTexture : public CCScopedTexture {
+ WTF_MAKE_NONCOPYABLE(CachedTexture);
+ public:
+ static PassOwnPtr<CachedTexture> create(CCResourceProvider* resourceProvider) { return adoptPtr(new CachedTexture(resourceProvider)); }
+ virtual ~CachedTexture() { }
+
+ bool isComplete() const { return m_isComplete; }
+ void setIsComplete(bool isComplete) { m_isComplete = isComplete; }
+
+ protected:
+ explicit CachedTexture(CCResourceProvider* resourceProvider)
+ : CCScopedTexture(resourceProvider)
+ , m_isComplete(false)
+ {
+ }
+
+ private:
+ bool m_isComplete;
+ };
+
+ static FloatRect quadVertexRect();
+ static void quadRectTransform(WebKit::WebTransformationMatrix* quadRectTransform, const WebKit::WebTransformationMatrix& quadTransform, const FloatRect& quadRect);
+ static void initializeMatrices(DrawingFrame&, const IntRect& drawRect, bool flipY);
+ static IntRect moveScissorToWindowSpace(const DrawingFrame&, FloatRect scissorRect);
+
+ bool haveCachedResources(int renderPassId) const;
+ static IntSize renderPassTextureSize(const CCRenderPass*);
+ static GC3Denum renderPassTextureFormat(const CCRenderPass*);
+
+ void drawRenderPass(DrawingFrame&, const CCRenderPass*);
+ bool useRenderPass(DrawingFrame&, const CCRenderPass*);
+
+ virtual void bindFramebufferToOutputSurface(DrawingFrame&) = 0;
+ virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) = 0;
+ virtual void setDrawViewportSize(const IntSize&) = 0;
+ virtual void enableScissorTestRect(const IntRect& scissorRect) = 0;
+ virtual void disableScissorTest() = 0;
+ virtual void clearFramebuffer(DrawingFrame&) = 0;
+ virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) = 0;
+ virtual void beginDrawingFrame(DrawingFrame&) = 0;
+ virtual void finishDrawingFrame(DrawingFrame&) = 0;
+
+ HashMap<int, OwnPtr<CachedTexture> > m_renderPassTextures;
+ CCResourceProvider* m_resourceProvider;
+};
+
+}
+
+#endif // CCDirectRenderer_h