Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: core/cross/renderer.cc

Issue 159168: This fixes a number of things that are warnings in the Mac compiler.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 << "You can not create a floating point texture unless you request " 86 << "You can not create a floating point texture unless you request "
87 << "support for floating point textures when you initialize O3D."; 87 << "support for floating point textures when you initialize O3D.";
88 return false; 88 return false;
89 } 89 }
90 return true; 90 return true;
91 } 91 }
92 92
93 } // anonymous namespace 93 } // anonymous namespace
94 94
95 Renderer::Renderer(ServiceLocator* service_locator) 95 Renderer::Renderer(ServiceLocator* service_locator)
96 : service_locator_(service_locator), 96 : supports_npot_(false),
97 service_(service_locator, this),
98 features_(service_locator),
99 supports_npot_(false),
100 clear_client_(true), 97 clear_client_(true),
101 need_to_render_(true), 98 need_to_render_(true),
102 current_render_surface_(NULL), 99 current_render_surface_(NULL),
103 current_depth_surface_(NULL), 100 current_depth_surface_(NULL),
104 render_frame_count_(0), 101 render_frame_count_(0),
105 transforms_processed_(0), 102 transforms_processed_(0),
106 transforms_culled_(0), 103 transforms_culled_(0),
107 draw_elements_processed_(0), 104 draw_elements_processed_(0),
108 draw_elements_culled_(0), 105 draw_elements_culled_(0),
109 draw_elements_rendered_(0), 106 draw_elements_rendered_(0),
110 primitives_rendered_(0), 107 primitives_rendered_(0),
108 viewport_(0.0f, 0.0f, 1.0f, 1.0f),
109 depth_range_(0.0f, 1.0f),
110 service_locator_(service_locator),
111 service_(service_locator, this),
112 features_(service_locator),
111 width_(0), 113 width_(0),
112 height_(0), 114 height_(0),
113 render_width_(0), 115 render_width_(0),
114 render_height_(0), 116 render_height_(0),
115 viewport_(0.0f, 0.0f, 1.0f, 1.0f),
116 depth_range_(0.0f, 1.0f),
117 dest_x_offset_(0), 117 dest_x_offset_(0),
118 dest_y_offset_(0) { 118 dest_y_offset_(0) {
119 } 119 }
120 120
121 Renderer::~Renderer() { 121 Renderer::~Renderer() {
122 // Delete all the state handlers. 122 // Delete all the state handlers.
123 while (!state_handler_map_.empty()) { 123 while (!state_handler_map_.empty()) {
124 delete state_handler_map_.begin()->second; 124 delete state_handler_map_.begin()->second;
125 state_handler_map_.erase(state_handler_map_.begin()); 125 state_handler_map_.erase(state_handler_map_.begin());
126 } 126 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 StateHandlerMap::const_iterator iter = state_handler_map_.find(state_name); 384 StateHandlerMap::const_iterator iter = state_handler_map_.find(state_name);
385 return iter != state_handler_map_.end() ? iter->second->GetClass() : NULL; 385 return iter != state_handler_map_.end() ? iter->second->GetClass() : NULL;
386 } 386 }
387 387
388 // Set initial render states on device creation/reset. 388 // Set initial render states on device creation/reset.
389 void Renderer::SetInitialStates() { 389 void Renderer::SetInitialStates() {
390 for (StateHandlerMap::iterator it = state_handler_map_.begin(); 390 for (StateHandlerMap::iterator it = state_handler_map_.begin();
391 it != state_handler_map_.end(); ++it) { 391 it != state_handler_map_.end(); ++it) {
392 StateHandler *state_handler = it->second; 392 StateHandler *state_handler = it->second;
393 ParamVector& param_stack = state_param_stacks_[state_handler->index()]; 393 ParamVector& param_stack = state_param_stacks_[state_handler->index()];
394 DCHECK_EQ(param_stack.size(), 1); 394 DCHECK_EQ(param_stack.size(), 1u);
395 state_handler->SetState(this, param_stack[0]); 395 state_handler->SetState(this, param_stack[0]);
396 } 396 }
397 } 397 }
398 398
399 template <class ParamType> 399 template <class ParamType>
400 void CreateStateParam(State *state, 400 void CreateStateParam(State *state,
401 const String &name, 401 const String &name,
402 const typename ParamType::DataType &value) { 402 const typename ParamType::DataType &value) {
403 ParamType *param = state->GetStateParam<ParamType>(name); 403 ParamType *param = state->GetStateParam<ParamType>(name);
404 DCHECK(param); 404 DCHECK(param);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 Param* param = iter->second.Get(); 532 Param* param = iter->second.Get();
533 const StateHandler* state_handler = GetStateHandler(param); 533 const StateHandler* state_handler = GetStateHandler(param);
534 DCHECK(state_handler); 534 DCHECK(state_handler);
535 ParamVector& param_stack = state_param_stacks_[state_handler->index()]; 535 ParamVector& param_stack = state_param_stacks_[state_handler->index()];
536 DCHECK(param_stack.empty()); 536 DCHECK(param_stack.empty());
537 param_stack.push_back(param); 537 param_stack.push_back(param);
538 } 538 }
539 } 539 }
540 540
541 void Renderer::RemoveDefaultStates() { 541 void Renderer::RemoveDefaultStates() {
542 DCHECK_EQ(state_stack_.size(), 1); 542 DCHECK_EQ(state_stack_.size(), 1u);
543 DCHECK(state_stack_[0] == default_state_); 543 DCHECK(state_stack_[0] == default_state_);
544 state_stack_.clear(); 544 state_stack_.clear();
545 const NamedParamRefMap& param_map = default_state_->params(); 545 const NamedParamRefMap& param_map = default_state_->params();
546 NamedParamRefMap::const_iterator end(param_map.end()); 546 NamedParamRefMap::const_iterator end(param_map.end());
547 for (NamedParamRefMap::const_iterator iter(param_map.begin()); 547 for (NamedParamRefMap::const_iterator iter(param_map.begin());
548 iter != end; 548 iter != end;
549 ++iter) { 549 ++iter) {
550 Param* param = iter->second.Get(); 550 Param* param = iter->second.Get();
551 const StateHandler* state_handler = GetStateHandler(param); 551 const StateHandler* state_handler = GetStateHandler(param);
552 DCHECK(state_handler); 552 DCHECK(state_handler);
553 ParamVector& param_stack = state_param_stacks_[state_handler->index()]; 553 ParamVector& param_stack = state_param_stacks_[state_handler->index()];
554 DCHECK_EQ(param_stack.size(), 1); 554 DCHECK_EQ(param_stack.size(), 1u);
555 DCHECK(param_stack[0] == param); 555 DCHECK(param_stack[0] == param);
556 param_stack.clear(); 556 param_stack.clear();
557 } 557 }
558 default_state_.Reset(); 558 default_state_.Reset();
559 } 559 }
560 560
561 const Renderer::StateHandler* Renderer::GetStateHandler(Param* param) const { 561 const Renderer::StateHandler* Renderer::GetStateHandler(Param* param) const {
562 if (param->handle()) { 562 if (param->handle()) {
563 return static_cast<const StateHandler *>((param->handle())); 563 return static_cast<const StateHandler *>((param->handle()));
564 } else { 564 } else {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 bool Renderer::SafeToBindTexture(Texture* texture) const { 658 bool Renderer::SafeToBindTexture(Texture* texture) const {
659 if (current_render_surface_ && 659 if (current_render_surface_ &&
660 current_render_surface_->texture() == texture) { 660 current_render_surface_->texture() == texture) {
661 return false; 661 return false;
662 } 662 }
663 663
664 return true; 664 return true;
665 } 665 }
666 666
667 } // namespace o3d 667 } // namespace o3d
OLDNEW
« core/cross/bitmap_dds.cc ('K') | « core/cross/pack.cc ('k') | core/cross/shape.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698