| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_buffer/service/gl_state_restorer_impl.h" | 5 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 7 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 8 #include "gpu/command_buffer/service/query_manager.h" | 8 #include "gpu/command_buffer/service/query_manager.h" |
| 9 | 9 |
| 10 namespace gpu { | 10 namespace gpu { |
| 11 | 11 |
| 12 GLStateRestorerImpl::GLStateRestorerImpl( | 12 GLStateRestorerImpl::GLStateRestorerImpl( |
| 13 base::WeakPtr<gles2::GLES2Decoder> decoder) | 13 base::WeakPtr<gles2::GLES2Decoder> decoder) |
| 14 : decoder_(decoder) { | 14 : decoder_(decoder) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 GLStateRestorerImpl::~GLStateRestorerImpl() { | 17 GLStateRestorerImpl::~GLStateRestorerImpl() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool GLStateRestorerImpl::IsInitialized() { | 20 bool GLStateRestorerImpl::IsInitialized() { |
| 21 DCHECK(decoder_.get()); | 21 DCHECK(decoder_.get()); |
| 22 return decoder_->initialized(); | 22 return decoder_->initialized(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void GLStateRestorerImpl::RestoreState(const gfx::GLStateRestorer* prev_state) { | 25 void GLStateRestorerImpl::RestoreState(const gl::GLStateRestorer* prev_state) { |
| 26 DCHECK(decoder_.get()); | 26 DCHECK(decoder_.get()); |
| 27 const GLStateRestorerImpl* restorer_impl = | 27 const GLStateRestorerImpl* restorer_impl = |
| 28 static_cast<const GLStateRestorerImpl*>(prev_state); | 28 static_cast<const GLStateRestorerImpl*>(prev_state); |
| 29 | 29 |
| 30 decoder_->RestoreState( | 30 decoder_->RestoreState( |
| 31 restorer_impl ? restorer_impl->GetContextState() : NULL); | 31 restorer_impl ? restorer_impl->GetContextState() : NULL); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void GLStateRestorerImpl::RestoreAllTextureUnitBindings() { | 34 void GLStateRestorerImpl::RestoreAllTextureUnitBindings() { |
| 35 DCHECK(decoder_.get()); | 35 DCHECK(decoder_.get()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 60 DCHECK(decoder_.get()); | 60 DCHECK(decoder_.get()); |
| 61 decoder_->GetQueryManager()->ResumeQueries(); | 61 decoder_->GetQueryManager()->ResumeQueries(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 const gles2::ContextState* GLStateRestorerImpl::GetContextState() const { | 64 const gles2::ContextState* GLStateRestorerImpl::GetContextState() const { |
| 65 DCHECK(decoder_.get()); | 65 DCHECK(decoder_.get()); |
| 66 return decoder_->GetContextState(); | 66 return decoder_->GetContextState(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace gpu | 69 } // namespace gpu |
| OLD | NEW |