Remove SkBool8.
This typedef was created at a time when compilers often used sizeof(int) storage for a bool. This is no longer the case and in all compilers currently supported 'sizeof(bool) == 1'. Removing this also revealed one field which was actually not a bool but a tri-state enum. Change-Id: I9240ba457335ee3eff094d6d3f2520c1adf16960 Reviewed-on: https://skia-review.googlesource.com/134420 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
75e6490a29
commit
cee46e5e99
@ -1414,10 +1414,18 @@ public:
|
||||
const SkScalar* fConicWeights;
|
||||
SkPoint fMoveTo;
|
||||
SkPoint fLastPt;
|
||||
SkBool8 fForceClose;
|
||||
SkBool8 fNeedClose;
|
||||
SkBool8 fCloseLine;
|
||||
SkBool8 fSegmentState;
|
||||
bool fForceClose;
|
||||
bool fNeedClose;
|
||||
bool fCloseLine;
|
||||
enum SegmentState : uint8_t {
|
||||
/** The current contour is empty. Starting processing or have just closed a contour. */
|
||||
kEmptyContour_SegmentState,
|
||||
/** Have seen a move, but nothing else. */
|
||||
kAfterMove_SegmentState,
|
||||
/** Have seen a primitive but not yet closed the path. Also the initial state. */
|
||||
kAfterPrimitive_SegmentState
|
||||
};
|
||||
SegmentState fSegmentState;
|
||||
|
||||
inline const SkPoint& cons_moveTo();
|
||||
Verb autoClose(SkPoint pts[2]);
|
||||
@ -1602,8 +1610,8 @@ private:
|
||||
uint8_t fFillType;
|
||||
mutable SkAtomic<Convexity, sk_memory_order_relaxed> fConvexity;
|
||||
mutable SkAtomic<uint8_t, sk_memory_order_relaxed> fFirstDirection;// SkPathPriv::FirstDirection
|
||||
SkBool8 fIsVolatile;
|
||||
SkBool8 fIsBadForDAA = false;
|
||||
bool fIsVolatile;
|
||||
bool fIsBadForDAA = false;
|
||||
|
||||
/** Resets all fields other than fPathRef to their initial 'empty' values.
|
||||
* Assumes the caller has already emptied fPathRef.
|
||||
|
@ -102,11 +102,6 @@ typedef int S16CPU;
|
||||
*/
|
||||
typedef unsigned U16CPU;
|
||||
|
||||
/**
|
||||
* Meant to be a small version of bool, for storage purposes. Will be 0 or 1
|
||||
*/
|
||||
typedef uint8_t SkBool8;
|
||||
|
||||
/** Returns 0 or 1 based on the condition
|
||||
*/
|
||||
#define SkToBool(cond) ((cond) != 0)
|
||||
|
@ -543,13 +543,13 @@ private:
|
||||
SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are reffed
|
||||
|
||||
mutable uint8_t fBoundsIsDirty;
|
||||
mutable SkBool8 fIsFinite; // only meaningful if bounds are valid
|
||||
mutable bool fIsFinite; // only meaningful if bounds are valid
|
||||
|
||||
SkBool8 fIsOval;
|
||||
SkBool8 fIsRRect;
|
||||
bool fIsOval;
|
||||
bool fIsRRect;
|
||||
// Both the circle and rrect special cases have a notion of direction and starting point
|
||||
// The next two variables store that information for either.
|
||||
SkBool8 fRRectOrOvalIsCCW;
|
||||
bool fRRectOrOvalIsCCW;
|
||||
uint8_t fRRectOrOvalStartIdx;
|
||||
uint8_t fSegmentMask;
|
||||
|
||||
|
@ -202,9 +202,9 @@ bool operator==(const SkPath& a, const SkPath& b) {
|
||||
void SkPath::swap(SkPath& that) {
|
||||
if (this != &that) {
|
||||
fPathRef.swap(that.fPathRef);
|
||||
SkTSwap<int>(fLastMoveToIndex, that.fLastMoveToIndex);
|
||||
SkTSwap<uint8_t>(fFillType, that.fFillType);
|
||||
SkTSwap<SkBool8>(fIsVolatile, that.fIsVolatile);
|
||||
SkTSwap(fLastMoveToIndex, that.fLastMoveToIndex);
|
||||
SkTSwap(fFillType, that.fFillType);
|
||||
SkTSwap(fIsVolatile, that.fIsVolatile);
|
||||
|
||||
// Non-atomic swaps of atomic values.
|
||||
Convexity c = fConvexity.load();
|
||||
@ -1821,15 +1821,6 @@ void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum SegmentState {
|
||||
kEmptyContour_SegmentState, // The current contour is empty. We may be
|
||||
// starting processing or we may have just
|
||||
// closed a contour.
|
||||
kAfterMove_SegmentState, // We have seen a move, but nothing else.
|
||||
kAfterPrimitive_SegmentState // We have seen a primitive but not yet
|
||||
// closed the path. Also the initial state.
|
||||
};
|
||||
|
||||
SkPath::Iter::Iter() {
|
||||
#ifdef SK_DEBUG
|
||||
fPts = nullptr;
|
||||
@ -1918,11 +1909,11 @@ const SkPoint& SkPath::Iter::cons_moveTo() {
|
||||
// Set the first return pt to the move pt
|
||||
fSegmentState = kAfterPrimitive_SegmentState;
|
||||
return fMoveTo;
|
||||
} else {
|
||||
SkASSERT(fSegmentState == kAfterPrimitive_SegmentState);
|
||||
// Set the first return pt to the last pt of the previous primitive.
|
||||
return fPts[-1];
|
||||
}
|
||||
|
||||
SkASSERT(fSegmentState == kAfterPrimitive_SegmentState);
|
||||
// Set the first return pt to the last pt of the previous primitive.
|
||||
return fPts[-1];
|
||||
}
|
||||
|
||||
void SkPath::Iter::consumeDegenerateSegments(bool exact) {
|
||||
|
@ -71,7 +71,7 @@ private:
|
||||
SkScalar fWidth, fMiterLimit;
|
||||
SkScalar fResScale;
|
||||
uint8_t fCap, fJoin;
|
||||
SkBool8 fDoFill;
|
||||
bool fDoFill;
|
||||
|
||||
friend class SkPaint;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user