forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Back PaintRecord with PaintOpBuffer instead of SkPicture
Change the backing of PaintRecord to be a data structure implemented in cc/paint instead of using SkPicture directly. This new class cribs heavily from SkLiteDL. PaintRecord used to be a typedef to an SkPicture but now is a typedef to a PaintOpBuffer. (This leaves some flexibility to change this in the future to an interface without having to modify all of Chromium again.) PaintOpBuffer stores a contiguous array of ops, with the ops stored in place. As an optimization, the first op is stored locally in the PaintOpBuffer itself to avoid extra allocations for small pictures. This patch moves slow path counting from a gpu analysis canvas into PaintOpBuffer directly. As ops are recorded, slow paths are counted, and a PaintRecord now knows how many ops it has. This is about a 1.5% savings for record time (gpu analysis was 2% and 0.5% overhead to record later). This patch also implements the SkRecordNoopSaveLayerDrawRestores optimization from Skia at raster time. This takes save layer (just opacity) / draw / restore commands and turns them into draws with opacity. It moves that optimization from Blink at record time inside of CompositingRecorder and moves it to both DisplayItemList::RasterItem and PaintOpBuffer::playback (since a save could be either a DisplayItem or a PaintOp). It's not as robust as Skia's solution and so misses a few cases that Skia catches, but the rasterize and record on 10k page agreed that performance was good enough. CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2768143002 Cr-Commit-Position: refs/heads/master@{#464555}
- Loading branch information
Showing
65 changed files
with
2,527 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "cc/paint/paint_flags.h" | ||
|
||
namespace cc { | ||
|
||
bool PaintFlags::IsSimpleOpacity() const { | ||
uint32_t color = getColor(); | ||
if (SK_ColorTRANSPARENT != SkColorSetA(color, SK_AlphaTRANSPARENT)) | ||
return false; | ||
if (!isSrcOver()) | ||
return false; | ||
if (getLooper()) | ||
return false; | ||
if (getPathEffect()) | ||
return false; | ||
if (getShader()) | ||
return false; | ||
if (getMaskFilter()) | ||
return false; | ||
if (getColorFilter()) | ||
return false; | ||
if (getImageFilter()) | ||
return false; | ||
return true; | ||
} | ||
|
||
bool PaintFlags::SupportsFoldingAlpha() const { | ||
if (!isSrcOver()) | ||
return false; | ||
if (getColorFilter()) | ||
return false; | ||
if (getImageFilter()) | ||
return false; | ||
if (getLooper()) | ||
return false; | ||
return true; | ||
} | ||
|
||
} // namespace cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.