Mark operator bool() explicit in src, tests, and modules

Change-Id: Ic664ad0134d61dcf939dcf585a81d53e29c6afcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/496597
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2022-01-19 14:19:02 +00:00 committed by SkCQ
parent 896d278a5c
commit a1fd1c189c
11 changed files with 12 additions and 12 deletions

View File

@ -276,7 +276,7 @@ private:
}
}
operator bool() const { return !!fInfo; }
explicit operator bool() const { return !!fInfo; }
const skjson::ObjectValue& operator*() const { return *fInfo->fAsset; }

View File

@ -30,7 +30,7 @@ public:
fDidBind = this->bind(abuilder, json_dom.root(), &fValue);
}
operator bool() const { return fDidBind; }
explicit operator bool() const { return fDidBind; }
const T& operator()(float t) { this->seek(t); return fValue; }

View File

@ -110,7 +110,7 @@ public:
const SkSVGNode* operator->() const { return fBorrowed.get(); }
const SkSVGNode& operator*() const { return *fBorrowed; }
operator bool() const { return !!fBorrowed; }
explicit operator bool() const { return !!fBorrowed; }
private:
// noncopyable

View File

@ -460,7 +460,7 @@ public:
bool fIsNewContour;
// Returns true when it holds an Edge, false when the path is done.
operator bool() { return fPts != nullptr; }
explicit operator bool() { return fPts != nullptr; }
};
Result next() {

View File

@ -18,7 +18,7 @@
class SkSafeRange {
public:
operator bool() const { return fOK; }
explicit operator bool() const { return fOK; }
bool ok() const { return fOK; }

View File

@ -18,7 +18,7 @@ namespace skgpu {
struct BufferWriter {
public:
operator bool() const { return fPtr != nullptr; }
explicit operator bool() const { return fPtr != nullptr; }
protected:
BufferWriter() = default;

View File

@ -52,7 +52,7 @@ public:
bool operator==(const GrDrawIndirectWriter& that) { return fData == that.fData; }
operator bool() const { return fData != nullptr; }
explicit operator bool() const { return fData != nullptr; }
GrDrawIndirectWriter makeOffset(int drawCount) const { return {fData + drawCount}; }
@ -87,7 +87,7 @@ public:
bool operator==(const GrDrawIndexedIndirectWriter& that) { return fData == that.fData; }
operator bool() const { return fData != nullptr; }
explicit operator bool() const { return fData != nullptr; }
GrDrawIndexedIndirectWriter makeOffset(int drawCount) const { return {fData + drawCount}; }

View File

@ -619,7 +619,7 @@ public:
ProgramImpl& operator*() const;
ProgramImpl* operator->() const;
Iter& operator++();
operator bool() const { return !fFPStack.empty(); }
explicit operator bool() const { return !fFPStack.empty(); }
// Because each iterator carries a stack we want to avoid copies.
Iter(const Iter&) = delete;

View File

@ -29,7 +29,7 @@ public:
GrSurfaceProxyView(GrSurfaceProxyView&& view) = default;
GrSurfaceProxyView(const GrSurfaceProxyView&) = default;
operator bool() const { return SkToBool(fProxy.get()); }
explicit operator bool() const { return SkToBool(fProxy.get()); }
GrSurfaceProxyView& operator=(const GrSurfaceProxyView&) = default;
GrSurfaceProxyView& operator=(GrSurfaceProxyView&& view) = default;

View File

@ -23,7 +23,7 @@ public:
struct Validator {
Validator(sk_sp<SharedGenerator>, const SkColorType*, sk_sp<SkColorSpace>);
operator bool() const { return fSharedGenerator.get(); }
explicit operator bool() const { return fSharedGenerator.get(); }
sk_sp<SharedGenerator> fSharedGenerator;
SkImageInfo fInfo;

View File

@ -31,7 +31,7 @@ struct ProgramBuilder {
}
}
operator bool() const { return fProgram != nullptr; }
explicit operator bool() const { return fProgram != nullptr; }
SkSL::Program& operator*() { return *fProgram; }
SkSL::ShaderCaps fCaps;