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

Unified Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h

Issue 2714673002: [SPv2] Implement effect compositing for indirect reasons (Closed)
Patch Set: address review comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
index 50aed967eb27513a481fe7e6816be1f6c0abac32..8eb3a3b1968815b3b261012d911e65803b453708 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
@@ -92,13 +92,27 @@ class PLATFORM_EXPORT PaintArtifactCompositor {
// A pending layer is a collection of paint chunks that will end up in
// the same cc::Layer.
struct PLATFORM_EXPORT PendingLayer {
- PendingLayer(const PaintChunk& firstPaintChunk);
- void add(const PaintChunk&, GeometryMapper*);
+ PendingLayer(const PaintChunk& firstPaintChunk,
+ bool chunkIsForeign,
+ GeometryMapper&);
+ // Merge another pending layer after this one, appending all its paint
+ // chunks after chunks in this layer, with appropriate space conversion
+ // applied. The merged layer must have a property tree state that's deeper
+ // than this layer, i.e. can "upcast" to this layer's state.
+ void merge(const PendingLayer& guest, GeometryMapper&);
+ bool canMerge(const PendingLayer& guest) const;
+ // Mutate this layer's property tree state to a more general (shallower)
+ // state, thus the name "upcast". The concrete effect of this is to
+ // "decomposite" some of the properties, so that fewer properties will be
+ // applied by the compositor, and more properties will be applied internally
+ // to the chunks as Skia commands.
+ void upcast(const PropertyTreeState&, GeometryMapper&);
FloatRect bounds;
Vector<const PaintChunk*> paintChunks;
bool knownToBeOpaque;
bool backfaceHidden;
PropertyTreeState propertyTreeState;
+ bool isForeign;
};
PaintArtifactCompositor();
@@ -106,13 +120,32 @@ class PLATFORM_EXPORT PaintArtifactCompositor {
class ContentLayerClientImpl;
// Collects the PaintChunks into groups which will end up in the same
- // cc layer. This includes testing PaintChunks for "merge" compatibility (e.g.
- // directly composited property tree states are separately composited)
- // and overlap testing (PaintChunks that overlap existing PaintLayers they
- // are not compatible with must be separately composited).
+ // cc layer. This is the entry point of the layerization algorithm.
void collectPendingLayers(const PaintArtifact&,
Vector<PendingLayer>& pendingLayers,
GeometryMapper&);
+ // This is the internal recursion of collectPendingLayers. This function
+ // loops over the list of paint chunks, scoped by an isolated group
+ // (i.e. effect node). Inside of the loop, chunks are tested for overlap
+ // and merge compatibility. Subgroups are handled by recursion, and will
+ // be tested for "decompositing" upon return.
+ // Merge compatibility means consecutive chunks may be layerized into the
+ // same backing (i.e. merged) if their property states don't cross
+ // direct-compositing boundary.
+ // Non-consecutive chunks that are nevertheless compatible may still be
+ // merged, if reordering of the chunks won't affect the ultimate result.
+ // This is determined by overlap testing such that chunks can be safely
+ // reordered if their effective bounds in screen space can't overlap.
+ // The recursion only tests merge & overlap for chunks scoped by the same
+ // group. This is where "decompositing" came in. Upon returning from a
+ // recursion, the layerization of the subgroup may be tested for merge &
+ // overlap with other chunks in the parent group, if grouping requirement
+ // can be satisfied (and the effect node has no direct reason).
+ static void layerizeGroup(const PaintArtifact&,
+ Vector<PendingLayer>& pendingLayers,
+ GeometryMapper&,
+ const EffectPaintPropertyNode&,
+ Vector<PaintChunk>::const_iterator& chunkCursor);
// Builds a leaf layer that represents a single paint chunk.
// Note: cc::Layer API assumes the layer bounds start at (0, 0), but the
@@ -142,19 +175,6 @@ class PLATFORM_EXPORT PaintArtifactCompositor {
const gfx::Rect& combinedBounds,
GeometryMapper&);
- static bool canMergeInto(const PaintArtifact&,
- const PaintChunk& newChunk,
- const PendingLayer& candidatePendingLayer);
-
- // Returns true if |newChunk| might overlap |candidatePendingLayer| in the
- // root property tree space. If it does overlap, it will always return true.
- // If it doesn't overlap, it might return true in cases were we can't
- // efficiently determine a false value, or the truth depends on
- // compositor animations.
- static bool mightOverlap(const PaintChunk& newChunk,
- const PendingLayer& candidatePendingLayer,
- GeometryMapper&);
-
scoped_refptr<cc::Layer> m_rootLayer;
std::unique_ptr<WebLayer> m_webLayer;
Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients;

Powered by Google App Engine
This is Rietveld 408576698