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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 2495973002: [SPv2] Add filter support in PaintArtifactCompositor (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "platform/graphics/compositing/PaintArtifactCompositor.h" 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h"
6 6
7 #include "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/picture_layer.h" 9 #include "cc/layers/picture_layer.h"
10 #include "cc/playback/display_item_list.h" 10 #include "cc/playback/display_item_list.h"
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 "be contiguous."; 717 "be contiguous.";
718 m_effectNodesConverted.add(nextEffect); 718 m_effectNodesConverted.add(nextEffect);
719 #endif 719 #endif
720 720
721 // We currently create dummy layers to host effect nodes and corresponding 721 // We currently create dummy layers to host effect nodes and corresponding
722 // render surfaces. This should be removed once cc implements better support 722 // render surfaces. This should be removed once cc implements better support
723 // for freestanding property trees. 723 // for freestanding property trees.
724 scoped_refptr<cc::Layer> dummyLayer = nextEffect->ensureDummyLayer(); 724 scoped_refptr<cc::Layer> dummyLayer = nextEffect->ensureDummyLayer();
725 m_rootLayer->AddChild(dummyLayer); 725 m_rootLayer->AddChild(dummyLayer);
726 726
727 // Also cc assumes a clip node is always created by a layer that creates 727 int outputClipId = compositorIdForClipNode(nextEffect->outputClip());
728 // render surface.
729 cc::ClipNode& dummyClip =
730 *clipTree().Node(clipTree().Insert(cc::ClipNode(), kSecondaryRootNodeId));
731 dummyClip.owner_id = dummyLayer->id();
732 dummyClip.transform_id = kRealRootNodeId;
733 dummyClip.target_transform_id = kRealRootNodeId;
734 dummyClip.target_effect_id = kSecondaryRootNodeId;
735 m_propertyTrees.clip_id_to_index_map[dummyClip.owner_id] = dummyClip.id;
736 728
737 cc::EffectNode& effectNode = *effectTree().Node(effectTree().Insert( 729 cc::EffectNode& effectNode = *effectTree().Node(effectTree().Insert(
738 cc::EffectNode(), compositorIdForCurrentEffectNode())); 730 cc::EffectNode(), compositorIdForCurrentEffectNode()));
739 effectNode.owner_id = dummyLayer->id(); 731 effectNode.owner_id = dummyLayer->id();
740 effectNode.clip_id = dummyClip.id; 732 effectNode.clip_id = outputClipId;
741 // Every effect is supposed to have render surface enabled for grouping, 733 // Every effect is supposed to have render surface enabled for grouping,
742 // but we can get away without one if the effect is opacity-only and has only 734 // but we can get away without one if the effect is opacity-only and has only
743 // one compositing child. This is both for optimization and not introducing 735 // one compositing child. This is both for optimization and not introducing
744 // sub-pixel differences in layout tests. 736 // sub-pixel differences in layout tests.
745 // See PropertyTreeManager::switchToEffectNode() where we retrospectively 737 // See PropertyTreeManager::switchToEffectNode() where we retrospectively
746 // enable render surface when more than one compositing child is detected. 738 // enable render surface when more than one compositing child is detected.
747 // TODO(crbug.com/504464): There is ongoing work in cc to delay render surface 739 // TODO(crbug.com/504464): There is ongoing work in cc to delay render surface
748 // decision until later phase of the pipeline. Remove premature optimization 740 // decision until later phase of the pipeline. Remove premature optimization
749 // here once the work is ready. 741 // here once the work is ready.
742 if (!nextEffect->filter().isEmpty())
743 effectNode.has_render_surface = true;
750 effectNode.opacity = nextEffect->opacity(); 744 effectNode.opacity = nextEffect->opacity();
745 effectNode.filters = nextEffect->filter().asCcFilterOperations();
751 m_propertyTrees.effect_id_to_index_map[effectNode.owner_id] = effectNode.id; 746 m_propertyTrees.effect_id_to_index_map[effectNode.owner_id] = effectNode.id;
752 m_effectStack.append(BlinkEffectAndCcIdPair{nextEffect, effectNode.id}); 747 m_effectStack.append(BlinkEffectAndCcIdPair{nextEffect, effectNode.id});
753 748
754 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); 749 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber);
755 dummyLayer->SetTransformTreeIndex(kSecondaryRootNodeId); 750 dummyLayer->SetTransformTreeIndex(kSecondaryRootNodeId);
756 dummyLayer->SetClipTreeIndex(dummyClip.id); 751 dummyLayer->SetClipTreeIndex(outputClipId);
757 dummyLayer->SetEffectTreeIndex(effectNode.id); 752 dummyLayer->SetEffectTreeIndex(effectNode.id);
758 dummyLayer->SetScrollTreeIndex(kRealRootNodeId); 753 dummyLayer->SetScrollTreeIndex(kRealRootNodeId);
759 } 754 }
760 755
761 } // namespace 756 } // namespace
762 757
763 void PaintArtifactCompositor::update( 758 void PaintArtifactCompositor::update(
764 const PaintArtifact& paintArtifact, 759 const PaintArtifact& paintArtifact,
765 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations) { 760 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations) {
766 DCHECK(m_rootLayer); 761 DCHECK(m_rootLayer);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 m_contentLayerClients.clear(); 820 m_contentLayerClients.clear();
826 m_contentLayerClients.swap(newContentLayerClients); 821 m_contentLayerClients.swap(newContentLayerClients);
827 822
828 // Mark the property trees as having been rebuilt. 823 // Mark the property trees as having been rebuilt.
829 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber; 824 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber;
830 layerTree->property_trees()->needs_rebuild = false; 825 layerTree->property_trees()->needs_rebuild = false;
831 layerTree->property_trees()->ResetCachedData(); 826 layerTree->property_trees()->ResetCachedData();
832 } 827 }
833 828
834 } // namespace blink 829 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698