| 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 25 matching lines...) Expand all Loading... |
| 36 LOG(ERROR) << "The copying strategy should not be initialized with a " | 36 LOG(ERROR) << "The copying strategy should not be initialized with a " |
| 37 "surface id."; | 37 "surface id."; |
| 38 return gfx::ScopedJavaSurface(); | 38 return gfx::ScopedJavaSurface(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Create a texture and attach the SurfaceTexture to it. | 41 // Create a texture and attach the SurfaceTexture to it. |
| 42 glGenTextures(1, &surface_texture_id_); | 42 glGenTextures(1, &surface_texture_id_); |
| 43 glActiveTexture(GL_TEXTURE0); | 43 glActiveTexture(GL_TEXTURE0); |
| 44 glBindTexture(GL_TEXTURE_EXTERNAL_OES, surface_texture_id_); | 44 glBindTexture(GL_TEXTURE_EXTERNAL_OES, surface_texture_id_); |
| 45 | 45 |
| 46 // Note that the target will be correctly sized, so nearest filtering is all |
| 47 // that's needed. |
| 46 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 48 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 47 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 49 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 48 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 50 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 49 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 51 glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 50 | 52 |
| 51 state_provider_->GetGlDecoder()->RestoreTextureUnitBindings(0); | 53 state_provider_->GetGlDecoder()->RestoreTextureUnitBindings(0); |
| 52 state_provider_->GetGlDecoder()->RestoreActiveTexture(); | 54 state_provider_->GetGlDecoder()->RestoreActiveTexture(); |
| 53 | 55 |
| 54 surface_texture_ = gfx::SurfaceTexture::Create(surface_texture_id_); | 56 surface_texture_ = gfx::SurfaceTexture::Create(surface_texture_id_); |
| 55 | 57 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // 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. |
| 154 // 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 |
| 155 // instead preserve the old behavior. | 157 // instead preserve the old behavior. |
| 156 } | 158 } |
| 157 | 159 |
| 158 bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() { | 160 bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() { |
| 159 return false; | 161 return false; |
| 160 } | 162 } |
| 161 | 163 |
| 162 } // namespace content | 164 } // namespace content |
| OLD | NEW |