Chromium Code Reviews| Index: gpu/tools/compositor_model_bench/render_tree.h |
| =================================================================== |
| --- gpu/tools/compositor_model_bench/render_tree.h (revision 0) |
| +++ gpu/tools/compositor_model_bench/render_tree.h (revision 0) |
| @@ -0,0 +1,101 @@ |
| +// Copyright (c) 2011 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. |
| + |
| +// Data structures for representing parts of Chromium's composited layer tree |
| +// and a function to load it from the JSON configuration file |
| + |
| +#ifndef GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_TREE_H_ |
| +#define GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_TREE_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_vector.h" |
| +#include "gpu/tools/compositor_model_bench/shaders.h" |
| +#include "ui/gfx/gl/gl_bindings.h" |
| +#include "ui/gfx/gl/gl_implementation.h" |
| + |
| +// These are fairly arbitrary values based on how big my actual browser |
| +// window was. |
| +const int WINDOW_WIDTH = 1609; |
| +const int WINDOW_HEIGHT = 993; |
| + |
| +struct Tile { |
| + int x; |
| + int y; |
| + int texID; |
| +}; |
| + |
| +struct Texture { |
| + int texID; |
| + int height; |
| + int width; |
| + GLenum format; |
| +}; |
| + |
| +GLenum TextureFormatFromString(std::string format); |
| +const char* TextureFormatName(GLenum format); |
| +int FormatBytesPerPixel(GLenum format); |
| + |
| +struct RenderNodeVisitor; |
| + |
| +class RenderNode { |
| + public: |
| + virtual ~RenderNode() {} |
| + int layerID; |
|
piman
2011/08/26 02:24:16
according to our style, classes are not supposed t
|
| + int width; |
| + int height; |
| + bool drawsContent; |
| + int targetSurface; |
| + float transform[16]; |
| + std::vector<Tile> tiles; |
| + int tile_width; |
| + int tile_height; |
| + |
| + virtual void Accept(RenderNodeVisitor* v); |
| +}; |
| + |
| +class ContentLayerNode : public RenderNode { |
| + public: |
| + ScopedVector<RenderNode> children; |
| + bool skipsDraw; |
| + |
| + virtual void Accept(RenderNodeVisitor* v) OVERRIDE; |
| +}; |
| + |
| +class CCNode : public RenderNode { |
| + public: |
| + ShaderID vertex_shader; |
| + ShaderID fragment_shader; |
| + std::vector<Texture> textures; |
| + |
| + virtual void Accept(RenderNodeVisitor* v) OVERRIDE; |
| +}; |
| + |
| +class RenderNodeVisitor { |
| + public: |
| + virtual ~RenderNodeVisitor() {} |
| + |
| + virtual void BeginVisitRenderNode(RenderNode* v) = 0; |
| + virtual void BeginVisitContentLayerNode(ContentLayerNode* v) { |
| + this->BeginVisitRenderNode(v); |
| + } |
| + virtual void BeginVisitCCNode(CCNode* v) { |
| + this->BeginVisitRenderNode(v); |
| + } |
| + |
| + virtual void EndVisitRenderNode(RenderNode* v) {} |
| + virtual void EndVisitContentLayerNode(ContentLayerNode* v) { |
| + this->EndVisitRenderNode(v); |
| + } |
| + virtual void EndVisitCCNode(CCNode* v) { |
| + this->EndVisitRenderNode(v); |
| + } |
| +}; |
| + |
| +RenderNode* BuildRenderTreeFromFile(const FilePath& path); |
| + |
| +#endif // GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_TREE_H_ |
| + |