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 "services/gfx/compositor/backend/gpu_rasterizer.h" | 5 #include "services/gfx/compositor/backend/gpu_rasterizer.h" |
6 | 6 |
7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 void GpuRasterizer::Draw() { | 170 void GpuRasterizer::Draw() { |
171 DCHECK(gl_context_); | 171 DCHECK(gl_context_); |
172 DCHECK(ganesh_context_); | 172 DCHECK(ganesh_context_); |
173 DCHECK(frame_); | 173 DCHECK(frame_); |
174 | 174 |
175 gl_context_->MakeCurrent(); | 175 gl_context_->MakeCurrent(); |
176 | 176 |
177 // Update the viewport. | 177 // Update the viewport. |
178 const SkRect& viewport = frame_->viewport(); | 178 const SkIRect& viewport = frame_->viewport(); |
179 bool stale_surface = false; | 179 bool stale_surface = false; |
180 if (!ganesh_surface_ || | 180 if (!ganesh_surface_ || |
181 ganesh_surface_->surface()->width() != viewport.width() || | 181 ganesh_surface_->surface()->width() != viewport.width() || |
182 ganesh_surface_->surface()->height() != viewport.height()) { | 182 ganesh_surface_->surface()->height() != viewport.height()) { |
183 glResizeCHROMIUM(viewport.width(), viewport.height(), 1.0f); | 183 glResizeCHROMIUM(viewport.width(), viewport.height(), 1.0f); |
184 glViewport(viewport.x(), viewport.y(), viewport.width(), viewport.height()); | 184 glViewport(viewport.x(), viewport.y(), viewport.width(), viewport.height()); |
185 stale_surface = true; | 185 stale_surface = true; |
186 } | 186 } |
187 | 187 |
188 // Paint the frame. | 188 // Paint the frame. |
(...skipping 12 matching lines...) Expand all Loading... |
201 MGLSwapBuffers(); | 201 MGLSwapBuffers(); |
202 frame_callback_.Run(true); | 202 frame_callback_.Run(true); |
203 frame_callback_.Reset(); | 203 frame_callback_.Reset(); |
204 } | 204 } |
205 | 205 |
206 void GpuRasterizer::PostErrorCallback() { | 206 void GpuRasterizer::PostErrorCallback() { |
207 task_runner_->PostTask(FROM_HERE, error_callback_); | 207 task_runner_->PostTask(FROM_HERE, error_callback_); |
208 } | 208 } |
209 | 209 |
210 } // namespace compositor | 210 } // namespace compositor |
OLD | NEW |