Home | History | Annotate | Download | only in compositor_model_bench
      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
      3 // found in the LICENSE file.
      4 
      5 #include "gpu/tools/compositor_model_bench/render_models.h"
      6 
      7 #include <string>
      8 
      9 #include "gpu/tools/compositor_model_bench/forward_render_model.h"
     10 
     11 const char* ModelToString(RenderModel m) {
     12   switch (m) {
     13     case ForwardRenderModel:
     14       return "Forward Rendering";
     15     default:
     16       return "(unknown render model name)";
     17   }
     18 }
     19 
     20 RenderModelSimulator::RenderModelSimulator(RenderNode* root) : root_(root) {
     21 }
     22 
     23 RenderModelSimulator::~RenderModelSimulator() {
     24 }
     25 
     26 RenderModelSimulator* ConstructSimulationModel(RenderModel model,
     27                                                RenderNode* render_tree_root,
     28                                                int window_width,
     29                                                int window_height) {
     30   switch (model) {
     31     case ForwardRenderModel:
     32       return new ForwardRenderSimulator(render_tree_root,
     33                                         window_width,
     34                                         window_height);
     35     default:
     36       LOG(ERROR) << "Unrecognized render model. "
     37         "If we know its name, then it's..." << ModelToString(model);
     38       return 0;
     39   }
     40 }
     41 
     42