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

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

Issue 2825074: Initial version rendering 2D path for O3D. This will eventually allow O3D app... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/o3d/
Patch Set: '' Created 10 years, 3 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
« no previous file with comments | « core/cross/renderer.h ('k') | installer/linux/debian.in/debian.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 IncrementDrawElementsRendered(); 722 IncrementDrawElementsRendered();
723 State *current_state = material ? material->state() : NULL; 723 State *current_state = material ? material->state() : NULL;
724 PushRenderStates(current_state); 724 PushRenderStates(current_state);
725 ApplyDirtyStates(); 725 ApplyDirtyStates();
726 element->Render(this, draw_element, material, override, param_cache); 726 element->Render(this, draw_element, material, override, param_cache);
727 PopRenderStates(); 727 PopRenderStates();
728 } 728 }
729 729
730 // Pushes rendering states. 730 // Pushes rendering states.
731 void Renderer::PushRenderStates(State *state) { 731 void Renderer::PushRenderStates(State *state) {
732 #if !defined(RENDERER_CAIRO)
732 DCHECK(!state_stack_.empty()); 733 DCHECK(!state_stack_.empty());
733 if (state && (state_stack_.back() != state)) { 734 if (state && (state_stack_.back() != state)) {
734 const NamedParamRefMap& param_map = state->params(); 735 const NamedParamRefMap& param_map = state->params();
735 NamedParamRefMap::const_iterator end(param_map.end()); 736 NamedParamRefMap::const_iterator end(param_map.end());
736 for (NamedParamRefMap::const_iterator iter(param_map.begin()); 737 for (NamedParamRefMap::const_iterator iter(param_map.begin());
737 iter != end; 738 iter != end;
738 ++iter) { 739 ++iter) {
739 Param* param = iter->second.Get(); 740 Param* param = iter->second.Get();
740 const StateHandler* state_handler = GetStateHandler(param); 741 const StateHandler* state_handler = GetStateHandler(param);
741 if (state_handler) { 742 if (state_handler) {
742 state_handler->SetState(this, param); 743 state_handler->SetState(this, param);
743 state_param_stacks_[state_handler->index()].push_back(param); 744 state_param_stacks_[state_handler->index()].push_back(param);
744 } 745 }
745 } 746 }
746 } 747 }
747 // If the state is null, push top state since that's that state 748 // If the state is null, push top state since that's that state
748 // that represents our current situation. 749 // that represents our current situation.
749 if (!state) { 750 if (!state) {
750 state = state_stack_.back(); 751 state = state_stack_.back();
751 } 752 }
752 state_stack_.push_back(state); 753 state_stack_.push_back(state);
754 #endif
753 } 755 }
754 756
755 // Pops rendering states to back to their previous settings. 757 // Pops rendering states to back to their previous settings.
756 void Renderer::PopRenderStates() { 758 void Renderer::PopRenderStates() {
757 DCHECK_GT(state_stack_.size(), 1u); 759 DCHECK_GT(state_stack_.size(), 1u);
758 if (state_stack_.back() != state_stack_[state_stack_.size() - 2]) { 760 if (state_stack_.back() != state_stack_[state_stack_.size() - 2]) {
759 State* state = state_stack_.back(); 761 State* state = state_stack_.back();
760 // restore the states the top state object set. 762 // restore the states the top state object set.
761 const NamedParamRefMap& param_map = state->params(); 763 const NamedParamRefMap& param_map = state->params();
762 NamedParamRefMap::const_iterator end(param_map.end()); 764 NamedParamRefMap::const_iterator end(param_map.end());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 bool Renderer::SafeToBindTexture(Texture* texture) const { 823 bool Renderer::SafeToBindTexture(Texture* texture) const {
822 if (current_render_surface_ && 824 if (current_render_surface_ &&
823 current_render_surface_->texture() == texture) { 825 current_render_surface_->texture() == texture) {
824 return false; 826 return false;
825 } 827 }
826 828
827 return true; 829 return true;
828 } 830 }
829 831
830 } // namespace o3d 832 } // namespace o3d
OLDNEW
« no previous file with comments | « core/cross/renderer.h ('k') | installer/linux/debian.in/debian.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698