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 "content/common/gpu/texture_image_transport_surface.h" | 5 #include "content/common/gpu/texture_image_transport_surface.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 bool TextureImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { | 109 bool TextureImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |
110 if (stub_destroyed_) { | 110 if (stub_destroyed_) { |
111 // Early-exit so that we don't recreate the fbo. We still want to return | 111 // Early-exit so that we don't recreate the fbo. We still want to return |
112 // true, so that the context is made current and the GLES2DecoderImpl can | 112 // true, so that the context is made current and the GLES2DecoderImpl can |
113 // release its own resources. | 113 // release its own resources. |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 if (!context_.get()) { | 117 context_ = context; |
118 DCHECK(helper_->stub()); | |
119 context_ = helper_->stub()->decoder()->GetGLContext(); | |
120 } | |
121 | 118 |
122 if (!fbo_id_) { | 119 if (!fbo_id_) { |
123 glGenFramebuffersEXT(1, &fbo_id_); | 120 glGenFramebuffersEXT(1, &fbo_id_); |
124 glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_id_); | 121 glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_id_); |
125 current_size_ = gfx::Size(1, 1); | 122 current_size_ = gfx::Size(1, 1); |
126 helper_->stub()->AddDestructionObserver(this); | 123 helper_->stub()->AddDestructionObserver(this); |
127 } | 124 } |
128 | 125 |
129 // We could be receiving non-deferred GL commands, that is anything that does | 126 // We could be receiving non-deferred GL commands, that is anything that does |
130 // not need a framebuffer. | 127 // not need a framebuffer. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 GL_TEXTURE_2D, | 476 GL_TEXTURE_2D, |
480 texture->mailbox_name, | 477 texture->mailbox_name, |
481 definition.release(), | 478 definition.release(), |
482 NULL); | 479 NULL); |
483 DCHECK(success); | 480 DCHECK(success); |
484 texture->service_id = 0; | 481 texture->service_id = 0; |
485 texture->mailbox_name = MailboxName(); | 482 texture->mailbox_name = MailboxName(); |
486 } | 483 } |
487 | 484 |
488 } // namespace content | 485 } // namespace content |
OLD | NEW |