Add private fIsBadForDAA bit to SkPath

Bug: chromium:821353
Change-Id: Ic6585e76df692bb1853d0990d75f0e8d1dee22f4
Reviewed-on: https://skia-review.googlesource.com/120201
Commit-Queue: Yuqian Li <liyuqian@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Yuqian Li 2018-04-11 11:31:36 -04:00 committed by Skia Commit-Bot
parent 69eb83557f
commit 54aefc7410
6 changed files with 13 additions and 1 deletions

View File

@ -1626,6 +1626,7 @@ private:
mutable SkAtomic<Convexity, sk_memory_order_relaxed> fConvexity;
mutable SkAtomic<uint8_t, sk_memory_order_relaxed> fFirstDirection;// SkPathPriv::FirstDirection
SkBool8 fIsVolatile;
SkBool8 fIsBadForDAA = false;
/** Resets all fields other than fPathRef to their initial 'empty' values.
* Assumes the caller has already emptied fPathRef.

View File

@ -22,6 +22,7 @@
#include "SkMatrixUtils.h"
#include "SkPaint.h"
#include "SkPathEffect.h"
#include "SkPathPriv.h"
#include "SkRasterClip.h"
#include "SkRectPriv.h"
#include "SkRRect.h"
@ -1069,6 +1070,7 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
tmpPath = iData->fAlloc->make<SkPath>();
}
tmpPath->setIsVolatile(true);
SkPathPriv::SetIsBadForDAA(*tmpPath, SkPathPriv::IsBadForDAA(origSrcPath));
if (prePathMatrix) {
if (origPaint.getPathEffect() || origPaint.getStyle() != SkPaint::kFill_Style) {

View File

@ -140,6 +140,7 @@ SkPath::SkPath()
: fPathRef(SkPathRef::CreateEmpty()) {
this->resetFields();
fIsVolatile = false;
fIsBadForDAA = false;
}
void SkPath::resetFields() {
@ -179,6 +180,7 @@ void SkPath::copyFields(const SkPath& that) {
fLastMoveToIndex = that.fLastMoveToIndex;
fFillType = that.fFillType;
fIsVolatile = that.fIsVolatile;
fIsBadForDAA = that.fIsBadForDAA;
// Non-atomic assignment of atomic values.
fConvexity .store(that.fConvexity .load());

View File

@ -211,6 +211,10 @@ public:
}
return result;
}
// For crbug.com/821353 and skbug.com/6886
static bool IsBadForDAA(const SkPath& path) { return path.fIsBadForDAA; }
static void SetIsBadForDAA(SkPath& path, bool isBadForDAA) { path.fIsBadForDAA = isBadForDAA; }
};
#endif

View File

@ -21,6 +21,7 @@
#include "SkMatrix22.h"
#include "SkPaintPriv.h"
#include "SkPathEffect.h"
#include "SkPathPriv.h"
#include "SkRasterClip.h"
#include "SkReadBuffer.h"
#include "SkStroke.h"
@ -444,6 +445,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
} else {
SkASSERT(SkMask::kARGB32_Format != origGlyph.fMaskFormat);
SkASSERT(SkMask::kARGB32_Format != mask.fFormat);
SkPathPriv::SetIsBadForDAA(devPath, true); // crbug.com/821353
generateMask(mask, devPath, fPreBlend);
}
}

View File

@ -8,6 +8,7 @@
#include "SkScanPriv.h"
#include "SkPath.h"
#include "SkPathPriv.h"
#include "SkMatrix.h"
#include "SkBlitter.h"
#include "SkRegion.h"
@ -601,7 +602,7 @@ static bool ShouldUseDAA(const SkPath& path) {
if (gSkForceDeltaAA) {
return true;
}
if (!gSkUseDeltaAA) {
if (!gSkUseDeltaAA || SkPathPriv::IsBadForDAA(path)) {
return false;
}