Chromium Code Reviews| Index: src/core/SkRecordOpts.cpp |
| diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp |
| index 4a51beea001df2d138dcc218fff401892859ae0c..17595c01c55b5cef09a6509163346f2ebb0996a2 100644 |
| --- a/src/core/SkRecordOpts.cpp |
| +++ b/src/core/SkRecordOpts.cpp |
| @@ -111,14 +111,14 @@ struct SaveLayerDrawRestoreNooper { |
| const uint32_t layerColor = layerPaint->getColor(); |
| const uint32_t drawColor = drawPaint->getColor(); |
| - if (!IsOnlyAlpha(layerColor) || !IsOpaque(drawColor) || |
| - HasAnyEffect(*layerPaint) || CantFoldAlpha(*drawPaint)) { |
| - // Too fancy for us. Actually, as long as layerColor is just an alpha |
| - // we can blend it into drawColor's alpha; drawColor doesn't strictly have to be opaque. |
| + if (!IsOnlyAlpha(layerColor) || HasAnyEffect(*layerPaint) || CantFoldAlpha(*drawPaint)) { |
| + // Too fancy for us. |
| return false; |
| } |
| - drawPaint->setColor(SkColorSetA(drawColor, SkColorGetA(layerColor))); |
| + drawPaint->setColor(SkColorSetA(drawColor, |
| + SkFloatToIntRound(SkColorGetA(drawColor) * |
|
mtklein
2015/01/13 18:48:20
Let's use SkMulDiv255Round?
Kimmo Kinnunen
2015/01/14 13:07:51
Done.
|
| + SkColorGetA(layerColor) / 255.0f))); |
| return KillSaveLayerAndRestore(record, begin); |
| } |
| @@ -150,9 +150,6 @@ struct SaveLayerDrawRestoreNooper { |
| paint.getImageFilter(); |
| } |
| - static bool IsOpaque(SkColor color) { |
| - return SkColorGetA(color) == SK_AlphaOPAQUE; |
| - } |
| static bool IsOnlyAlpha(SkColor color) { |
| return SK_ColorTRANSPARENT == SkColorSetA(color, SK_AlphaTRANSPARENT); |
| } |