| Index: third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
|
| index 174649d4c63e92e8888ca1d9d7cb439ef407e908..78b8cb11945df9aa2d4ad5938a2df790d767e50f 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
|
| @@ -7,23 +7,35 @@
|
| #include "platform/TraceEvent.h"
|
| #include "platform/geometry/IntRect.h"
|
| #include "platform/graphics/paint/DrawingDisplayItem.h"
|
| +#include "third_party/skia/include/core/SkRegion.h"
|
|
|
| namespace blink {
|
|
|
| namespace {
|
|
|
| -void computeChunkBounds(const DisplayItemList& displayItems, Vector<PaintChunk>& paintChunks)
|
| +void computeChunkBoundsAndOpaqueness(const DisplayItemList& displayItems, Vector<PaintChunk>& paintChunks)
|
| {
|
| for (PaintChunk& chunk : paintChunks) {
|
| FloatRect bounds;
|
| + SkRegion knownToBeOpaqueRegion;
|
| for (const DisplayItem& item : displayItems.itemsInPaintChunk(chunk)) {
|
| if (!item.isDrawing())
|
| continue;
|
| const auto& drawing = static_cast<const DrawingDisplayItem&>(item);
|
| - if (const SkPicture* picture = drawing.picture())
|
| - bounds.unite(picture->cullRect());
|
| + if (const SkPicture* picture = drawing.picture()) {
|
| + const SkRect& pictureRect = picture->cullRect();
|
| + bounds.unite(pictureRect);
|
| + if (drawing.knownToBeOpaque()) {
|
| + SkIRect conservativelyRoundedPictureRect;
|
| + pictureRect.roundIn(&conservativelyRoundedPictureRect);
|
| + knownToBeOpaqueRegion.op(conservativelyRoundedPictureRect, SkRegion::kUnion_Op);
|
| + }
|
| + }
|
| }
|
| chunk.bounds = bounds;
|
| +
|
| + if (knownToBeOpaqueRegion.contains(enclosedIntRect(bounds)))
|
| + chunk.knownToBeOpaque = true;
|
| }
|
| }
|
|
|
| @@ -38,7 +50,7 @@ PaintArtifact::PaintArtifact(DisplayItemList displayItems, Vector<PaintChunk> pa
|
| : m_displayItemList(std::move(displayItems))
|
| , m_paintChunks(std::move(paintChunks))
|
| {
|
| - computeChunkBounds(m_displayItemList, m_paintChunks);
|
| + computeChunkBoundsAndOpaqueness(m_displayItemList, m_paintChunks);
|
| }
|
|
|
| PaintArtifact::PaintArtifact(PaintArtifact&& source)
|
|
|