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

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 & add expectation & add comment 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
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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 "be contiguous."; 708 "be contiguous.";
709 m_effectNodesConverted.add(nextEffect); 709 m_effectNodesConverted.add(nextEffect);
710 #endif 710 #endif
711 711
712 // We currently create dummy layers to host effect nodes and corresponding 712 // We currently create dummy layers to host effect nodes and corresponding
713 // render surfaces. This should be removed once cc implements better support 713 // render surfaces. This should be removed once cc implements better support
714 // for freestanding property trees. 714 // for freestanding property trees.
715 scoped_refptr<cc::Layer> dummyLayer = nextEffect->ensureDummyLayer(); 715 scoped_refptr<cc::Layer> dummyLayer = nextEffect->ensureDummyLayer();
716 m_rootLayer->AddChild(dummyLayer); 716 m_rootLayer->AddChild(dummyLayer);
717 717
718 // Also cc assumes a clip node is always created by a layer that creates 718 int outputClipId = compositorIdForClipNode(nextEffect->outputClip());
719 // render surface.
720 cc::ClipNode& dummyClip =
721 *clipTree().Node(clipTree().Insert(cc::ClipNode(), kSecondaryRootNodeId));
722 dummyClip.owner_id = dummyLayer->id();
723 dummyClip.transform_id = kRealRootNodeId;
724 dummyClip.target_transform_id = kRealRootNodeId;
725 dummyClip.target_effect_id = kSecondaryRootNodeId;
726 719
727 cc::EffectNode& effectNode = *effectTree().Node(effectTree().Insert( 720 cc::EffectNode& effectNode = *effectTree().Node(effectTree().Insert(
728 cc::EffectNode(), compositorIdForCurrentEffectNode())); 721 cc::EffectNode(), compositorIdForCurrentEffectNode()));
729 effectNode.owner_id = dummyLayer->id(); 722 effectNode.owner_id = dummyLayer->id();
730 effectNode.clip_id = dummyClip.id; 723 effectNode.clip_id = outputClipId;
731 // Every effect is supposed to have render surface enabled for grouping, 724 // Every effect is supposed to have render surface enabled for grouping,
732 // but we can get away without one if the effect is opacity-only and has only 725 // but we can get away without one if the effect is opacity-only and has only
733 // one compositing child. This is both for optimization and not introducing 726 // one compositing child. This is both for optimization and not introducing
734 // sub-pixel differences in layout tests. 727 // sub-pixel differences in layout tests.
735 // See PropertyTreeManager::switchToEffectNode() where we retrospectively 728 // See PropertyTreeManager::switchToEffectNode() where we retrospectively
736 // enable render surface when more than one compositing child is detected. 729 // enable render surface when more than one compositing child is detected.
737 // TODO(crbug.com/504464): There is ongoing work in cc to delay render surface 730 // TODO(crbug.com/504464): There is ongoing work in cc to delay render surface
738 // decision until later phase of the pipeline. Remove premature optimization 731 // decision until later phase of the pipeline. Remove premature optimization
739 // here once the work is ready. 732 // here once the work is ready.
733 if (!nextEffect->filter().isEmpty())
734 effectNode.has_render_surface = true;
740 effectNode.opacity = nextEffect->opacity(); 735 effectNode.opacity = nextEffect->opacity();
736 effectNode.filters = nextEffect->filter().asCcFilterOperations();
741 m_effectStack.append(BlinkEffectAndCcIdPair{nextEffect, effectNode.id}); 737 m_effectStack.append(BlinkEffectAndCcIdPair{nextEffect, effectNode.id});
742 738
743 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); 739 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber);
744 dummyLayer->SetTransformTreeIndex(kSecondaryRootNodeId); 740 dummyLayer->SetTransformTreeIndex(kSecondaryRootNodeId);
745 dummyLayer->SetClipTreeIndex(dummyClip.id); 741 dummyLayer->SetClipTreeIndex(outputClipId);
746 dummyLayer->SetEffectTreeIndex(effectNode.id); 742 dummyLayer->SetEffectTreeIndex(effectNode.id);
747 dummyLayer->SetScrollTreeIndex(kRealRootNodeId); 743 dummyLayer->SetScrollTreeIndex(kRealRootNodeId);
748 } 744 }
749 745
750 } // namespace 746 } // namespace
751 747
752 void PaintArtifactCompositor::update( 748 void PaintArtifactCompositor::update(
753 const PaintArtifact& paintArtifact, 749 const PaintArtifact& paintArtifact,
754 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations) { 750 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations) {
755 DCHECK(m_rootLayer); 751 DCHECK(m_rootLayer);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 m_contentLayerClients.clear(); 810 m_contentLayerClients.clear();
815 m_contentLayerClients.swap(newContentLayerClients); 811 m_contentLayerClients.swap(newContentLayerClients);
816 812
817 // Mark the property trees as having been rebuilt. 813 // Mark the property trees as having been rebuilt.
818 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber; 814 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber;
819 layerTree->property_trees()->needs_rebuild = false; 815 layerTree->property_trees()->needs_rebuild = false;
820 layerTree->property_trees()->ResetCachedData(); 816 layerTree->property_trees()->ResetCachedData();
821 } 817 }
822 818
823 } // namespace blink 819 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698