| 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 virtual void BeginVisitRenderNode(RenderNode* v) override { |
| 19 NOTREACHED(); | 19 NOTREACHED(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 virtual void BeginVisitCCNode(CCNode* v) OVERRIDE { | 22 virtual void BeginVisitCCNode(CCNode* v) override { |
| 23 if (!v->drawsContent()) | 23 if (!v->drawsContent()) |
| 24 return; | 24 return; |
| 25 ConfigAndActivateShaderForNode(v); | 25 ConfigAndActivateShaderForNode(v); |
| 26 DrawQuad(v->width(), v->height()); | 26 DrawQuad(v->width(), v->height()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void BeginVisitContentLayerNode(ContentLayerNode* l) OVERRIDE { | 29 virtual void BeginVisitContentLayerNode(ContentLayerNode* l) override { |
| 30 if (!l->drawsContent()) | 30 if (!l->drawsContent()) |
| 31 return; | 31 return; |
| 32 ConfigAndActivateShaderForTiling(l); | 32 ConfigAndActivateShaderForTiling(l); |
| 33 // Now that we capture root layer tiles, a layer without tiles | 33 // Now that we capture root layer tiles, a layer without tiles |
| 34 // should not get drawn. | 34 // should not get drawn. |
| 35 for (size_t n = 0; n < l->num_tiles(); ++n) { | 35 for (size_t n = 0; n < l->num_tiles(); ++n) { |
| 36 const Tile* i = l->tile(n); | 36 const Tile* i = l->tile(n); |
| 37 DrawTileQuad(i->texID, i->x, i->y); | 37 DrawTileQuad(i->texID, i->x, i->y); |
| 38 } | 38 } |
| 39 } | 39 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 61 glClear(GL_COLOR_BUFFER_BIT); | 61 glClear(GL_COLOR_BUFFER_BIT); |
| 62 glColorMask(true, true, true, false); | 62 glColorMask(true, true, true, false); |
| 63 BeginFrame(); | 63 BeginFrame(); |
| 64 root_->Accept(visitor_.get()); | 64 root_->Accept(visitor_.get()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ForwardRenderSimulator::Resize(int width, int height) { | 67 void ForwardRenderSimulator::Resize(int width, int height) { |
| 68 glViewport(0, 0, width, height); | 68 glViewport(0, 0, width, height); |
| 69 } | 69 } |
| 70 | 70 |
| OLD | NEW |