OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "android_webview/browser/gpu_memory_buffer_factory_impl.h" | 5 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" |
6 | 6 |
7 #include "android_webview/public/browser/draw_gl.h" | 7 #include "android_webview/public/browser/draw_gl.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gfx/gpu_memory_buffer.h" | 9 #include "ui/gfx/gpu_memory_buffer.h" |
10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 GpuMemoryBufferFactoryImpl::GpuMemoryBufferFactoryImpl() { | 80 GpuMemoryBufferFactoryImpl::GpuMemoryBufferFactoryImpl() { |
81 } | 81 } |
82 | 82 |
83 GpuMemoryBufferFactoryImpl::~GpuMemoryBufferFactoryImpl() { | 83 GpuMemoryBufferFactoryImpl::~GpuMemoryBufferFactoryImpl() { |
84 } | 84 } |
85 | 85 |
86 gfx::GpuMemoryBuffer* GpuMemoryBufferFactoryImpl::CreateGpuMemoryBuffer( | 86 gfx::GpuMemoryBuffer* GpuMemoryBufferFactoryImpl::CreateGpuMemoryBuffer( |
87 size_t width, | 87 size_t width, |
88 size_t height, | 88 size_t height, |
89 unsigned internalformat) { | 89 unsigned internalformat) { |
90 // For Android WebView we assume the |internalformat| will always be | 90 // For Android WebView we assume the |internalformat| will always be GL_RGBA. |
91 // GL_RGBA8_OES. | 91 CHECK_EQ(static_cast<GLenum>(GL_RGBA), internalformat); |
92 CHECK_EQ(static_cast<GLenum>(GL_RGBA8_OES), internalformat); | |
93 CHECK(g_gl_draw_functions); | 92 CHECK(g_gl_draw_functions); |
94 int buffer_id = g_gl_draw_functions->create_graphic_buffer(width, height); | 93 int buffer_id = g_gl_draw_functions->create_graphic_buffer(width, height); |
95 if (!buffer_id) | 94 if (!buffer_id) |
96 return NULL; | 95 return NULL; |
97 | 96 |
98 return new GpuMemoryBufferImpl(buffer_id, gfx::Size(width, height)); | 97 return new GpuMemoryBufferImpl(buffer_id, gfx::Size(width, height)); |
99 } | 98 } |
100 | 99 |
101 // static | 100 // static |
102 void GpuMemoryBufferFactoryImpl::SetAwDrawGLFunctionTable( | 101 void GpuMemoryBufferFactoryImpl::SetAwDrawGLFunctionTable( |
103 AwDrawGLFunctionTable* table) { | 102 AwDrawGLFunctionTable* table) { |
104 g_gl_draw_functions = table; | 103 g_gl_draw_functions = table; |
105 } | 104 } |
106 | 105 |
107 } // namespace android_webview | 106 } // namespace android_webview |
OLD | NEW |