Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 12571010: cc: Add a pixel test for background blur outsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/test/layer_tree_pixel_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // 5. Draw the background texture for the contents using the same transform as 555 // 5. Draw the background texture for the contents using the same transform as
556 // used to draw the contents itself. This is done without blending to replace 556 // used to draw the contents itself. This is done without blending to replace
557 // the current background pixels with the new filtered background. 557 // the current background pixels with the new filtered background.
558 // 6. Draw the contents of the quad over drop of the new background with 558 // 6. Draw the contents of the quad over drop of the new background with
559 // blending, as per usual. The filtered background pixels will show through 559 // blending, as per usual. The filtered background pixels will show through
560 // any non-opaque pixels in this draws. 560 // any non-opaque pixels in this draws.
561 // 561 //
562 // Pixel copies in this algorithm occur at steps 2, 3, 4, and 5. 562 // Pixel copies in this algorithm occur at steps 2, 3, 4, and 5.
563 563
564 // FIXME: When this algorithm changes, update 564 // FIXME: When this algorithm changes, update
565 // LayerTreeHost::prioritizeTextures() accordingly. 565 // LayerTreeHost::PrioritizeTextures() accordingly.
566 566
567 const WebKit::WebFilterOperations& filters = quad->background_filters; 567 const WebKit::WebFilterOperations& filters = quad->background_filters;
568 if (filters.isEmpty()) 568 DCHECK(!filters.isEmpty());
569 return scoped_ptr<ScopedResource>();
570 569
571 // FIXME: We only allow background filters on an opaque render surface because 570 // FIXME: We only allow background filters on an opaque render surface because
572 // other surfaces may contain translucent pixels, and the contents behind 571 // other surfaces may contain translucent pixels, and the contents behind
573 // those translucent pixels wouldn't have the filter applied. 572 // those translucent pixels wouldn't have the filter applied.
574 if (frame->current_render_pass->has_transparent_background) 573 if (frame->current_render_pass->has_transparent_background)
575 return scoped_ptr<ScopedResource>(); 574 return scoped_ptr<ScopedResource>();
576 DCHECK(!frame->current_texture); 575 DCHECK(!frame->current_texture);
577 576
578 // FIXME: Do a single readback for both the surface and replica and cache the 577 // FIXME: Do a single readback for both the surface and replica and cache the
579 // filtered results (once filter textures are not reused). 578 // filtered results (once filter textures are not reused).
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 gfx::Transform contents_device_transform = 654 gfx::Transform contents_device_transform =
656 frame->window_matrix * frame->projection_matrix * quad_rect_matrix; 655 frame->window_matrix * frame->projection_matrix * quad_rect_matrix;
657 contents_device_transform.FlattenTo2d(); 656 contents_device_transform.FlattenTo2d();
658 657
659 // Can only draw surface if device matrix is invertible. 658 // Can only draw surface if device matrix is invertible.
660 gfx::Transform contents_device_transform_inverse( 659 gfx::Transform contents_device_transform_inverse(
661 gfx::Transform::kSkipInitialization); 660 gfx::Transform::kSkipInitialization);
662 if (!contents_device_transform.GetInverse(&contents_device_transform_inverse)) 661 if (!contents_device_transform.GetInverse(&contents_device_transform_inverse))
663 return; 662 return;
664 663
665 scoped_ptr<ScopedResource> background_texture = 664 scoped_ptr<ScopedResource> background_texture;
666 DrawBackgroundFilters(frame, 665 if (!quad->background_filters.isEmpty()) {
667 quad, 666 // The pixels from the filtered background should completely replace the
668 contents_device_transform, 667 // current pixel values.
669 contents_device_transform_inverse); 668 bool disable_blending = blend_enabled();
669 if (disable_blending)
670 SetBlendEnabled(false);
671
672 background_texture = DrawBackgroundFilters(
673 frame,
674 quad,
675 contents_device_transform,
676 contents_device_transform_inverse);
677
678 if (disable_blending)
679 SetBlendEnabled(true);
680 }
670 681
671 // FIXME: Cache this value so that we don't have to do it for both the surface 682 // FIXME: Cache this value so that we don't have to do it for both the surface
672 // and its replica. Apply filters to the contents texture. 683 // and its replica. Apply filters to the contents texture.
673 SkBitmap filter_bitmap; 684 SkBitmap filter_bitmap;
674 SkScalar color_matrix[20]; 685 SkScalar color_matrix[20];
675 bool use_color_matrix = false; 686 bool use_color_matrix = false;
676 if (quad->filter) { 687 if (quad->filter) {
677 SkColorFilter* cf; 688 SkColorFilter* cf;
678 if ((quad->filter->asColorFilter(&cf)) && cf->asColorMatrix(color_matrix) && 689 if ((quad->filter->asColorFilter(&cf)) && cf->asColorMatrix(color_matrix) &&
679 !quad->filter->getInput(0)) { 690 !quad->filter->getInput(0)) {
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); 2464 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_);
2454 2465
2455 ReleaseRenderPassTextures(); 2466 ReleaseRenderPassTextures();
2456 } 2467 }
2457 2468
2458 bool GLRenderer::IsContextLost() { 2469 bool GLRenderer::IsContextLost() {
2459 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); 2470 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR);
2460 } 2471 }
2461 2472
2462 } // namespace cc 2473 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/test/layer_tree_pixel_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698