| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ozone/gl/gl_image_ozone_native_pixmap.h" | 5 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ui/gfx/buffer_format_util.h" | 9 #include "ui/gfx/buffer_format_util.h" |
| 10 #include "ui/gl/gl_surface_egl.h" | 10 #include "ui/gl/gl_surface_egl.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 191 } |
| 192 | 192 |
| 193 pixmap_ = pixmap; | 193 pixmap_ = pixmap; |
| 194 return true; | 194 return true; |
| 195 } | 195 } |
| 196 | 196 |
| 197 unsigned GLImageOzoneNativePixmap::GetInternalFormat() { | 197 unsigned GLImageOzoneNativePixmap::GetInternalFormat() { |
| 198 return internalformat_; | 198 return internalformat_; |
| 199 } | 199 } |
| 200 | 200 |
| 201 void GLImageOzoneNativePixmap::Destroy(bool have_context) { | |
| 202 GLImageEGL::Destroy(have_context); | |
| 203 } | |
| 204 | |
| 205 bool GLImageOzoneNativePixmap::CopyTexImage(unsigned target) { | 201 bool GLImageOzoneNativePixmap::CopyTexImage(unsigned target) { |
| 206 if (egl_image_ == EGL_NO_IMAGE_KHR) { | 202 if (egl_image_ == EGL_NO_IMAGE_KHR) { |
| 207 // Pass-through image type fails to bind and copy; make sure we | 203 // Pass-through image type fails to bind and copy; make sure we |
| 208 // don't draw with uninitialized texture. | 204 // don't draw with uninitialized texture. |
| 209 std::vector<unsigned char> data(size_.width() * size_.height() * 4); | 205 std::vector<unsigned char> data(size_.width() * size_.height() * 4); |
| 210 glTexImage2D(target, 0, GL_RGBA, size_.width(), size_.height(), 0, GL_RGBA, | 206 glTexImage2D(target, 0, GL_RGBA, size_.width(), size_.height(), 0, GL_RGBA, |
| 211 GL_UNSIGNED_BYTE, data.data()); | 207 GL_UNSIGNED_BYTE, data.data()); |
| 212 return true; | 208 return true; |
| 213 } | 209 } |
| 214 return GLImageEGL::CopyTexImage(target); | 210 return GLImageEGL::CopyTexImage(target); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 case gfx::BufferFormat::UYVY_422: | 271 case gfx::BufferFormat::UYVY_422: |
| 276 NOTREACHED(); | 272 NOTREACHED(); |
| 277 return GL_NONE; | 273 return GL_NONE; |
| 278 } | 274 } |
| 279 | 275 |
| 280 NOTREACHED(); | 276 NOTREACHED(); |
| 281 return GL_NONE; | 277 return GL_NONE; |
| 282 } | 278 } |
| 283 | 279 |
| 284 } // namespace ui | 280 } // namespace ui |
| OLD | NEW |