| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/compositor/reflector_texture.h" | 5 #include "content/browser/compositor/reflector_texture.h" |
| 6 | 6 |
| 7 #include "components/display_compositor/gl_helper.h" | 7 #include "components/display_compositor/gl_helper.h" |
| 8 #include "content/browser/compositor/owned_mailbox.h" | 8 #include "content/browser/compositor/owned_mailbox.h" |
| 9 #include "gpu/command_buffer/client/context_support.h" | 9 #include "gpu/command_buffer/client/context_support.h" |
| 10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 texture_id_ = gl_helper_->ConsumeMailboxToTexture(mailbox_->mailbox(), | 25 texture_id_ = gl_helper_->ConsumeMailboxToTexture(mailbox_->mailbox(), |
| 26 mailbox_->sync_token()); | 26 mailbox_->sync_token()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 ReflectorTexture::~ReflectorTexture() { | 29 ReflectorTexture::~ReflectorTexture() { |
| 30 gl_helper_->DeleteTexture(texture_id_); | 30 gl_helper_->DeleteTexture(texture_id_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void ReflectorTexture::CopyTextureFullImage(const gfx::Size& size) { | 33 void ReflectorTexture::CopyTextureFullImage(const gfx::Size& size) { |
| 34 is_texture_defined_ = true; |
| 34 gl_helper_->CopyTextureFullImage(texture_id_, size); | 35 gl_helper_->CopyTextureFullImage(texture_id_, size); |
| 35 // Insert a barrier to make the copy show up in the mirroring compositor's | 36 // Insert a barrier to make the copy show up in the mirroring compositor's |
| 36 // mailbox. Since the the compositor contexts and the | 37 // mailbox. Since the the compositor contexts and the |
| 37 // ImageTransportFactory's | 38 // ImageTransportFactory's |
| 38 // GLHelper are all on the same GPU channel, this is sufficient instead of | 39 // GLHelper are all on the same GPU channel, this is sufficient instead of |
| 39 // plumbing through a sync point. | 40 // plumbing through a sync point. |
| 40 gl_helper_->InsertOrderingBarrier(); | 41 gl_helper_->InsertOrderingBarrier(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void ReflectorTexture::CopyTextureSubImage(const gfx::Rect& rect) { | 44 void ReflectorTexture::CopyTextureSubImage(const gfx::Rect& rect) { |
| 45 DCHECK(is_texture_defined_); |
| 44 gl_helper_->CopyTextureSubImage(texture_id_, rect); | 46 gl_helper_->CopyTextureSubImage(texture_id_, rect); |
| 45 // Insert a barrier for the same reason above. | 47 // Insert a barrier for the same reason above. |
| 46 gl_helper_->InsertOrderingBarrier(); | 48 gl_helper_->InsertOrderingBarrier(); |
| 47 } | 49 } |
| 48 | 50 |
| 49 } // namespace content | 51 } // namespace content |
| OLD | NEW |