Use SkClipOp::kFoo instead of kFoo_SkClipOp from SkClipOpPriv
The SkClipOpPriv.h header will be going away soon, but a number of places still use its kIntersect_SkClipOp definitions instead of the equivalent SkClipOp::kIntersect. Besides updating these references, a number of unnecessary includes to SkClipOpPriv.h are removed and some test cases exercising expanding clip ops are deleted since they will be unnecessary shortly. Bug: skia:10208 Change-Id: I2bbdd6bb39869134c6a80ef2b4482e6cabdeb0b7 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436157 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
86b2c952ae
commit
2f6e2f8410
@ -12,7 +12,6 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/utils/SkRandom.h"
|
||||
#include "src/core/SkAAClip.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This bench tests out AA/BW clipping via canvas' clipPath and clipRect calls
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/core/SkTextBlob.h"
|
||||
#include "include/core/SkTypeface.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkPaintPriv.h"
|
||||
|
||||
static const int kBmpSize = 24;
|
||||
@ -193,7 +192,7 @@ static void fuzz_drawRect(Fuzz* fuzz) {
|
||||
fuzz->next(&bl);
|
||||
fuzz->next(&a, &b, &c, &d);
|
||||
r = SkRect::MakeXYWH(a, b, c, d);
|
||||
cnv->clipRect(r, kIntersect_SkClipOp, bl);
|
||||
cnv->clipRect(r, SkClipOp::kIntersect, bl);
|
||||
}
|
||||
|
||||
static void fuzz_drawPath(Fuzz* fuzz) {
|
||||
@ -244,7 +243,7 @@ static void fuzz_drawPath(Fuzz* fuzz) {
|
||||
|
||||
bool bl;
|
||||
fuzz->next(&bl);
|
||||
cnv->clipPath(path, kIntersect_SkClipOp, bl);
|
||||
cnv->clipPath(path, SkClipOp::kIntersect, bl);
|
||||
}
|
||||
|
||||
static void fuzz_drawImage(Fuzz* fuzz) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "include/core/SkScalar.h"
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
@ -51,9 +50,7 @@ protected:
|
||||
canvas->scale(kScale, kScale);
|
||||
|
||||
canvas->save();
|
||||
SkRect clipRect1 = SkRect::MakeLTRB(0, 0,
|
||||
SkIntToScalar(kWidth), SkIntToScalar(kHeight));
|
||||
|
||||
SkRect clipRect1 = SkRect::MakeLTRB(0, 0, kWidth, kHeight);
|
||||
canvas->clipRect(clipRect1);
|
||||
|
||||
canvas->save();
|
||||
@ -65,7 +62,7 @@ protected:
|
||||
|
||||
SkRect clipRect2 = SkRect::MakeLTRB(8, 8, 288, 288);
|
||||
SkRRect clipRRect = SkRRect::MakeOval(clipRect2);
|
||||
canvas->clipRRect(clipRRect, kDifference_SkClipOp, true);
|
||||
canvas->clipRRect(clipRRect, SkClipOp::kDifference, true);
|
||||
|
||||
SkRect r = SkRect::MakeLTRB(4, 4, 292, 292);
|
||||
SkRRect rr = SkRRect::MakeOval(r);
|
||||
@ -75,8 +72,7 @@ protected:
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
1.366025f));
|
||||
paint.setColorFilter(SkColorFilters::Blend(SK_ColorRED,
|
||||
SkBlendMode::kSrcIn));
|
||||
paint.setColorFilter(SkColorFilters::Blend(SK_ColorRED, SkBlendMode::kSrcIn));
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
canvas->drawRRect(rr, paint);
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
class CircularClipsGM : public skiagm::GM {
|
||||
SkScalar fX1, fX2, fY, fR;
|
||||
@ -45,8 +44,8 @@ protected:
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
const SkClipOp ops[] = {
|
||||
kDifference_SkClipOp,
|
||||
kIntersect_SkClipOp
|
||||
SkClipOp::kDifference,
|
||||
SkClipOp::kIntersect
|
||||
};
|
||||
|
||||
SkRect rect = SkRect::MakeLTRB(fX1 - fR, fY - fR, fX2 + fR, fY + fR);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "include/core/SkTypeface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/effects/SkGradientShader.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "tools/Resources.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
@ -90,8 +89,8 @@ protected:
|
||||
SkClipOp fOp;
|
||||
const char* fName;
|
||||
} gOps[] = { //extra spaces in names for measureText
|
||||
{kIntersect_SkClipOp, "Isect "},
|
||||
{kDifference_SkClipOp, "Diff " },
|
||||
{SkClipOp::kIntersect, "Isect "},
|
||||
{SkClipOp::kDifference, "Diff " },
|
||||
};
|
||||
|
||||
canvas->translate(20, 20);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/utils/SkRandom.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
@ -91,8 +90,8 @@ protected:
|
||||
fRectColors[4] = SK_ColorCYAN;
|
||||
|
||||
const SkClipOp ops[] = {
|
||||
kDifference_SkClipOp,
|
||||
kIntersect_SkClipOp,
|
||||
SkClipOp::kDifference,
|
||||
SkClipOp::kIntersect,
|
||||
};
|
||||
|
||||
SkRandom r;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTypeface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
#include <utility>
|
||||
@ -68,8 +67,8 @@ protected:
|
||||
SkClipOp fOp;
|
||||
const char* fName;
|
||||
} gOps[] = {
|
||||
{kIntersect_SkClipOp, "I"},
|
||||
{kDifference_SkClipOp, "D" },
|
||||
{SkClipOp::kIntersect, "I"},
|
||||
{SkClipOp::kDifference, "D" },
|
||||
};
|
||||
|
||||
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "src/core/SkCanvasPriv.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
@ -111,7 +110,7 @@ protected:
|
||||
// in device space
|
||||
canvas->save();
|
||||
canvas->clipRect(SkRect::MakeLTRB(100, 400, 300, 750),
|
||||
kIntersect_SkClipOp, fDoAAClip);
|
||||
SkClipOp::kIntersect, fDoAAClip);
|
||||
canvas->drawColor(SK_ColorGREEN);
|
||||
// should not affect the device-space clip
|
||||
canvas->rotate(20.f);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/effects/SkImageFilters.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
#define WIDTH 512
|
||||
@ -57,7 +56,7 @@ protected:
|
||||
SkRect rect = SkRect::MakeWH(WIDTH, HEIGHT);
|
||||
tileCanvas->saveLayer(&rect, &blurPaint);
|
||||
SkRRect rrect = SkRRect::MakeRectXY(rect.makeInset(20, 20), 25, 25);
|
||||
tileCanvas->clipRRect(rrect, kDifference_SkClipOp, true);
|
||||
tileCanvas->clipRRect(rrect, SkClipOp::kDifference, true);
|
||||
SkPaint paint;
|
||||
tileCanvas->drawRect(rect, paint);
|
||||
tileCanvas->restore();
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "include/core/SkTypeface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/effects/SkGradientShader.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkTLList.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
@ -184,7 +183,7 @@ protected:
|
||||
canvas->save();
|
||||
}
|
||||
canvas->translate(x, y);
|
||||
clip->setOnCanvas(canvas, kIntersect_SkClipOp, SkToBool(aa));
|
||||
clip->setOnCanvas(canvas, SkClipOp::kIntersect, SkToBool(aa));
|
||||
canvas->drawImage(fImg, 0, 0);
|
||||
canvas->restore();
|
||||
x += fImg->width() + kMargin;
|
||||
@ -209,7 +208,7 @@ protected:
|
||||
canvas->translate(x, y);
|
||||
SkPath closedClipPath = clip->asClosedPath();
|
||||
canvas->drawPath(closedClipPath, clipOutlinePaint);
|
||||
clip->setOnCanvas(canvas, kIntersect_SkClipOp, SkToBool(aa));
|
||||
clip->setOnCanvas(canvas, SkClipOp::kIntersect, SkToBool(aa));
|
||||
canvas->scale(1.f, 1.8f);
|
||||
canvas->drawSimpleText(kTxt, SK_ARRAY_COUNT(kTxt)-1, SkTextEncoding::kUTF8,
|
||||
0, 1.5f * font.getSize(), font, txtPaint);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "include/core/SkTypeface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "src/core/SkAAClip.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkMask.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
@ -162,8 +161,8 @@ protected:
|
||||
const char* fName;
|
||||
SkClipOp fOp;
|
||||
} gOps[] = {
|
||||
{SK_ColorBLACK, "Difference", kDifference_SkClipOp},
|
||||
{SK_ColorRED, "Intersect", kIntersect_SkClipOp},
|
||||
{SK_ColorBLACK, "Difference", SkClipOp::kDifference},
|
||||
{SK_ColorRED, "Intersect", SkClipOp::kIntersect},
|
||||
};
|
||||
|
||||
SkPaint textPaint;
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "include/private/SkColorData.h"
|
||||
#include "src/core/SkCanvasPriv.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkClipStack.h"
|
||||
#include "src/gpu/GrAppliedClip.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
@ -64,20 +63,20 @@ DrawResult WindowRectanglesBaseGM::onDraw(SkCanvas* canvas, SkString* errorMsg)
|
||||
|
||||
SkClipStack stack;
|
||||
stack.clipRect(SkRect::MakeXYWH(370.75, 80.25, 149, 100), SkMatrix::I(),
|
||||
kDifference_SkClipOp, false);
|
||||
SkClipOp::kDifference, false);
|
||||
stack.clipRect(SkRect::MakeXYWH(80.25, 420.75, 150, 100), SkMatrix::I(),
|
||||
kDifference_SkClipOp, true);
|
||||
SkClipOp::kDifference, true);
|
||||
stack.clipRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(200, 200, 200, 200), 60, 45),
|
||||
SkMatrix::I(), kDifference_SkClipOp, true);
|
||||
SkMatrix::I(), SkClipOp::kDifference, true);
|
||||
|
||||
SkRRect nine;
|
||||
nine.setNinePatch(SkRect::MakeXYWH(550 - 30.25 - 100, 370.75, 100, 150), 12, 35, 23, 20);
|
||||
stack.clipRRect(nine, SkMatrix::I(), kDifference_SkClipOp, true);
|
||||
stack.clipRRect(nine, SkMatrix::I(), SkClipOp::kDifference, true);
|
||||
|
||||
SkRRect complx;
|
||||
SkVector complxRadii[4] = {{6, 4}, {8, 12}, {16, 24}, {48, 32}};
|
||||
complx.setRectRadii(SkRect::MakeXYWH(80.25, 80.75, 100, 149), complxRadii);
|
||||
stack.clipRRect(complx, SkMatrix::I(), kDifference_SkClipOp, false);
|
||||
stack.clipRRect(complx, SkMatrix::I(), SkClipOp::kDifference, false);
|
||||
|
||||
return this->onCoverClipStack(stack, canvas, errorMsg);
|
||||
}
|
||||
@ -117,7 +116,7 @@ DrawResult WindowRectanglesGM::onCoverClipStack(const SkClipStack& stack, SkCanv
|
||||
canvas->clipRect(element->getDeviceSpaceRect(), op, isAA);
|
||||
break;
|
||||
case SkClipStack::Element::DeviceSpaceType::kEmpty:
|
||||
canvas->clipRect({ 0, 0, 0, 0 }, kIntersect_SkClipOp, false);
|
||||
canvas->clipRect({ 0, 0, 0, 0 }, SkClipOp::kIntersect, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -319,4 +318,3 @@ DEF_GM( return new WindowRectanglesMaskGM(); )
|
||||
} // namespace skiagm
|
||||
|
||||
#endif // SK_GPU_V1
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "include/core/SkPathBuilder.h"
|
||||
#include "include/utils/SkRandom.h"
|
||||
#include "samplecode/Sample.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkPathPriv.h"
|
||||
#include "tools/Resources.h"
|
||||
|
||||
@ -119,7 +118,7 @@ class ClipView : public Sample {
|
||||
canvas->save();
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); ++i) {
|
||||
canvas->save();
|
||||
canvas->clipPath(clipPath, kIntersect_SkClipOp, SkToBool(aa));
|
||||
canvas->clipPath(clipPath, SkClipOp::kIntersect, SkToBool(aa));
|
||||
// canvas->drawColor(SK_ColorWHITE);
|
||||
gProc[i](canvas, SkToBool(aa));
|
||||
canvas->restore();
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "include/core/SkFont.h"
|
||||
#include "include/core/SkPath.h"
|
||||
#include "samplecode/Sample.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
class ComplexClipView : public Sample {
|
||||
void onOnceBeforeDraw() override {
|
||||
@ -78,8 +77,8 @@ class ComplexClipView : public Sample {
|
||||
SkClipOp fOp;
|
||||
const char* fName;
|
||||
} gOps[] = { //extra spaces in names for measureText
|
||||
{kIntersect_SkClipOp, "Isect "},
|
||||
{kDifference_SkClipOp, "Diff " },
|
||||
{SkClipOp::kIntersect, "Isect "},
|
||||
{SkClipOp::kDifference, "Diff " },
|
||||
};
|
||||
|
||||
canvas->translate(0, SkIntToScalar(40));
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "samplecode/Sample.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkPointPriv.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
@ -271,7 +270,7 @@ void FatBits::drawLine(SkCanvas* canvas, SkPoint pts[]) {
|
||||
fMinSurface->getCanvas()->save();
|
||||
SkRect r = fClipRect;
|
||||
r.inset(SK_Scalar1/3, SK_Scalar1/3);
|
||||
fMinSurface->getCanvas()->clipRect(r, kIntersect_SkClipOp, true);
|
||||
fMinSurface->getCanvas()->clipRect(r, SkClipOp::kIntersect, true);
|
||||
}
|
||||
fMinSurface->getCanvas()->drawLine(pts[0], pts[1], paint);
|
||||
if (fUseClip) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "include/effects/SkGradientShader.h"
|
||||
#include "include/utils/SkCamera.h"
|
||||
#include "samplecode/Sample.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/utils/SkUTF.h"
|
||||
|
||||
static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) {
|
||||
@ -197,7 +196,7 @@ protected:
|
||||
m.postTranslate(fCenter.x(), fCenter.y());
|
||||
path.transform(m);
|
||||
|
||||
canvas->clipPath(path, kIntersect_SkClipOp, true);
|
||||
canvas->clipPath(path, SkClipOp::kIntersect, true);
|
||||
const SkRect bounds = path.getBounds();
|
||||
|
||||
SkPaint paint;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#endif
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -246,7 +245,7 @@ void SkBlendImageFilter::drawForeground(SkCanvas* canvas, SkSpecialImage* img,
|
||||
}
|
||||
|
||||
SkAutoCanvasRestore acr(canvas, true);
|
||||
canvas->clipRect(SkRect::Make(fgBounds), kDifference_SkClipOp);
|
||||
canvas->clipRect(SkRect::Make(fgBounds), SkClipOp::kDifference);
|
||||
paint.setColor(0);
|
||||
canvas->drawPaint(paint);
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "src/core/SkAdvancedTypefaceMetrics.h"
|
||||
#include "src/core/SkAnnotationKeys.h"
|
||||
#include "src/core/SkBitmapDevice.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkColorSpacePriv.h"
|
||||
#include "src/core/SkDraw.h"
|
||||
#include "src/core/SkGlyphRun.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "include/utils/SkBase64.h"
|
||||
#include "src/codec/SkJpegCodec.h"
|
||||
#include "src/core/SkAnnotationKeys.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkClipStack.h"
|
||||
#include "src/core/SkDraw.h"
|
||||
#include "src/core/SkFontPriv.h"
|
||||
@ -805,7 +804,7 @@ void SkSVGDevice::drawAnnotation(const SkRect& rect, const char key[], SkData* v
|
||||
if (!strcmp(SkAnnotationKeys::URL_Key(), key) ||
|
||||
!strcmp(SkAnnotationKeys::Link_Named_Dest_Key(), key)) {
|
||||
this->cs().save();
|
||||
this->cs().clipRect(rect, this->localToDevice(), kIntersect_SkClipOp, true);
|
||||
this->cs().clipRect(rect, this->localToDevice(), SkClipOp::kIntersect, true);
|
||||
SkRect transformedRect = this->cs().bounds(this->getGlobalBounds());
|
||||
this->cs().restore();
|
||||
if (transformedRect.isEmpty()) {
|
||||
@ -968,7 +967,7 @@ void SkSVGDevice::drawImageRect(const SkImage* image, const SkRect* src, const S
|
||||
SkClipStack::AutoRestore ar(cs, false);
|
||||
if (src && *src != SkRect::Make(bm.bounds())) {
|
||||
cs->save();
|
||||
cs->clipRect(dst, this->localToDevice(), kIntersect_SkClipOp, paint.isAntiAlias());
|
||||
cs->clipRect(dst, this->localToDevice(), SkClipOp::kIntersect, paint.isAntiAlias());
|
||||
}
|
||||
|
||||
SkMatrix adjustedMatrix = this->localToDevice()
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/core/SkBitmap.h"
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkDevice.h"
|
||||
#include "src/core/SkRasterClip.h"
|
||||
#include "src/core/SkWriter32.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "include/private/SkTDArray.h"
|
||||
#include "include/utils/SkCanvasStateUtils.h"
|
||||
#include "src/core/SkCanvasPriv.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkTLazy.h"
|
||||
#include "tests/Test.h"
|
||||
#include "tools/flags/CommandLineFlags.h"
|
||||
@ -298,7 +297,7 @@ DEF_TEST(CanvasState_test_soft_clips, reporter) {
|
||||
SkRRect roundRect;
|
||||
roundRect.setOval(SkRect::MakeWH(5, 5));
|
||||
|
||||
canvas.clipRRect(roundRect, kIntersect_SkClipOp, true);
|
||||
canvas.clipRRect(roundRect, SkClipOp::kIntersect, true);
|
||||
|
||||
SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas);
|
||||
REPORTER_ASSERT(reporter, !state);
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "include/utils/SkNWayCanvas.h"
|
||||
#include "include/utils/SkPaintFilterCanvas.h"
|
||||
#include "src/core/SkBigPicture.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkImageFilter_Base.h"
|
||||
#include "src/core/SkRecord.h"
|
||||
#include "src/core/SkSpecialImage.h"
|
||||
@ -152,26 +151,6 @@ static void test_restriction(skiatest::Reporter* reporter, SkCanvas* canvas) {
|
||||
const SkIRect clipR = { 4, 4, 6, 6 };
|
||||
canvas->clipRect(SkRect::Make(clipR), SkClipOp::kIntersect);
|
||||
REPORTER_ASSERT(reporter, canvas->getDeviceClipBounds() == clipR);
|
||||
|
||||
#ifdef SK_SUPPORT_DEPRECATED_CLIPOPS
|
||||
// now test that expanding clipops can't exceed the restriction
|
||||
const SkClipOp expanders[] = {
|
||||
SkClipOp::kUnion_deprecated,
|
||||
SkClipOp::kXOR_deprecated,
|
||||
SkClipOp::kReverseDifference_deprecated,
|
||||
SkClipOp::kReplace_deprecated,
|
||||
};
|
||||
|
||||
const SkRect expandR = { 0, 0, 5, 9 };
|
||||
SkASSERT(!SkRect::Make(restrictionR).contains(expandR));
|
||||
|
||||
for (SkClipOp op : expanders) {
|
||||
canvas->save();
|
||||
canvas->clipRect(expandR, op);
|
||||
REPORTER_ASSERT(reporter, gBaseRestrictedR.contains(canvas->getDeviceClipBounds()));
|
||||
canvas->restore();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -806,4 +785,3 @@ DEF_TEST(canvas_savelayer_destructor, reporter) {
|
||||
// we didn't call restore() as a client.
|
||||
check_pixels(SK_ColorBLUE);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/effects/SkDashPathEffect.h"
|
||||
#include "include/pathops/SkPathOps.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkPathEffectBase.h"
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/gpu/geometry/GrStyledShape.h"
|
||||
@ -71,7 +70,7 @@ static bool test_bounds_by_rasterizing(const SkPath& path, const SkRect& bounds)
|
||||
SkRect clip = SkRect::MakeXYWH(kRes/4, kRes/4, kRes/2, kRes/2);
|
||||
SkMatrix matrix = SkMatrix::RectToRect(bounds, clip);
|
||||
clip.outset(SkIntToScalar(kTol), SkIntToScalar(kTol));
|
||||
surface->getCanvas()->clipRect(clip, kDifference_SkClipOp);
|
||||
surface->getCanvas()->clipRect(clip, SkClipOp::kDifference);
|
||||
surface->getCanvas()->concat(matrix);
|
||||
SkPaint whitePaint;
|
||||
whitePaint.setColor(SK_ColorWHITE);
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/utils/SkRandom.h"
|
||||
#include "src/core/SkBigPicture.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkMiniRecorder.h"
|
||||
#include "src/core/SkPicturePriv.h"
|
||||
#include "src/core/SkRectPriv.h"
|
||||
@ -179,7 +178,7 @@ static void create_imbalance(SkCanvas* canvas) {
|
||||
SkRect clipRect = SkRect::MakeWH(2, 2);
|
||||
SkRect drawRect = SkRect::MakeWH(10, 10);
|
||||
canvas->save();
|
||||
canvas->clipRect(clipRect, kReplace_SkClipOp);
|
||||
canvas->clipRect(clipRect, SkClipOp::kIntersect);
|
||||
canvas->translate(1.0f, 1.0f);
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorGREEN);
|
||||
@ -407,8 +406,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
|
||||
}
|
||||
{
|
||||
SkCanvas* canvas = recorder.beginRecording(10, 10);
|
||||
canvas->clipPath(path);
|
||||
canvas->clipPath(invPath, kUnion_SkClipOp);
|
||||
canvas->clipPath(path, SkClipOp::kDifference);
|
||||
clipBounds = canvas->getDeviceClipBounds();
|
||||
REPORTER_ASSERT(reporter, 0 == clipBounds.fLeft);
|
||||
REPORTER_ASSERT(reporter, 0 == clipBounds.fTop);
|
||||
@ -417,35 +415,14 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
|
||||
}
|
||||
{
|
||||
SkCanvas* canvas = recorder.beginRecording(10, 10);
|
||||
canvas->clipPath(path, kDifference_SkClipOp);
|
||||
canvas->clipPath(path, SkClipOp::kIntersect);
|
||||
canvas->clipPath(path2, SkClipOp::kDifference);
|
||||
clipBounds = canvas->getDeviceClipBounds();
|
||||
REPORTER_ASSERT(reporter, 0 == clipBounds.fLeft);
|
||||
REPORTER_ASSERT(reporter, 0 == clipBounds.fTop);
|
||||
REPORTER_ASSERT(reporter, 10 == clipBounds.fBottom);
|
||||
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight);
|
||||
}
|
||||
{
|
||||
SkCanvas* canvas = recorder.beginRecording(10, 10);
|
||||
canvas->clipPath(path, kReverseDifference_SkClipOp);
|
||||
clipBounds = canvas->getDeviceClipBounds();
|
||||
// True clip is actually empty in this case, but the best
|
||||
// determination we can make using only bounds as input is that the
|
||||
// clip is included in the bounds of 'path'.
|
||||
REPORTER_ASSERT(reporter, 7 == clipBounds.fLeft);
|
||||
REPORTER_ASSERT(reporter, 7 == clipBounds.fTop);
|
||||
REPORTER_ASSERT(reporter, 8 == clipBounds.fBottom);
|
||||
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight);
|
||||
}
|
||||
{
|
||||
SkCanvas* canvas = recorder.beginRecording(10, 10);
|
||||
canvas->clipPath(path, kIntersect_SkClipOp);
|
||||
canvas->clipPath(path2, kXOR_SkClipOp);
|
||||
clipBounds = canvas->getDeviceClipBounds();
|
||||
REPORTER_ASSERT(reporter, 6 == clipBounds.fLeft);
|
||||
REPORTER_ASSERT(reporter, 6 == clipBounds.fTop);
|
||||
REPORTER_ASSERT(reporter, 8 == clipBounds.fBottom);
|
||||
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_cull_rect_reset(skiatest::Reporter* reporter) {
|
||||
@ -507,26 +484,6 @@ private:
|
||||
using INHERITED = SkCanvas;
|
||||
};
|
||||
|
||||
static void test_clip_expansion(skiatest::Reporter* reporter) {
|
||||
SkPictureRecorder recorder;
|
||||
SkCanvas* canvas = recorder.beginRecording(10, 10);
|
||||
|
||||
canvas->clipRect(SkRect::MakeEmpty(), kReplace_SkClipOp);
|
||||
// The following expanding clip should not be skipped.
|
||||
canvas->clipRect(SkRect::MakeXYWH(4, 4, 3, 3), kUnion_SkClipOp);
|
||||
// Draw something so the optimizer doesn't just fold the world.
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorBLUE);
|
||||
canvas->drawPaint(p);
|
||||
sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
|
||||
|
||||
ClipCountingCanvas testCanvas(10, 10);
|
||||
picture->playback(&testCanvas);
|
||||
|
||||
// Both clips should be present on playback.
|
||||
REPORTER_ASSERT(reporter, testCanvas.getClipCount() == 2);
|
||||
}
|
||||
|
||||
static void test_gen_id(skiatest::Reporter* reporter) {
|
||||
|
||||
SkPictureRecorder recorder;
|
||||
@ -566,7 +523,6 @@ DEF_TEST(Picture, reporter) {
|
||||
test_unbalanced_save_restores(reporter);
|
||||
test_peephole();
|
||||
test_clip_bound_opt(reporter);
|
||||
test_clip_expansion(reporter);
|
||||
test_gen_id(reporter);
|
||||
test_cull_rect_reset(reporter);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkTraceEvent.h"
|
||||
#include "tools/Registry.h"
|
||||
#include "tools/gpu/GrContextFactory.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/utils/SkPaintFilterCanvas.h"
|
||||
#include "src/core/SkCanvasPriv.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/utils/SkJSONWriter.h"
|
||||
|
Loading…
Reference in New Issue
Block a user