Chromium Code Reviews| 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/common/gpu/media/android_copying_backing_strategy.h" | 5 #include "content/common/gpu/media/android_copying_backing_strategy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "content/common/gpu/media/avda_return_on_failure.h" | 10 #include "content/common/gpu/media/avda_return_on_failure.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 // TODO(liberato): crbug.com/574948 . The OnFrameAvailable logic can be | 154 // TODO(liberato): crbug.com/574948 . The OnFrameAvailable logic can be |
| 155 // moved into AVDA, and we should wait for it before doing the copy. | 155 // moved into AVDA, and we should wait for it before doing the copy. |
| 156 // Because there were some test failures, we don't do this now but | 156 // Because there were some test failures, we don't do this now but |
| 157 // instead preserve the old behavior. | 157 // instead preserve the old behavior. |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() { | 160 bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() { |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void AndroidCopyingBackingStrategy::UpdatePictureBufferSize( | |
| 165 media::PictureBuffer* picture_buffer, | |
| 166 const gfx::Size& new_size) { | |
| 167 // This strategy uses 2D textures who's allocated memory is dependent on the | |
| 168 // size. To update size in all places, we must: | |
| 169 // 1) Update the PictureBuffer meta-data | |
| 170 picture_buffer->set_size(new_size); | |
| 171 | |
| 172 // 2) Update the GL texture via glTextImage2D. This step assumes the caller | |
|
DaleCurtis
2016/03/08 18:29:03
glTexImage2D unless there's an ASCII art GL comman
chcunningham
2016/03/08 22:19:12
Done. :)
| |
| 173 // has made our GL context current. | |
| 174 glBindTexture(GL_TEXTURE_2D, picture_buffer->texture_id()); | |
| 175 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, new_size.width(), new_size.height(), | |
| 176 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); | |
| 177 state_provider_->GetGlDecoder()->RestoreActiveTextureUnitBinding( | |
| 178 GL_TEXTURE_2D); | |
| 179 | |
| 180 // 3) Update the CHROMIUM Texture's size. | |
| 181 gpu::gles2::TextureRef* texture_ref = | |
| 182 state_provider_->GetTextureForPicture(*picture_buffer); | |
| 183 RETURN_IF_NULL(texture_ref); | |
|
DaleCurtis
2016/03/08 18:29:03
Should this function return an error if this occur
chcunningham
2016/03/08 22:19:12
I think its should be ok as-is. This macro This ma
| |
| 184 gpu::gles2::TextureManager* texture_manager = | |
| 185 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); | |
| 186 RETURN_IF_NULL(texture_manager); | |
|
DaleCurtis
2016/03/08 18:29:03
Ditto?
chcunningham
2016/03/08 22:19:12
Ditto
| |
| 187 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, | |
| 188 new_size.width(), new_size.height(), 1, 0, | |
| 189 GL_RGBA, GL_UNSIGNED_BYTE, | |
| 190 gfx::Rect(new_size)); | |
| 191 } | |
| 192 | |
| 164 } // namespace content | 193 } // namespace content |
| OLD | NEW |