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

Unified Diff: cc/paint/paint_op_buffer.cc

Issue 2823113002: Fix crash in PaintOpBuffer alpha optimization (Closed)
Patch Set: Fix windows question mark Created 3 years, 8 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
« no previous file with comments | « cc/paint/paint_op_buffer.h ('k') | cc/paint/paint_op_buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/paint_op_buffer.cc
diff --git a/cc/paint/paint_op_buffer.cc b/cc/paint/paint_op_buffer.cc
index a98392a162c839b240bcd7218dd7efe8f8687315..fa62a418e9fce2bb5fee71e9f6eb057567ac9171 100644
--- a/cc/paint/paint_op_buffer.cc
+++ b/cc/paint/paint_op_buffer.cc
@@ -120,8 +120,12 @@ struct Rasterizer<DrawRecordOp, false> {
// in the PaintOpBuffer::Raster function as DisplayItemList calls
// into RasterWithAlpha directly.
if (op->record->approximateOpCount() == 1) {
- op->record->GetFirstOp()->RasterWithAlpha(canvas, alpha);
- return;
+ PaintOp* single_op = op->record->GetFirstOp();
+ // RasterWithAlpha only supported for draw ops.
+ if (single_op->IsDrawOp()) {
+ single_op->RasterWithAlpha(canvas, alpha);
+ return;
+ }
}
canvas->saveLayerAlpha(nullptr, alpha);
@@ -358,14 +362,6 @@ void PaintOp::RasterWithAlpha(SkCanvas* canvas, uint8_t alpha) const {
g_raster_alpha_functions[type](this, canvas, alpha);
}
-DrawDisplayItemListOp::DrawDisplayItemListOp(
- scoped_refptr<DisplayItemList> list)
- : list(list) {}
-
-size_t DrawDisplayItemListOp::AdditionalBytesUsed() const {
- return list->ApproximateMemoryUsage();
-}
-
int ClipPathOp::CountSlowPaths() const {
return antialias && !path.isConvex() ? 1 : 0;
}
@@ -412,6 +408,20 @@ AnnotateOp::AnnotateOp(PaintCanvas::AnnotationType annotation_type,
AnnotateOp::~AnnotateOp() = default;
+DrawDisplayItemListOp::DrawDisplayItemListOp(
+ scoped_refptr<DisplayItemList> list)
+ : list(list) {}
+
+size_t DrawDisplayItemListOp::AdditionalBytesUsed() const {
+ return list->ApproximateMemoryUsage();
+}
+
+DrawDisplayItemListOp::DrawDisplayItemListOp(const DrawDisplayItemListOp& op) =
+ default;
+
+DrawDisplayItemListOp& DrawDisplayItemListOp::operator=(
+ const DrawDisplayItemListOp& op) = default;
+
DrawDisplayItemListOp::~DrawDisplayItemListOp() = default;
DrawImageOp::DrawImageOp(const PaintImage& image,
« no previous file with comments | « cc/paint/paint_op_buffer.h ('k') | cc/paint/paint_op_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698