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 18 matching lines...) Expand all Loading... |
29 #include "cc/resources/layer_quad.h" | 29 #include "cc/resources/layer_quad.h" |
30 #include "cc/resources/scoped_resource.h" | 30 #include "cc/resources/scoped_resource.h" |
31 #include "cc/resources/texture_mailbox_deleter.h" | 31 #include "cc/resources/texture_mailbox_deleter.h" |
32 #include "gpu/GLES2/gl2extchromium.h" | 32 #include "gpu/GLES2/gl2extchromium.h" |
33 #include "gpu/command_buffer/client/context_support.h" | 33 #include "gpu/command_buffer/client/context_support.h" |
34 #include "gpu/command_buffer/client/gles2_interface.h" | 34 #include "gpu/command_buffer/client/gles2_interface.h" |
35 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 35 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
36 #include "third_party/skia/include/core/SkBitmap.h" | 36 #include "third_party/skia/include/core/SkBitmap.h" |
37 #include "third_party/skia/include/core/SkColor.h" | 37 #include "third_party/skia/include/core/SkColor.h" |
38 #include "third_party/skia/include/core/SkColorFilter.h" | 38 #include "third_party/skia/include/core/SkColorFilter.h" |
39 #include "third_party/skia/include/core/SkImage.h" | |
40 #include "third_party/skia/include/core/SkSurface.h" | 39 #include "third_party/skia/include/core/SkSurface.h" |
41 #include "third_party/skia/include/gpu/GrContext.h" | 40 #include "third_party/skia/include/gpu/GrContext.h" |
42 #include "third_party/skia/include/gpu/GrTexture.h" | 41 #include "third_party/skia/include/gpu/GrTexture.h" |
| 42 #include "third_party/skia/include/gpu/SkGpuDevice.h" |
43 #include "third_party/skia/include/gpu/SkGrTexturePixelRef.h" | 43 #include "third_party/skia/include/gpu/SkGrTexturePixelRef.h" |
44 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 44 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
45 #include "ui/gfx/geometry/quad_f.h" | 45 #include "ui/gfx/geometry/quad_f.h" |
46 #include "ui/gfx/geometry/rect_conversions.h" | 46 #include "ui/gfx/geometry/rect_conversions.h" |
47 | 47 |
48 using gpu::gles2::GLES2Interface; | 48 using gpu::gles2::GLES2Interface; |
49 | 49 |
50 namespace cc { | 50 namespace cc { |
51 namespace { | 51 namespace { |
52 | 52 |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 (SkColorGetB(color) * (1.0f / 255.0f)) * alpha, | 603 (SkColorGetB(color) * (1.0f / 255.0f)) * alpha, |
604 alpha)); | 604 alpha)); |
605 | 605 |
606 GLC(gl_, gl_->LineWidth(quad->width)); | 606 GLC(gl_, gl_->LineWidth(quad->width)); |
607 | 607 |
608 // The indices for the line are stored in the same array as the triangle | 608 // The indices for the line are stored in the same array as the triangle |
609 // indices. | 609 // indices. |
610 GLC(gl_, gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0)); | 610 GLC(gl_, gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0)); |
611 } | 611 } |
612 | 612 |
613 static skia::RefPtr<SkImage> ApplyImageFilter( | 613 static SkBitmap ApplyImageFilter( |
614 scoped_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, | 614 scoped_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, |
615 ResourceProvider* resource_provider, | 615 ResourceProvider* resource_provider, |
616 const gfx::Point& origin, | 616 const gfx::Point& origin, |
617 const gfx::Vector2dF& scale, | 617 const gfx::Vector2dF& scale, |
618 SkImageFilter* filter, | 618 SkImageFilter* filter, |
619 ScopedResource* source_texture_resource) { | 619 ScopedResource* source_texture_resource) { |
620 if (!filter) | 620 if (!filter) |
621 return skia::RefPtr<SkImage>(); | 621 return SkBitmap(); |
622 | 622 |
623 if (!use_gr_context) | 623 if (!use_gr_context) |
624 return skia::RefPtr<SkImage>(); | 624 return SkBitmap(); |
625 | 625 |
626 ResourceProvider::ScopedReadLockGL lock(resource_provider, | 626 ResourceProvider::ScopedReadLockGL lock(resource_provider, |
627 source_texture_resource->id()); | 627 source_texture_resource->id()); |
628 | 628 |
629 // Wrap the source texture in a Ganesh platform texture. | 629 // Wrap the source texture in a Ganesh platform texture. |
630 GrBackendTextureDesc backend_texture_description; | 630 GrBackendTextureDesc backend_texture_description; |
631 backend_texture_description.fWidth = source_texture_resource->size().width(); | 631 backend_texture_description.fWidth = source_texture_resource->size().width(); |
632 backend_texture_description.fHeight = | 632 backend_texture_description.fHeight = |
633 source_texture_resource->size().height(); | 633 source_texture_resource->size().height(); |
634 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; | 634 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; |
(...skipping 22 matching lines...) Expand all Loading... |
657 desc.fConfig = kSkia8888_GrPixelConfig; | 657 desc.fConfig = kSkia8888_GrPixelConfig; |
658 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 658 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
659 GrAutoScratchTexture scratch_texture( | 659 GrAutoScratchTexture scratch_texture( |
660 use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch); | 660 use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch); |
661 skia::RefPtr<GrTexture> backing_store = | 661 skia::RefPtr<GrTexture> backing_store = |
662 skia::AdoptRef(scratch_texture.detach()); | 662 skia::AdoptRef(scratch_texture.detach()); |
663 if (backing_store.get() == NULL) { | 663 if (backing_store.get() == NULL) { |
664 TRACE_EVENT_INSTANT0("cc", | 664 TRACE_EVENT_INSTANT0("cc", |
665 "ApplyImageFilter scratch texture allocation failed", | 665 "ApplyImageFilter scratch texture allocation failed", |
666 TRACE_EVENT_SCOPE_THREAD); | 666 TRACE_EVENT_SCOPE_THREAD); |
667 return skia::RefPtr<SkImage>(); | 667 return SkBitmap(); |
668 } | 668 } |
669 | 669 |
670 // Create surface to draw into. | 670 // Create a device and canvas using that backing store. |
671 skia::RefPtr<SkSurface> surface = skia::AdoptRef( | 671 skia::RefPtr<SkGpuDevice> device = |
672 SkSurface::NewRenderTargetDirect(backing_store->asRenderTarget())); | 672 skia::AdoptRef(SkGpuDevice::Create(backing_store->asRenderTarget())); |
673 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); | 673 DCHECK(device.get()); |
| 674 SkCanvas canvas(device.get()); |
674 | 675 |
675 // Draw the source bitmap through the filter to the canvas. | 676 // Draw the source bitmap through the filter to the canvas. |
676 SkPaint paint; | 677 SkPaint paint; |
677 paint.setImageFilter(filter); | 678 paint.setImageFilter(filter); |
678 canvas->clear(SK_ColorTRANSPARENT); | 679 canvas.clear(SK_ColorTRANSPARENT); |
679 | 680 |
680 canvas->translate(SkIntToScalar(-origin.x()), SkIntToScalar(-origin.y())); | 681 canvas.translate(SkIntToScalar(-origin.x()), SkIntToScalar(-origin.y())); |
681 canvas->scale(scale.x(), scale.y()); | 682 canvas.scale(scale.x(), scale.y()); |
682 canvas->drawSprite(source, 0, 0, &paint); | 683 canvas.drawSprite(source, 0, 0, &paint); |
683 | |
684 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); | |
685 if (!image || !image->getTexture()) { | |
686 return skia::RefPtr<SkImage>(); | |
687 } | |
688 | 684 |
689 // Flush the GrContext to ensure all buffered GL calls are drawn to the | 685 // Flush the GrContext to ensure all buffered GL calls are drawn to the |
690 // backing store before we access and return it, and have cc begin using the | 686 // backing store before we access and return it, and have cc begin using the |
691 // GL context again. | 687 // GL context again. |
692 canvas->flush(); | 688 use_gr_context->context()->flush(); |
693 | 689 |
694 return image; | 690 return device->accessBitmap(false); |
695 } | 691 } |
696 | 692 |
697 static skia::RefPtr<SkImage> ApplyBlendModeWithBackdrop( | 693 static SkBitmap ApplyBlendModeWithBackdrop( |
698 scoped_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, | 694 scoped_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, |
699 ResourceProvider* resource_provider, | 695 ResourceProvider* resource_provider, |
700 skia::RefPtr<SkImage> source_bitmap_with_filters, | 696 SkBitmap source_bitmap_with_filters, |
701 ScopedResource* source_texture_resource, | 697 ScopedResource* source_texture_resource, |
702 ScopedResource* background_texture_resource, | 698 ScopedResource* background_texture_resource, |
703 SkXfermode::Mode blend_mode) { | 699 SkXfermode::Mode blend_mode) { |
704 if (!use_gr_context) | 700 if (!use_gr_context) |
705 return source_bitmap_with_filters; | 701 return source_bitmap_with_filters; |
706 | 702 |
707 DCHECK(background_texture_resource); | 703 DCHECK(background_texture_resource); |
708 DCHECK(source_texture_resource); | 704 DCHECK(source_texture_resource); |
709 | 705 |
710 gfx::Size source_size = source_texture_resource->size(); | 706 gfx::Size source_size = source_texture_resource->size(); |
711 gfx::Size background_size = background_texture_resource->size(); | 707 gfx::Size background_size = background_texture_resource->size(); |
712 | 708 |
713 DCHECK_LE(background_size.width(), source_size.width()); | 709 DCHECK_LE(background_size.width(), source_size.width()); |
714 DCHECK_LE(background_size.height(), source_size.height()); | 710 DCHECK_LE(background_size.height(), source_size.height()); |
715 | 711 |
716 int source_texture_with_filters_id; | 712 int source_texture_with_filters_id; |
717 scoped_ptr<ResourceProvider::ScopedReadLockGL> lock; | 713 scoped_ptr<ResourceProvider::ScopedReadLockGL> lock; |
718 if (source_bitmap_with_filters) { | 714 if (source_bitmap_with_filters.getTexture()) { |
719 DCHECK_EQ(source_size.width(), source_bitmap_with_filters->width()); | 715 DCHECK_EQ(source_size.width(), source_bitmap_with_filters.width()); |
720 DCHECK_EQ(source_size.height(), source_bitmap_with_filters->height()); | 716 DCHECK_EQ(source_size.height(), source_bitmap_with_filters.height()); |
721 GrTexture* texture = | 717 GrTexture* texture = |
722 reinterpret_cast<GrTexture*>(source_bitmap_with_filters->getTexture()); | 718 reinterpret_cast<GrTexture*>(source_bitmap_with_filters.getTexture()); |
723 source_texture_with_filters_id = texture->getTextureHandle(); | 719 source_texture_with_filters_id = texture->getTextureHandle(); |
724 } else { | 720 } else { |
725 lock.reset(new ResourceProvider::ScopedReadLockGL( | 721 lock.reset(new ResourceProvider::ScopedReadLockGL( |
726 resource_provider, source_texture_resource->id())); | 722 resource_provider, source_texture_resource->id())); |
727 source_texture_with_filters_id = lock->texture_id(); | 723 source_texture_with_filters_id = lock->texture_id(); |
728 } | 724 } |
729 | 725 |
730 ResourceProvider::ScopedReadLockGL lock_background( | 726 ResourceProvider::ScopedReadLockGL lock_background( |
731 resource_provider, background_texture_resource->id()); | 727 resource_provider, background_texture_resource->id()); |
732 | 728 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 skia::AdoptRef(scratch_texture.detach()); | 778 skia::AdoptRef(scratch_texture.detach()); |
783 if (backing_store.get() == NULL) { | 779 if (backing_store.get() == NULL) { |
784 TRACE_EVENT_INSTANT0( | 780 TRACE_EVENT_INSTANT0( |
785 "cc", | 781 "cc", |
786 "ApplyBlendModeWithBackdrop scratch texture allocation failed", | 782 "ApplyBlendModeWithBackdrop scratch texture allocation failed", |
787 TRACE_EVENT_SCOPE_THREAD); | 783 TRACE_EVENT_SCOPE_THREAD); |
788 return source_bitmap_with_filters; | 784 return source_bitmap_with_filters; |
789 } | 785 } |
790 | 786 |
791 // Create a device and canvas using that backing store. | 787 // Create a device and canvas using that backing store. |
792 skia::RefPtr<SkSurface> surface = skia::AdoptRef( | 788 skia::RefPtr<SkGpuDevice> device = |
793 SkSurface::NewRenderTargetDirect(backing_store->asRenderTarget())); | 789 skia::AdoptRef(SkGpuDevice::Create(backing_store->asRenderTarget())); |
794 if (!surface) | 790 DCHECK(device.get()); |
795 return skia::RefPtr<SkImage>(); | 791 SkCanvas canvas(device.get()); |
796 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); | |
797 | 792 |
798 // Draw the source bitmap through the filter to the canvas. | 793 // Draw the source bitmap through the filter to the canvas. |
799 canvas->clear(SK_ColorTRANSPARENT); | 794 canvas.clear(SK_ColorTRANSPARENT); |
800 canvas->drawSprite(background, 0, 0); | 795 canvas.drawSprite(background, 0, 0); |
801 SkPaint paint; | 796 SkPaint paint; |
802 paint.setXfermodeMode(blend_mode); | 797 paint.setXfermodeMode(blend_mode); |
803 canvas->drawSprite(source, 0, 0, &paint); | 798 canvas.drawSprite(source, 0, 0, &paint); |
804 | |
805 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); | |
806 if (!image || !image->getTexture()) { | |
807 return skia::RefPtr<SkImage>(); | |
808 } | |
809 | 799 |
810 // Flush the GrContext to ensure all buffered GL calls are drawn to the | 800 // Flush the GrContext to ensure all buffered GL calls are drawn to the |
811 // backing store before we access and return it, and have cc begin using the | 801 // backing store before we access and return it, and have cc begin using the |
812 // GL context again. | 802 // GL context again. |
813 canvas->flush(); | 803 use_gr_context->context()->flush(); |
814 | 804 |
815 return image; | 805 return device->accessBitmap(false); |
816 } | 806 } |
817 | 807 |
818 scoped_ptr<ScopedResource> GLRenderer::GetBackgroundWithFilters( | 808 scoped_ptr<ScopedResource> GLRenderer::GetBackgroundWithFilters( |
819 DrawingFrame* frame, | 809 DrawingFrame* frame, |
820 const RenderPassDrawQuad* quad, | 810 const RenderPassDrawQuad* quad, |
821 const gfx::Transform& contents_device_transform, | 811 const gfx::Transform& contents_device_transform, |
822 const gfx::Transform& contents_device_transform_inverse, | 812 const gfx::Transform& contents_device_transform_inverse, |
823 bool* background_changed) { | 813 bool* background_changed) { |
824 // This method draws a background filter, which applies a filter to any pixels | 814 // This method draws a background filter, which applies a filter to any pixels |
825 // behind the quad and seen through its background. The algorithm works as | 815 // behind the quad and seen through its background. The algorithm works as |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 { | 866 { |
877 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, | 867 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, |
878 device_background_texture->id()); | 868 device_background_texture->id()); |
879 GetFramebufferTexture( | 869 GetFramebufferTexture( |
880 lock.texture_id(), device_background_texture->format(), window_rect); | 870 lock.texture_id(), device_background_texture->format(), window_rect); |
881 } | 871 } |
882 | 872 |
883 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | 873 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( |
884 quad->background_filters, device_background_texture->size()); | 874 quad->background_filters, device_background_texture->size()); |
885 | 875 |
886 skia::RefPtr<SkImage> filtered_device_background; | 876 SkBitmap filtered_device_background; |
887 if (apply_background_filters) { | 877 if (apply_background_filters) { |
888 filtered_device_background = | 878 filtered_device_background = |
889 ApplyImageFilter(ScopedUseGrContext::Create(this, frame), | 879 ApplyImageFilter(ScopedUseGrContext::Create(this, frame), |
890 resource_provider_, | 880 resource_provider_, |
891 quad->rect.origin(), | 881 quad->rect.origin(), |
892 quad->filters_scale, | 882 quad->filters_scale, |
893 filter.get(), | 883 filter.get(), |
894 device_background_texture.get()); | 884 device_background_texture.get()); |
895 } | 885 } |
896 *background_changed = (filtered_device_background != NULL); | 886 *background_changed = (filtered_device_background.getTexture() != NULL); |
897 | 887 |
898 int filtered_device_background_texture_id = 0; | 888 int filtered_device_background_texture_id = 0; |
899 scoped_ptr<ResourceProvider::ScopedReadLockGL> lock; | 889 scoped_ptr<ResourceProvider::ScopedReadLockGL> lock; |
900 if (filtered_device_background) { | 890 if (filtered_device_background.getTexture()) { |
901 GrTexture* texture = filtered_device_background->getTexture(); | 891 GrTexture* texture = |
| 892 reinterpret_cast<GrTexture*>(filtered_device_background.getTexture()); |
902 filtered_device_background_texture_id = texture->getTextureHandle(); | 893 filtered_device_background_texture_id = texture->getTextureHandle(); |
903 } else { | 894 } else { |
904 lock.reset(new ResourceProvider::ScopedReadLockGL( | 895 lock.reset(new ResourceProvider::ScopedReadLockGL( |
905 resource_provider_, device_background_texture->id())); | 896 resource_provider_, device_background_texture->id())); |
906 filtered_device_background_texture_id = lock->texture_id(); | 897 filtered_device_background_texture_id = lock->texture_id(); |
907 } | 898 } |
908 | 899 |
909 scoped_ptr<ScopedResource> background_texture = | 900 scoped_ptr<ScopedResource> background_texture = |
910 ScopedResource::Create(resource_provider_); | 901 ScopedResource::Create(resource_provider_); |
911 background_texture->Allocate( | 902 background_texture->Allocate( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 contents_device_transform, | 981 contents_device_transform, |
991 contents_device_transform_inverse, | 982 contents_device_transform_inverse, |
992 &background_changed); | 983 &background_changed); |
993 | 984 |
994 if (disable_blending) | 985 if (disable_blending) |
995 SetBlendEnabled(true); | 986 SetBlendEnabled(true); |
996 } | 987 } |
997 | 988 |
998 // TODO(senorblanco): Cache this value so that we don't have to do it for both | 989 // TODO(senorblanco): Cache this value so that we don't have to do it for both |
999 // the surface and its replica. Apply filters to the contents texture. | 990 // the surface and its replica. Apply filters to the contents texture. |
1000 skia::RefPtr<SkImage> filter_bitmap; | 991 SkBitmap filter_bitmap; |
1001 SkScalar color_matrix[20]; | 992 SkScalar color_matrix[20]; |
1002 bool use_color_matrix = false; | 993 bool use_color_matrix = false; |
1003 if (!quad->filters.IsEmpty()) { | 994 if (!quad->filters.IsEmpty()) { |
1004 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | 995 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( |
1005 quad->filters, contents_texture->size()); | 996 quad->filters, contents_texture->size()); |
1006 if (filter) { | 997 if (filter) { |
1007 skia::RefPtr<SkColorFilter> cf; | 998 skia::RefPtr<SkColorFilter> cf; |
1008 | 999 |
1009 { | 1000 { |
1010 SkColorFilter* colorfilter_rawptr = NULL; | 1001 SkColorFilter* colorfilter_rawptr = NULL; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 if (quad->mask_resource_id) { | 1069 if (quad->mask_resource_id) { |
1079 mask_resource_lock.reset(new ResourceProvider::ScopedReadLockGL( | 1070 mask_resource_lock.reset(new ResourceProvider::ScopedReadLockGL( |
1080 resource_provider_, quad->mask_resource_id)); | 1071 resource_provider_, quad->mask_resource_id)); |
1081 mask_texture_id = mask_resource_lock->texture_id(); | 1072 mask_texture_id = mask_resource_lock->texture_id(); |
1082 } | 1073 } |
1083 | 1074 |
1084 // TODO(danakj): use the background_texture and blend the background in with | 1075 // TODO(danakj): use the background_texture and blend the background in with |
1085 // this draw instead of having a separate copy of the background texture. | 1076 // this draw instead of having a separate copy of the background texture. |
1086 | 1077 |
1087 scoped_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; | 1078 scoped_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; |
1088 if (filter_bitmap) { | 1079 if (filter_bitmap.getTexture()) { |
1089 GrTexture* texture = filter_bitmap->getTexture(); | 1080 GrTexture* texture = |
| 1081 reinterpret_cast<GrTexture*>(filter_bitmap.getTexture()); |
1090 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 1082 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
1091 gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); | 1083 gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); |
1092 } else { | 1084 } else { |
1093 contents_resource_lock = | 1085 contents_resource_lock = |
1094 make_scoped_ptr(new ResourceProvider::ScopedSamplerGL( | 1086 make_scoped_ptr(new ResourceProvider::ScopedSamplerGL( |
1095 resource_provider_, contents_texture->id(), GL_LINEAR)); | 1087 resource_provider_, contents_texture->id(), GL_LINEAR)); |
1096 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), | 1088 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), |
1097 contents_resource_lock->target()); | 1089 contents_resource_lock->target()); |
1098 } | 1090 } |
1099 | 1091 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 device_layer_edges.ToQuadF(), | 1326 device_layer_edges.ToQuadF(), |
1335 &clipped); | 1327 &clipped); |
1336 | 1328 |
1337 SetShaderOpacity(quad->opacity(), shader_alpha_location); | 1329 SetShaderOpacity(quad->opacity(), shader_alpha_location); |
1338 SetShaderQuadF(surface_quad, shader_quad_location); | 1330 SetShaderQuadF(surface_quad, shader_quad_location); |
1339 DrawQuadGeometry( | 1331 DrawQuadGeometry( |
1340 frame, quad->quadTransform(), quad->rect, shader_matrix_location); | 1332 frame, quad->quadTransform(), quad->rect, shader_matrix_location); |
1341 | 1333 |
1342 // Flush the compositor context before the filter bitmap goes out of | 1334 // Flush the compositor context before the filter bitmap goes out of |
1343 // scope, so the draw gets processed before the filter texture gets deleted. | 1335 // scope, so the draw gets processed before the filter texture gets deleted. |
1344 if (filter_bitmap) | 1336 if (filter_bitmap.getTexture()) |
1345 GLC(gl_, gl_->Flush()); | 1337 GLC(gl_, gl_->Flush()); |
1346 } | 1338 } |
1347 | 1339 |
1348 struct SolidColorProgramUniforms { | 1340 struct SolidColorProgramUniforms { |
1349 unsigned program; | 1341 unsigned program; |
1350 unsigned matrix_location; | 1342 unsigned matrix_location; |
1351 unsigned viewport_location; | 1343 unsigned viewport_location; |
1352 unsigned quad_location; | 1344 unsigned quad_location; |
1353 unsigned edge_location; | 1345 unsigned edge_location; |
1354 unsigned color_location; | 1346 unsigned color_location; |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3182 context_support_->ScheduleOverlayPlane( | 3174 context_support_->ScheduleOverlayPlane( |
3183 overlay.plane_z_order, | 3175 overlay.plane_z_order, |
3184 overlay.transform, | 3176 overlay.transform, |
3185 pending_overlay_resources_.back()->texture_id(), | 3177 pending_overlay_resources_.back()->texture_id(), |
3186 overlay.display_rect, | 3178 overlay.display_rect, |
3187 overlay.uv_rect); | 3179 overlay.uv_rect); |
3188 } | 3180 } |
3189 } | 3181 } |
3190 | 3182 |
3191 } // namespace cc | 3183 } // namespace cc |
OLD | NEW |