OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/gpu/compositor_software_output_device_gl_adapter.h" | 5 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h" |
6 | 6 |
| 7 #include "base/debug/trace_event.h" |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "third_party/skia/include/core/SkPixelRef.h" | 10 #include "third_party/skia/include/core/SkPixelRef.h" |
10 #include "third_party/skia/include/core/SkDevice.h" | 11 #include "third_party/skia/include/core/SkDevice.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
13 | 14 |
14 #include <GLES2/gl2.h> | 15 #include <GLES2/gl2.h> |
15 | 16 |
16 using WebKit::WebImage; | 17 using WebKit::WebImage; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 155 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
155 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 156 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
156 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 157 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
157 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 158 context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
158 | 159 |
159 context3d_->viewport(0, 0, viewport_size.width(), viewport_size.height()); | 160 context3d_->viewport(0, 0, viewport_size.width(), viewport_size.height()); |
160 context3d_->reshape(viewport_size.width(), viewport_size.height()); | 161 context3d_->reshape(viewport_size.width(), viewport_size.height()); |
161 } | 162 } |
162 | 163 |
163 void CompositorSoftwareOutputDeviceGLAdapter::Draw(void* pixels) { | 164 void CompositorSoftwareOutputDeviceGLAdapter::Draw(void* pixels) { |
| 165 TRACE_EVENT0("renderer", "CompositorSoftwareOutputDeviceGLAdapter::Draw"); |
164 if (!initialized_) | 166 if (!initialized_) |
165 NOTREACHED(); | 167 NOTREACHED(); |
166 if (!framebuffer_texture_id_) | 168 if (!framebuffer_texture_id_) |
167 NOTREACHED(); | 169 NOTREACHED(); |
168 | 170 |
169 context3d_->makeContextCurrent(); | 171 context3d_->makeContextCurrent(); |
170 context3d_->ensureFramebufferCHROMIUM(); | 172 context3d_->ensureFramebufferCHROMIUM(); |
171 context3d_->clear(GL_COLOR_BUFFER_BIT); | 173 context3d_->clear(GL_COLOR_BUFFER_BIT); |
172 | 174 |
173 context3d_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, | 175 context3d_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, |
174 framebuffer_texture_size_.width(), framebuffer_texture_size_.height(), | 176 framebuffer_texture_size_.width(), framebuffer_texture_size_.height(), |
175 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 177 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
176 | 178 |
177 context3d_->drawArrays(GL_TRIANGLE_STRIP, 0, 4); | 179 context3d_->drawArrays(GL_TRIANGLE_STRIP, 0, 4); |
178 | 180 |
179 context3d_->prepareTexture(); | 181 context3d_->prepareTexture(); |
180 } | 182 } |
181 | 183 |
182 } // namespace content | 184 } // namespace content |
OLD | NEW |