Use value_or in getBlendMode_or.
Support for `value_or` was recently added to skstd::optional. (Thanks herb@!) Change-Id: Ie343f8d06f8a26bcd111af8334757c203944b052 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427036 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
parent
586d61dd7a
commit
526b0b92c9
@ -485,7 +485,7 @@ public:
|
|||||||
skstd::optional<SkBlendMode> asBlendMode() const;
|
skstd::optional<SkBlendMode> asBlendMode() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries the blender, and if it can be represented as a SkBendMode, return that mode,
|
* Queries the blender, and if it can be represented as a SkBlendMode, return that mode,
|
||||||
* else return the defaultMode provided.
|
* else return the defaultMode provided.
|
||||||
*/
|
*/
|
||||||
SkBlendMode getBlendMode_or(SkBlendMode defaultMode) const;
|
SkBlendMode getBlendMode_or(SkBlendMode defaultMode) const;
|
||||||
|
@ -152,9 +152,7 @@ skstd::optional<SkBlendMode> SkPaint::asBlendMode() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkBlendMode SkPaint::getBlendMode_or(SkBlendMode defaultMode) const {
|
SkBlendMode SkPaint::getBlendMode_or(SkBlendMode defaultMode) const {
|
||||||
// todo: add value_or() to skstd::optional?
|
return this->asBlendMode().value_or(defaultMode);
|
||||||
const auto bm = this->asBlendMode();
|
|
||||||
return bm ? bm.value() : defaultMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkPaint::isSrcOver() const {
|
bool SkPaint::isSrcOver() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user