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

Unified Diff: src/core/SkRecordOpts.cpp

Issue 2314073002: check for null-layer-paint after prev fix to savelayer ops (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordOpts.cpp
diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp
index 7899077a99dcf040018ce199c208336d3a12e184..af137109e7e25ca43b22a5551adb6993209b204e 100644
--- a/src/core/SkRecordOpts.cpp
+++ b/src/core/SkRecordOpts.cpp
@@ -87,7 +87,7 @@ struct SaveOnlyDrawsRestoreNooper {
}
};
-static bool fold_opacity_layer_color_to_paint(const SkPaint& layerPaint,
+static bool fold_opacity_layer_color_to_paint(const SkPaint* layerPaint,
bool isSaveLayer,
SkPaint* paint) {
// We assume layerPaint is always from a saveLayer. If isSaveLayer is
@@ -121,22 +121,24 @@ static bool fold_opacity_layer_color_to_paint(const SkPaint& layerPaint,
return false;
}
- const uint32_t layerColor = layerPaint.getColor();
+ const uint32_t layerColor = layerPaint ? layerPaint->getColor() : SK_ColorBLACK;
mtklein 2016/09/06 16:00:53 How about if (layerPaint) { SkColor layerColor
reed1 2016/09/06 16:49:44 Done.
// The layer paint color must have only alpha component.
if (SK_ColorTRANSPARENT != SkColorSetA(layerColor, SK_AlphaTRANSPARENT)) {
return false;
}
- // The layer paint can not have any effects.
- if (layerPaint.getPathEffect() ||
- layerPaint.getShader() ||
- layerPaint.getXfermode() ||
- layerPaint.getMaskFilter() ||
- layerPaint.getColorFilter() ||
- layerPaint.getRasterizer() ||
- layerPaint.getLooper() ||
- layerPaint.getImageFilter()) {
- return false;
+ if (layerPaint) {
+ // The layer paint can not have any effects.
+ if (layerPaint->getPathEffect() ||
+ layerPaint->getShader() ||
+ layerPaint->getXfermode() ||
+ layerPaint->getMaskFilter() ||
+ layerPaint->getColorFilter() ||
+ layerPaint->getRasterizer() ||
+ layerPaint->getLooper() ||
+ layerPaint->getImageFilter()) {
+ return false;
+ }
}
paint->setAlpha(SkMulDiv255Round(paint->getAlpha(), SkColorGetA(layerColor)));
@@ -211,7 +213,7 @@ struct SaveLayerDrawRestoreNooper {
return false;
}
- if (!fold_opacity_layer_color_to_paint(*layerPaint, false /*isSaveLayer*/, drawPaint)) {
+ if (!fold_opacity_layer_color_to_paint(layerPaint, false /*isSaveLayer*/, drawPaint)) {
return false;
}
@@ -264,7 +266,7 @@ struct SvgOpacityAndFilterLayerMergePass {
return false;
}
- if (!fold_opacity_layer_color_to_paint(*opacityPaint, true /*isSaveLayer*/,
+ if (!fold_opacity_layer_color_to_paint(opacityPaint, true /*isSaveLayer*/,
filterLayerPaint)) {
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698