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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 return SkBitmap(); | 452 return SkBitmap(); |
453 | 453 |
454 ResourceProvider::ScopedWriteLockGL lock(renderer->resource_provider(), | 454 ResourceProvider::ScopedWriteLockGL lock(renderer->resource_provider(), |
455 source_texture_resource->id()); | 455 source_texture_resource->id()); |
456 | 456 |
457 // Flush the compositor context to ensure that textures there are available | 457 // Flush the compositor context to ensure that textures there are available |
458 // in the shared context. Do this after locking/creating the compositor | 458 // in the shared context. Do this after locking/creating the compositor |
459 // texture. | 459 // texture. |
460 renderer->resource_provider()->Flush(); | 460 renderer->resource_provider()->Flush(); |
461 | 461 |
462 // Make sure skia uses the correct GL context. | |
463 offscreen_contexts->MakeGrContextCurrent(); | |
464 | |
465 // Wrap the source texture in a Ganesh platform texture. | 462 // Wrap the source texture in a Ganesh platform texture. |
466 GrBackendTextureDesc backend_texture_description; | 463 GrBackendTextureDesc backend_texture_description; |
467 backend_texture_description.fWidth = source_texture_resource->size().width(); | 464 backend_texture_description.fWidth = source_texture_resource->size().width(); |
468 backend_texture_description.fHeight = | 465 backend_texture_description.fHeight = |
469 source_texture_resource->size().height(); | 466 source_texture_resource->size().height(); |
470 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; | 467 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; |
471 backend_texture_description.fTextureHandle = lock.texture_id(); | 468 backend_texture_description.fTextureHandle = lock.texture_id(); |
472 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; | 469 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; |
473 skia::RefPtr<GrTexture> texture = | 470 skia::RefPtr<GrTexture> texture = |
474 skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( | 471 skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 557 } |
561 | 558 |
562 ResourceProvider::ScopedReadLockGL lock_background( | 559 ResourceProvider::ScopedReadLockGL lock_background( |
563 renderer->resource_provider(), background_texture_resource->id()); | 560 renderer->resource_provider(), background_texture_resource->id()); |
564 | 561 |
565 // Flush the compositor context to ensure that textures there are available | 562 // Flush the compositor context to ensure that textures there are available |
566 // in the shared context. Do this after locking/creating the compositor | 563 // in the shared context. Do this after locking/creating the compositor |
567 // texture. | 564 // texture. |
568 renderer->resource_provider()->Flush(); | 565 renderer->resource_provider()->Flush(); |
569 | 566 |
570 // Make sure skia uses the correct GL context. | |
571 offscreen_contexts->MakeGrContextCurrent(); | |
572 | |
573 // Wrap the source texture in a Ganesh platform texture. | 567 // Wrap the source texture in a Ganesh platform texture. |
574 GrBackendTextureDesc backend_texture_description; | 568 GrBackendTextureDesc backend_texture_description; |
575 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; | 569 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; |
576 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; | 570 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; |
577 | 571 |
578 backend_texture_description.fWidth = source_size.width(); | 572 backend_texture_description.fWidth = source_size.width(); |
579 backend_texture_description.fHeight = source_size.height(); | 573 backend_texture_description.fHeight = source_size.height(); |
580 backend_texture_description.fTextureHandle = source_texture_with_filters_id; | 574 backend_texture_description.fTextureHandle = source_texture_with_filters_id; |
581 skia::RefPtr<GrTexture> source_texture = | 575 skia::RefPtr<GrTexture> source_texture = |
582 skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( | 576 skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( |
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 is_scissor_enabled_ = false; | 2998 is_scissor_enabled_ = false; |
3005 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST)); | 2999 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST)); |
3006 scissor_rect_needs_reset_ = true; | 3000 scissor_rect_needs_reset_ = true; |
3007 } | 3001 } |
3008 | 3002 |
3009 bool GLRenderer::IsContextLost() { | 3003 bool GLRenderer::IsContextLost() { |
3010 return output_surface_->context_provider()->IsContextLost(); | 3004 return output_surface_->context_provider()->IsContextLost(); |
3011 } | 3005 } |
3012 | 3006 |
3013 } // namespace cc | 3007 } // namespace cc |
OLD | NEW |