summaryrefslogtreecommitdiff
path: root/chromium/cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-08-08 17:47:06 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-08-09 11:07:23 +0000
commita3ee7849e3b0ad3d5f9595fa1cfd694c22dcee2a (patch)
treedab5d7f392b3b7d1198c0584ae0a1e0e8511967b /chromium/cc
parent9a05d0e4db172168e429f30bc8ed62b695006490 (diff)
downloadqtwebengine-chromium-a3ee7849e3b0ad3d5f9595fa1cfd694c22dcee2a.tar.gz
BASELINE: Update Chromium to 60.0.3112.96
Change-Id: I8fa4120b6b8153b5be2520e57cf76c8d210bc2b5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/cc')
-rw-r--r--chromium/cc/paint/paint_op_buffer.cc12
-rw-r--r--chromium/cc/paint/paint_op_buffer_unittest.cc26
2 files changed, 32 insertions, 6 deletions
diff --git a/chromium/cc/paint/paint_op_buffer.cc b/chromium/cc/paint/paint_op_buffer.cc
index a50c0cf38e2..53e75b33ead 100644
--- a/chromium/cc/paint/paint_op_buffer.cc
+++ b/chromium/cc/paint/paint_op_buffer.cc
@@ -82,16 +82,16 @@ NOINLINE static void RasterWithAlphaInternalForFlags(
SkCanvas* canvas,
uint8_t alpha) {
SkMatrix unused_matrix;
- if (alpha == 255) {
+ if (!op->flags.SupportsFoldingAlpha()) {
+ canvas->saveLayerAlpha(nullptr, alpha);
+ raster_fn(op, &op->flags, canvas, unused_matrix);
+ canvas->restore();
+ } else if (alpha == 255) {
raster_fn(op, &op->flags, canvas, unused_matrix);
- } else if (op->flags.SupportsFoldingAlpha()) {
+ } else {
PaintFlags flags = op->flags;
flags.setAlpha(SkMulDiv255Round(flags.getAlpha(), alpha));
raster_fn(op, &flags, canvas, unused_matrix);
- } else {
- canvas->saveLayerAlpha(nullptr, alpha);
- raster_fn(op, &op->flags, canvas, unused_matrix);
- canvas->restore();
}
}
diff --git a/chromium/cc/paint/paint_op_buffer_unittest.cc b/chromium/cc/paint/paint_op_buffer_unittest.cc
index 5751c2fa1e0..5b8468c86fb 100644
--- a/chromium/cc/paint/paint_op_buffer_unittest.cc
+++ b/chromium/cc/paint/paint_op_buffer_unittest.cc
@@ -291,6 +291,32 @@ TEST(PaintOpBufferTest, SaveDrawRestoreFail_BadFlags) {
EXPECT_EQ(draw_flags.getAlpha(), canvas.paint_.getAlpha());
}
+// Same as above, but the save layer itself appears to be a noop.
+// See: http://crbug.com/748485. If the inner draw op itself
+// doesn't support folding, then the external save can't be skipped.
+TEST(PaintOpBufferTest, SaveDrawRestore_BadFlags255Alpha) {
+ PaintOpBuffer buffer;
+
+ uint8_t alpha = 255;
+ buffer.push<SaveLayerAlphaOp>(nullptr, alpha);
+
+ PaintFlags draw_flags;
+ draw_flags.setColor(SK_ColorMAGENTA);
+ draw_flags.setAlpha(50);
+ draw_flags.setBlendMode(SkBlendMode::kColorBurn);
+ EXPECT_FALSE(draw_flags.SupportsFoldingAlpha());
+ SkRect rect = SkRect::MakeXYWH(1, 2, 3, 4);
+ buffer.push<DrawRectOp>(rect, draw_flags);
+ buffer.push<RestoreOp>();
+
+ SaveCountingCanvas canvas;
+ buffer.playback(&canvas);
+
+ EXPECT_EQ(1, canvas.save_count_);
+ EXPECT_EQ(1, canvas.restore_count_);
+ EXPECT_EQ(rect, canvas.draw_rect_);
+}
+
// The same as SaveDrawRestore, but test that the optimization doesn't apply
// when there are more than one ops between the save and restore.
TEST(PaintOpBufferTest, SaveDrawRestoreFail_TooManyOps) {