diff options
author | reed <reed@google.com> | 2016-02-22 05:57:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-22 05:57:32 -0800 |
commit | 1d524699274bc1d4c43af0c3d0ae269b8c37a3bb (patch) | |
tree | 81916dad8832c11247a1ed0686bfb210a9c113bd /src | |
parent | 75a73297cb44c65a9efcf5f212854cb457140e34 (diff) |
Revert of ix misc asserts and checks found by fuzzer (patchset #1 id:1 of https://codereview.chromium.org/1723473002/ )
Reason for revert:
need to not land the canvas change yet
Original issue's description:
> Reland of ix misc asserts and checks found by fuzzer (patchset #1 id:1 of https://codereview.chromium.org/1713413002/ )
>
> Reason for revert:
> deps instability seemingly fixed. trying again.
>
> Original issue's description:
> > Revert of fix misc asserts and checks found by fuzzer (patchset #1 id:1 of https://codereview.chromium.org/1713383002/ )
> >
> > Reason for revert:
> > speculative deps-roll fix
> >
> > Original issue's description:
> > > fix misc asserts and checks found by fuzzer
> > >
> > > BUG=skia:
> > > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1713383002
> > >
> > > TBR=robertphilips
> > >
> > > Committed: https://skia.googlesource.com/skia/+/00bea4ad310c4ec4dd95809b47ce3fbfa8fd0e1e
> >
> > TBR=robertphillips@google.com
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=skia:
> >
> > Committed: https://skia.googlesource.com/skia/+/d98ef6377269e3596423225ab922301ed40529a0
>
> TBR=robertphillips@google.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/75a73297cb44c65a9efcf5f212854cb457140e34
TBR=robertphillips@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1723483002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkCanvas.cpp | 6 | ||||
-rw-r--r-- | src/effects/Sk1DPathEffect.cpp | 60 | ||||
-rw-r--r-- | src/effects/SkAlphaThresholdFilter.cpp | 9 | ||||
-rw-r--r-- | src/effects/SkDashPathEffect.cpp | 14 |
4 files changed, 30 insertions, 59 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index aa3261dc03..653f4b117f 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1072,14 +1072,11 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlag if (!this->getClipDeviceBounds(&clipBounds)) { return false; } - SkASSERT(!clipBounds.isEmpty()); const SkMatrix& ctm = fMCRec->fMatrix; // this->getTotalMatrix() if (imageFilter) { - if (!imageFilter->filterBounds(clipBounds, ctm, &clipBounds) || clipBounds.isEmpty()) { - return false; - } + imageFilter->filterBounds(clipBounds, ctm, &clipBounds); if (bounds && !imageFilter->canComputeFastBounds()) { bounds = nullptr; } @@ -1781,7 +1778,6 @@ bool SkCanvas::getClipDeviceBounds(SkIRect* bounds) const { return false; } - SkASSERT(!clip.getBounds().isEmpty()); if (bounds) { *bounds = clip.getBounds(); } diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp index 4be6f975d3..041886e1db 100644 --- a/src/effects/Sk1DPathEffect.cpp +++ b/src/effects/Sk1DPathEffect.cpp @@ -35,33 +35,39 @@ bool Sk1DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkPath1DPathEffect::SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style style) : fPath(path) { - SkASSERT(advance > 0 && !path.isEmpty()); - // cleanup their phase parameter, inverting it so that it becomes an - // offset along the path (to match the interpretation in PostScript) - if (phase < 0) { - phase = -phase; - if (phase > advance) { - phase = SkScalarMod(phase, advance); - } + if (advance <= 0 || path.isEmpty()) { + SkDEBUGF(("SkPath1DPathEffect can't use advance <= 0\n")); + fAdvance = 0; // signals we can't draw anything + fInitialOffset = 0; + fStyle = kStyleCount; } else { - if (phase > advance) { - phase = SkScalarMod(phase, advance); + // cleanup their phase parameter, inverting it so that it becomes an + // offset along the path (to match the interpretation in PostScript) + if (phase < 0) { + phase = -phase; + if (phase > advance) { + phase = SkScalarMod(phase, advance); + } + } else { + if (phase > advance) { + phase = SkScalarMod(phase, advance); + } + phase = advance - phase; } - phase = advance - phase; - } - // now catch the edge case where phase == advance (within epsilon) - if (phase >= advance) { - phase = 0; - } - SkASSERT(phase >= 0); + // now catch the edge case where phase == advance (within epsilon) + if (phase >= advance) { + phase = 0; + } + SkASSERT(phase >= 0); - fAdvance = advance; - fInitialOffset = phase; + fAdvance = advance; + fInitialOffset = phase; - if ((unsigned)style > kMorph_Style) { - SkDEBUGF(("SkPath1DPathEffect style enum out of range %d\n", style)); + if ((unsigned)style >= kStyleCount) { + SkDEBUGF(("SkPath1DPathEffect style enum out of range %d\n", style)); + } + fStyle = style; } - fStyle = style; } bool SkPath1DPathEffect::filterPath(SkPath* dst, const SkPath& src, @@ -201,13 +207,3 @@ void SkPath1DPathEffect::toString(SkString* str) const { str->appendf(")"); } #endif - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -SkPathEffect* SkPath1DPathEffect::Create(const SkPath& path, SkScalar advance, SkScalar phase, - Style style) { - if (advance <= 0 || path.isEmpty()) { - return nullptr; - } - return new SkPath1DPathEffect(path, advance, phase, style); -} diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index 406797084f..79520602b7 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -45,19 +45,11 @@ SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkAlphaThresholdFilter) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAlphaThresholdFilterImpl) SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END -static bool outside_unit(SkScalar x) { - return x < 0 || x > 1; -} SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold, SkImageFilter* input) { - if (outside_unit(innerThreshold) || outside_unit(outerThreshold) || - innerThreshold > outerThreshold) - { - return nullptr; - } return new SkAlphaThresholdFilterImpl(region, innerThreshold, outerThreshold, input); } @@ -342,6 +334,7 @@ void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const { bool SkAlphaThresholdFilterImpl::onFilterImageDeprecated(Proxy* proxy, const SkBitmap& src, const Context& ctx, SkBitmap* dst, SkIPoint* offset) const { + SkASSERT(src.colorType() == kN32_SkColorType); if (src.colorType() != kN32_SkColorType) { return false; diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp index ced0aab69a..6e10e5466d 100644 --- a/src/effects/SkDashPathEffect.cpp +++ b/src/effects/SkDashPathEffect.cpp @@ -384,17 +384,3 @@ void SkDashPathEffect::toString(SkString* str) const { str->appendf("))"); } #endif - -////////////////////////////////////////////////////////////////////////////////////////////////// - -SkPathEffect* SkDashPathEffect::Create(const SkScalar intervals[], int count, SkScalar phase) { - if ((count < 2) || !SkIsAlign2(count)) { - return nullptr; - } - for (int i = 0; i < count; i++) { - if (intervals[i] < 0) { - return nullptr; - } - } - return new SkDashPathEffect(intervals, count, phase); -} |