OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 static GLint GetActiveTextureUnit(GLES2Interface* gl) { | 156 static GLint GetActiveTextureUnit(GLES2Interface* gl) { |
157 GLint active_unit = 0; | 157 GLint active_unit = 0; |
158 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 158 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
159 return active_unit; | 159 return active_unit; |
160 } | 160 } |
161 | 161 |
162 class GLRenderer::ScopedUseGrContext { | 162 class GLRenderer::ScopedUseGrContext { |
163 public: | 163 public: |
164 static scoped_ptr<ScopedUseGrContext> Create(GLRenderer* renderer, | 164 static scoped_ptr<ScopedUseGrContext> Create(GLRenderer* renderer, |
165 DrawingFrame* frame) { | 165 DrawingFrame* frame) { |
166 return make_scoped_ptr(new ScopedUseGrContext(renderer, frame)); | 166 // GrContext creation may fail. |
| 167 if (renderer->output_surface_->context_provider()->GrContext()) |
| 168 return make_scoped_ptr(new ScopedUseGrContext(renderer, frame)); |
| 169 return nullptr; |
167 } | 170 } |
168 | 171 |
169 ~ScopedUseGrContext() { | 172 ~ScopedUseGrContext() { |
170 // Pass context control back to GLrenderer. | 173 // Pass context control back to GLrenderer. |
171 scoped_gpu_raster_ = nullptr; | 174 scoped_gpu_raster_ = nullptr; |
172 renderer_->RestoreGLState(); | 175 renderer_->RestoreGLState(); |
173 renderer_->RestoreFramebuffer(frame_); | 176 renderer_->RestoreFramebuffer(frame_); |
174 } | 177 } |
175 | 178 |
176 GrContext* context() const { | 179 GrContext* context() const { |
(...skipping 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3436 context_support_->ScheduleOverlayPlane( | 3439 context_support_->ScheduleOverlayPlane( |
3437 overlay.plane_z_order, | 3440 overlay.plane_z_order, |
3438 overlay.transform, | 3441 overlay.transform, |
3439 pending_overlay_resources_.back()->texture_id(), | 3442 pending_overlay_resources_.back()->texture_id(), |
3440 ToNearestRect(overlay.display_rect), | 3443 ToNearestRect(overlay.display_rect), |
3441 overlay.uv_rect); | 3444 overlay.uv_rect); |
3442 } | 3445 } |
3443 } | 3446 } |
3444 | 3447 |
3445 } // namespace cc | 3448 } // namespace cc |
OLD | NEW |