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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return renderer.Pass(); | 144 return renderer.Pass(); |
145 } | 145 } |
146 | 146 |
147 GLRenderer::GLRenderer(RendererClient* client, | 147 GLRenderer::GLRenderer(RendererClient* client, |
148 OutputSurface* output_surface, | 148 OutputSurface* output_surface, |
149 ResourceProvider* resource_provider, | 149 ResourceProvider* resource_provider, |
150 int highp_threshold_min) | 150 int highp_threshold_min) |
151 : DirectRenderer(client, output_surface, resource_provider), | 151 : DirectRenderer(client, output_surface, resource_provider), |
152 offscreen_framebuffer_id_(0), | 152 offscreen_framebuffer_id_(0), |
153 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), | 153 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), |
154 context_(output_surface->context3d()), | 154 context_(output_surface->context_provider()->Context3d()), |
155 is_backbuffer_discarded_(false), | 155 is_backbuffer_discarded_(false), |
156 discard_backbuffer_when_not_visible_(false), | 156 discard_backbuffer_when_not_visible_(false), |
157 is_using_bind_uniform_(false), | 157 is_using_bind_uniform_(false), |
158 visible_(true), | 158 visible_(true), |
159 is_scissor_enabled_(false), | 159 is_scissor_enabled_(false), |
160 stencil_shadow_(false), | 160 stencil_shadow_(false), |
161 blend_shadow_(false), | 161 blend_shadow_(false), |
162 highp_threshold_min_(highp_threshold_min), | 162 highp_threshold_min_(highp_threshold_min), |
163 highp_threshold_cache_(0), | 163 highp_threshold_cache_(0), |
164 offscreen_context_labelled_(false), | 164 offscreen_context_labelled_(false), |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 // Flush skia context so that all the rendered stuff appears on the | 504 // Flush skia context so that all the rendered stuff appears on the |
505 // texture. | 505 // texture. |
506 offscreen_contexts->GrContext()->flush(); | 506 offscreen_contexts->GrContext()->flush(); |
507 | 507 |
508 // Flush the GL context so rendering results from this context are | 508 // Flush the GL context so rendering results from this context are |
509 // visible in the compositor's context. | 509 // visible in the compositor's context. |
510 offscreen_contexts->Context3d()->flush(); | 510 offscreen_contexts->Context3d()->flush(); |
511 | 511 |
512 // Use the compositor's GL context again. | 512 // Use the compositor's GL context again. |
513 renderer->resource_provider()->GraphicsContext3D()->makeContextCurrent(); | 513 renderer->Context()->makeContextCurrent(); |
514 return source; | 514 return source; |
515 } | 515 } |
516 | 516 |
517 static SkBitmap ApplyImageFilter(GLRenderer* renderer, | 517 static SkBitmap ApplyImageFilter(GLRenderer* renderer, |
518 SkImageFilter* filter, | 518 SkImageFilter* filter, |
519 ScopedResource* source_texture_resource) { | 519 ScopedResource* source_texture_resource) { |
520 if (!filter) | 520 if (!filter) |
521 return SkBitmap(); | 521 return SkBitmap(); |
522 | 522 |
523 ContextProvider* offscreen_contexts = | 523 ContextProvider* offscreen_contexts = |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 // Flush skia context so that all the rendered stuff appears on the | 586 // Flush skia context so that all the rendered stuff appears on the |
587 // texture. | 587 // texture. |
588 offscreen_contexts->GrContext()->flush(); | 588 offscreen_contexts->GrContext()->flush(); |
589 | 589 |
590 // Flush the GL context so rendering results from this context are | 590 // Flush the GL context so rendering results from this context are |
591 // visible in the compositor's context. | 591 // visible in the compositor's context. |
592 offscreen_contexts->Context3d()->flush(); | 592 offscreen_contexts->Context3d()->flush(); |
593 | 593 |
594 // Use the compositor's GL context again. | 594 // Use the compositor's GL context again. |
595 renderer->resource_provider()->GraphicsContext3D()->makeContextCurrent(); | 595 renderer->Context()->makeContextCurrent(); |
596 | 596 |
597 return device.accessBitmap(false); | 597 return device.accessBitmap(false); |
598 } | 598 } |
599 | 599 |
600 scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( | 600 scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( |
601 DrawingFrame* frame, | 601 DrawingFrame* frame, |
602 const RenderPassDrawQuad* quad, | 602 const RenderPassDrawQuad* quad, |
603 const gfx::Transform& contents_device_transform, | 603 const gfx::Transform& contents_device_transform, |
604 const gfx::Transform& contents_device_transform_inverse) { | 604 const gfx::Transform& contents_device_transform_inverse) { |
605 // This method draws a background filter, which applies a filter to any pixels | 605 // This method draws a background filter, which applies a filter to any pixels |
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3156 std::string unique_context_name = base::StringPrintf( | 3156 std::string unique_context_name = base::StringPrintf( |
3157 "%s-Offscreen-%p", | 3157 "%s-Offscreen-%p", |
3158 Settings().compositor_name.c_str(), | 3158 Settings().compositor_name.c_str(), |
3159 context_); | 3159 context_); |
3160 resource_provider()->offscreen_context_provider()->Context3d()-> | 3160 resource_provider()->offscreen_context_provider()->Context3d()-> |
3161 pushGroupMarkerEXT(unique_context_name.c_str()); | 3161 pushGroupMarkerEXT(unique_context_name.c_str()); |
3162 } | 3162 } |
3163 | 3163 |
3164 | 3164 |
3165 } // namespace cc | 3165 } // namespace cc |
OLD | NEW |