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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
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 } |
40 }; | 40 }; |
41 | 41 |
42 ForwardRenderSimulator::ForwardRenderSimulator(RenderNode* root, | 42 ForwardRenderSimulator::ForwardRenderSimulator(std::unique_ptr<RenderNode> root, |
43 int window_width, | 43 int window_width, |
44 int window_height) | 44 int window_height) |
45 : RenderModelSimulator(root) { | 45 : RenderModelSimulator(std::move(root)) { |
46 textures_.reset(new TextureGenerator(root)); | 46 textures_.reset(new TextureGenerator(root_.get())); |
47 visitor_.reset(new ForwardRenderNodeVisitor()); | 47 visitor_.reset(new ForwardRenderNodeVisitor()); |
48 glViewport(0, 0, window_width, window_height); | 48 glViewport(0, 0, window_width, window_height); |
49 glDisable(GL_DEPTH_TEST); | 49 glDisable(GL_DEPTH_TEST); |
50 glDisable(GL_CULL_FACE); | 50 glDisable(GL_CULL_FACE); |
51 glEnable(GL_BLEND); | 51 glEnable(GL_BLEND); |
52 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 52 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
53 } | 53 } |
54 | 54 |
55 ForwardRenderSimulator::~ForwardRenderSimulator() { | 55 ForwardRenderSimulator::~ForwardRenderSimulator() { |
56 } | 56 } |
57 | 57 |
58 void ForwardRenderSimulator::Update() { | 58 void ForwardRenderSimulator::Update() { |
59 glClearColor(0, 0, 1, 1); | 59 glClearColor(0, 0, 1, 1); |
60 glColorMask(true, true, true, true); | 60 glColorMask(true, true, true, true); |
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 |