Enable tonal color for shadows by default.

This change swaps the sense of the tonal color shadow flag, so
tonal color will always be on unless explicitly disabled.

Change-Id: I56ce4228022cf59b570cd7461327628cf7fe7173
Reviewed-on: https://skia-review.googlesource.com/73900
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2017-11-20 14:28:01 -05:00 committed by Skia Commit-Bot
parent 1e18aa6d7d
commit 53d863c18c
4 changed files with 5 additions and 5 deletions

View File

@ -16,8 +16,8 @@ enum SkShadowFlags {
kTransparentOccluder_ShadowFlag = 0x01,
/** Don't try to use analytic shadows. */
kGeometricOnly_ShadowFlag = 0x02,
/** Use tonal values when applying color */
kTonalColor_ShadowFlag = 0x04,
/** Disable use of tonal values when applying color */
kDisableTonalColor_ShadowFlag = 0x04,
/** mask for all shadow flags */
kAll_ShadowFlag = 0x07
};

View File

@ -112,6 +112,7 @@ protected:
}
if (fTwoPassColor) {
flags |= SkShadowFlags::kDisableTonalColor_ShadowFlag;
SkShadowUtils::DrawShadow(canvas, path, zPlaneParams,
lightPos, lightWidth,
ambientAlpha, 0, SK_ColorBLACK, flags);
@ -136,7 +137,6 @@ protected:
lightPos, lightWidth,
0, spotAlpha, SK_ColorBLACK, flags);
} else {
flags |= SkShadowFlags::kTonalColor_ShadowFlag;
SkShadowUtils::DrawShadow(canvas, path, zPlaneParams,
lightPos, lightWidth,
ambientAlpha, spotAlpha, paint.getColor(), flags);

View File

@ -1047,7 +1047,7 @@ bool GrRenderTargetContext::drawFastShadow(const GrClip& clip,
SkScalar occluderHeight = rec.fZPlaneParams.fZ;
GrColor4f color = GrColor4f::FromGrColor(color4ub);
bool transparent = SkToBool(rec.fFlags & SkShadowFlags::kTransparentOccluder_ShadowFlag);
bool tonalColor = SkToBool(rec.fFlags & SkShadowFlags::kTonalColor_ShadowFlag);
bool tonalColor = !SkToBool(rec.fFlags & SkShadowFlags::kDisableTonalColor_ShadowFlag);
if (rec.fAmbientAlpha > 0) {
SkScalar devSpaceInsetWidth = SkDrawShadowMetrics::AmbientBlurRadius(occluderHeight);

View File

@ -519,7 +519,7 @@ void SkBaseDevice::drawShadow(const SkPath& path, const SkDrawShadowRec& rec) {
bool tiltZPlane = tilted(rec.fZPlaneParams);
bool transparent = SkToBool(rec.fFlags & SkShadowFlags::kTransparentOccluder_ShadowFlag);
bool uncached = tiltZPlane || path.isVolatile();
bool useTonalColor = SkToBool(rec.fFlags & kTonalColor_ShadowFlag);
bool useTonalColor = !SkToBool(rec.fFlags & kDisableTonalColor_ShadowFlag);
SkColor color = rec.fColor;
SkPoint3 zPlaneParams = rec.fZPlaneParams;