OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "gpu/tools/compositor_model_bench/forward_render_model.h" | 5 #include "gpu/tools/compositor_model_bench/forward_render_model.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "gpu/tools/compositor_model_bench/render_model_utils.h" | 10 #include "gpu/tools/compositor_model_bench/render_model_utils.h" |
11 | 11 |
12 using std::vector; | 12 using std::vector; |
13 | 13 |
14 class ForwardRenderNodeVisitor : public RenderNodeVisitor { | 14 class ForwardRenderNodeVisitor : public RenderNodeVisitor { |
15 public: | 15 public: |
16 ForwardRenderNodeVisitor() {} | 16 ForwardRenderNodeVisitor() {} |
17 | 17 |
18 virtual void BeginVisitRenderNode(RenderNode* v) override { | 18 void BeginVisitRenderNode(RenderNode* v) override { NOTREACHED(); } |
19 NOTREACHED(); | |
20 } | |
21 | 19 |
22 virtual void BeginVisitCCNode(CCNode* v) override { | 20 void BeginVisitCCNode(CCNode* v) override { |
23 if (!v->drawsContent()) | 21 if (!v->drawsContent()) |
24 return; | 22 return; |
25 ConfigAndActivateShaderForNode(v); | 23 ConfigAndActivateShaderForNode(v); |
26 DrawQuad(v->width(), v->height()); | 24 DrawQuad(v->width(), v->height()); |
27 } | 25 } |
28 | 26 |
29 virtual void BeginVisitContentLayerNode(ContentLayerNode* l) override { | 27 void BeginVisitContentLayerNode(ContentLayerNode* l) override { |
30 if (!l->drawsContent()) | 28 if (!l->drawsContent()) |
31 return; | 29 return; |
32 ConfigAndActivateShaderForTiling(l); | 30 ConfigAndActivateShaderForTiling(l); |
33 // Now that we capture root layer tiles, a layer without tiles | 31 // Now that we capture root layer tiles, a layer without tiles |
34 // should not get drawn. | 32 // should not get drawn. |
35 for (size_t n = 0; n < l->num_tiles(); ++n) { | 33 for (size_t n = 0; n < l->num_tiles(); ++n) { |
36 const Tile* i = l->tile(n); | 34 const Tile* i = l->tile(n); |
37 DrawTileQuad(i->texID, i->x, i->y); | 35 DrawTileQuad(i->texID, i->x, i->y); |
38 } | 36 } |
39 } | 37 } |
(...skipping 21 matching lines...) Expand all Loading... |
61 glClear(GL_COLOR_BUFFER_BIT); | 59 glClear(GL_COLOR_BUFFER_BIT); |
62 glColorMask(true, true, true, false); | 60 glColorMask(true, true, true, false); |
63 BeginFrame(); | 61 BeginFrame(); |
64 root_->Accept(visitor_.get()); | 62 root_->Accept(visitor_.get()); |
65 } | 63 } |
66 | 64 |
67 void ForwardRenderSimulator::Resize(int width, int height) { | 65 void ForwardRenderSimulator::Resize(int width, int height) { |
68 glViewport(0, 0, width, height); | 66 glViewport(0, 0, width, height); |
69 } | 67 } |
70 | 68 |
OLD | NEW |