| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/gl/gl_image_memory.h" | 5 #include "ui/gl/gl_image_memory.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
| 10 #include "ui/gl/scoped_binders.h" | 10 #include "ui/gl/scoped_binders.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool GLImageMemory::CopyTexImage(unsigned target) { | 174 bool GLImageMemory::CopyTexImage(unsigned target) { |
| 175 TRACE_EVENT0("gpu", "GLImageMemory::CopyTexImage"); | 175 TRACE_EVENT0("gpu", "GLImageMemory::CopyTexImage"); |
| 176 | 176 |
| 177 // GL_TEXTURE_EXTERNAL_OES is not a supported CopyTexImage target. | 177 // GL_TEXTURE_EXTERNAL_OES is not a supported CopyTexImage target. |
| 178 if (target == GL_TEXTURE_EXTERNAL_OES) | 178 if (target == GL_TEXTURE_EXTERNAL_OES) |
| 179 return false; | 179 return false; |
| 180 | 180 |
| 181 DCHECK(memory_); | 181 DCHECK(memory_); |
| 182 glTexImage2D(target, | 182 glTexSubImage2D(target, 0, // level |
| 183 0, // mip level | 183 0, // x |
| 184 TextureFormat(format_), | 184 0, // y |
| 185 size_.width(), | 185 size_.width(), size_.height(), DataFormat(format_), |
| 186 size_.height(), | 186 DataType(format_), memory_); |
| 187 0, // border | |
| 188 DataFormat(format_), | |
| 189 DataType(format_), | |
| 190 memory_); | |
| 191 | 187 |
| 192 return true; | 188 return true; |
| 193 } | 189 } |
| 194 | 190 |
| 195 void GLImageMemory::WillUseTexImage() { | 191 void GLImageMemory::WillUseTexImage() { |
| 196 DCHECK(!in_use_); | 192 DCHECK(!in_use_); |
| 197 in_use_ = true; | 193 in_use_ = true; |
| 198 | 194 |
| 199 if (!need_do_bind_tex_image_) | 195 if (!need_do_bind_tex_image_) |
| 200 return; | 196 return; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 TextureFormat(format_), | 280 TextureFormat(format_), |
| 285 size_.width(), | 281 size_.width(), |
| 286 size_.height(), | 282 size_.height(), |
| 287 0, // border | 283 0, // border |
| 288 DataFormat(format_), | 284 DataFormat(format_), |
| 289 DataType(format_), | 285 DataType(format_), |
| 290 memory_); | 286 memory_); |
| 291 } | 287 } |
| 292 | 288 |
| 293 } // namespace gfx | 289 } // namespace gfx |
| OLD | NEW |