diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrRenderTargetOpList.cpp | 6 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 331 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.h | 63 |
3 files changed, 202 insertions, 198 deletions
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index c95fe6af7a..4fc898c3ac 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -547,10 +547,10 @@ void GrRenderTargetOpList::forwardCombine() { if (j == i +1) { // We assume op would have combined with candidate when the candidate was added // via backwards combining in recordOp. - +#ifndef SK_USE_DEVICE_CLIPPING // not sure why this fires with device-clipping in gm/complexclip4.cpp -// SkASSERT(!op->combineIfPossible(candidate.fOp.get(), *this->caps())); - + SkASSERT(!op->combineIfPossible(candidate.fOp.get(), *this->caps())); +#endif } else if (op->combineIfPossible(candidate.fOp.get(), *this->caps())) { GrOP_INFO("\t\tCombining with (%s, B%u)\n", candidate.fOp->name(), candidate.fOp->uniqueID()); diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index bcc2930821..0b5f14c45c 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -58,13 +58,13 @@ #if 0 extern bool (*gShouldDrawProc)(); - #define CHECK_SHOULD_DRAW() \ + #define CHECK_SHOULD_DRAW(draw) \ do { \ if (gShouldDrawProc && !gShouldDrawProc()) return; \ - this->prepareDraw(); \ + this->prepareDraw(draw); \ } while (0) #else - #define CHECK_SHOULD_DRAW() this->prepareDraw() + #define CHECK_SHOULD_DRAW(draw) this->prepareDraw(draw) #endif /////////////////////////////////////////////////////////////////////////////// @@ -174,16 +174,17 @@ sk_sp<GrRenderTargetContext> SkGpuDevice::MakeRenderTargetContext( origin, surfaceProps, budgeted); } -sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(SkSpecialImage* srcImg, +sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw, + SkSpecialImage* srcImg, int left, int top, SkIPoint* offset, const SkImageFilter* filter) { SkASSERT(srcImg->isTextureBacked()); SkASSERT(filter); - SkMatrix matrix = this->ctm(); + SkMatrix matrix = *draw.fMatrix; matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); - const SkIRect clipBounds = this->devClipBounds().makeOffset(-left, -top); + const SkIRect clipBounds = this->devClipBounds(draw).makeOffset(-left, -top); sk_sp<SkImageFilterCache> cache(this->getImageFilterCache()); SkImageFilter::OutputProperties outputProperties(fRenderTargetContext->getColorSpace()); SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), outputProperties); @@ -232,10 +233,15 @@ bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) { // call this every draw call, to ensure that the context reflects our state, // and not the state from some other canvas/device -void SkGpuDevice::prepareDraw() { +void SkGpuDevice::prepareDraw(const SkDraw& draw) { ASSERT_SINGLE_OWNER +#ifdef SK_USE_DEVICE_CLIPPING + SkASSERT(*draw.fMatrix == this->ctm()); fClip.reset(&this->cs(), nullptr); +#else + fClip.reset(draw.fClipStack, &this->getOrigin()); +#endif } GrRenderTargetContext* SkGpuDevice::accessRenderTargetContext() { @@ -279,18 +285,18 @@ void SkGpuDevice::replaceRenderTargetContext(bool shouldRetainContent) { /////////////////////////////////////////////////////////////////////////////// -void SkGpuDevice::drawPaint(const SkPaint& paint) { +void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext.get()); GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } - fRenderTargetContext->drawPaint(fClip, std::move(grPaint), this->ctm()); + fRenderTargetContext->drawPaint(fClip, std::move(grPaint), *draw.fMatrix); } // must be in SkCanvas::PointMode order @@ -327,11 +333,11 @@ static bool needs_antialiasing(SkCanvas::PointMode mode, size_t count, const SkP return true; } -void SkGpuDevice::drawPoints(SkCanvas::PointMode mode, +void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPoints", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); SkScalar width = paint.getStrokeWidth(); if (width < 0) { @@ -341,7 +347,7 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode, if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mode) { GrStyle style(paint, SkPaint::kStroke_Style); GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } @@ -350,31 +356,25 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode, path.moveTo(pts[0]); path.lineTo(pts[1]); fRenderTargetContext->drawPath(fClip, std::move(grPaint), GrBoolToAA(paint.isAntiAlias()), - this->ctm(), path, style); + *draw.fMatrix, path, style); return; } SkScalar scales[2]; - bool isHairline = (0 == width) || (1 == width && this->ctm().getMinMaxScales(scales) && + bool isHairline = (0 == width) || (1 == width && draw.fMatrix->getMinMaxScales(scales) && SkScalarNearlyEqual(scales[0], 1.f) && SkScalarNearlyEqual(scales[1], 1.f)); // we only handle non-antialiased hairlines and paints without path effects or mask filters, // else we let the SkDraw call our drawPath() if (!isHairline || paint.getPathEffect() || paint.getMaskFilter() || - (paint.isAntiAlias() && needs_antialiasing(mode, count, pts, this->ctm()))) - { - SkRasterClip rc(this->devClipBounds()); - SkDraw draw; - draw.fDst = SkPixmap(SkImageInfo::MakeUnknown(this->width(), this->height()), nullptr, 0); - draw.fMatrix = &this->ctm(); - draw.fRC = &rc; + (paint.isAntiAlias() && needs_antialiasing(mode, count, pts, *draw.fMatrix))) { draw.drawPoints(mode, count, pts, paint, this); return; } GrPrimitiveType primitiveType = gPointMode2PrimitiveType[mode]; - const SkMatrix* viewMatrix = &this->ctm(); + const SkMatrix* viewMatrix = draw.fMatrix; #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK // This offsetting in device space matches the expectations of the Android framework for non-AA // points and lines. @@ -407,10 +407,10 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode, /////////////////////////////////////////////////////////////////////////////// -void SkGpuDevice::drawRect(const SkRect& rect, const SkPaint& paint) { +void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint& paint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRect", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); // A couple reasons we might need to call drawPath. @@ -420,37 +420,37 @@ void SkGpuDevice::drawRect(const SkRect& rect, const SkPaint& paint) { path.addRect(rect); GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(), fClip, path, paint, - this->ctm(), nullptr, - this->devClipBounds(), true); + *draw.fMatrix, nullptr, + this->devClipBounds(draw), true); return; } GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } GrStyle style(paint); fRenderTargetContext->drawRect(fClip, std::move(grPaint), GrBoolToAA(paint.isAntiAlias()), - this->ctm(), rect, &style); + *draw.fMatrix, rect, &style); } /////////////////////////////////////////////////////////////////////////////// -void SkGpuDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRRect", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } SkMaskFilter* mf = paint.getMaskFilter(); - if (mf && mf->asFragmentProcessor(nullptr, nullptr, this->ctm())) { + if (mf && mf->asFragmentProcessor(nullptr, nullptr, *draw.fMatrix)) { mf = nullptr; // already handled in SkPaintToGrPaint } @@ -459,19 +459,19 @@ void SkGpuDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) { // try to hit the fast path for drawing filtered round rects SkRRect devRRect; - if (rrect.transform(this->ctm(), &devRRect)) { + if (rrect.transform(*draw.fMatrix, &devRRect)) { if (devRRect.allCornersCircular()) { SkRect maskRect; - if (mf->canFilterMaskGPU(devRRect, this->devClipBounds(), - this->ctm(), &maskRect)) { + if (mf->canFilterMaskGPU(devRRect, this->devClipBounds(draw), + *draw.fMatrix, &maskRect)) { SkIRect finalIRect; maskRect.roundOut(&finalIRect); - - // we used to test finalIRect for quickReject, but that seems unlikely - // given that the original shape was not rejected... - + if (draw.fRC->quickReject(finalIRect)) { + // clipped out + return; + } if (mf->directFilterRRectMaskGPU(fContext.get(), fRenderTargetContext.get(), - std::move(grPaint), fClip, this->ctm(), + std::move(grPaint), fClip, *draw.fMatrix, style.strokeRec(), rrect, devRRect)) { return; } @@ -490,43 +490,43 @@ void SkGpuDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) { path.addRRect(rrect); GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(), fClip, path, paint, - this->ctm(), nullptr, - this->devClipBounds(), true); + *draw.fMatrix, nullptr, + this->devClipBounds(draw), true); return; } SkASSERT(!style.pathEffect()); fRenderTargetContext->drawRRect(fClip, std::move(grPaint), GrBoolToAA(paint.isAntiAlias()), - this->ctm(), rrect, style); + *draw.fMatrix, rrect, style); } -void SkGpuDevice::drawDRRect(const SkRRect& outer, +void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDRRect", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); if (outer.isEmpty()) { return; } if (inner.isEmpty()) { - return this->drawRRect(outer, paint); + return this->drawRRect(draw, outer, paint); } SkStrokeRec stroke(paint); if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect()) { GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } fRenderTargetContext->drawDRRect(fClip, std::move(grPaint), GrBoolToAA(paint.isAntiAlias()), - this->ctm(), outer, inner); + *draw.fMatrix, outer, inner); return; } @@ -538,78 +538,78 @@ void SkGpuDevice::drawDRRect(const SkRRect& outer, GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(), fClip, path, paint, - this->ctm(), nullptr, - this->devClipBounds(), true); + *draw.fMatrix, nullptr, + this->devClipBounds(draw), true); } ///////////////////////////////////////////////////////////////////////////// -void SkGpuDevice::drawRegion(const SkRegion& region, const SkPaint& paint) { +void SkGpuDevice::drawRegion(const SkDraw& draw, const SkRegion& region, const SkPaint& paint) { if (paint.getMaskFilter()) { SkPath path; region.getBoundaryPath(&path); - return this->drawPath(path, paint, nullptr, false); + return this->drawPath(draw, path, paint, nullptr, false); } GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } fRenderTargetContext->drawRegion(fClip, std::move(grPaint), GrBoolToAA(paint.isAntiAlias()), - this->ctm(), region, GrStyle(paint)); + *draw.fMatrix, region, GrStyle(paint)); } -void SkGpuDevice::drawOval(const SkRect& oval, const SkPaint& paint) { +void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); // Presumably the path effect warps this to something other than an oval if (paint.getPathEffect()) { SkPath path; path.setIsVolatile(true); path.addOval(oval); - this->drawPath(path, paint, nullptr, true); + this->drawPath(draw, path, paint, nullptr, true); return; } if (paint.getMaskFilter()) { // The RRect path can handle special case blurring SkRRect rr = SkRRect::MakeOval(oval); - return this->drawRRect(rr, paint); + return this->drawRRect(draw, rr, paint); } GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } fRenderTargetContext->drawOval(fClip, std::move(grPaint), GrBoolToAA(paint.isAntiAlias()), - this->ctm(), oval, GrStyle(paint)); + *draw.fMatrix, oval, GrStyle(paint)); } -void SkGpuDevice::drawArc(const SkRect& oval, SkScalar startAngle, +void SkGpuDevice::drawArc(const SkDraw& draw, const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint& paint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawArc", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); if (paint.getMaskFilter()) { - this->INHERITED::drawArc(oval, startAngle, sweepAngle, useCenter, paint); + this->INHERITED::drawArc(draw, oval, startAngle, sweepAngle, useCenter, paint); return; } GrPaint grPaint; - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix, &grPaint)) { return; } fRenderTargetContext->drawArc(fClip, std::move(grPaint), GrBoolToAA(paint.isAntiAlias()), - this->ctm(), oval, startAngle, sweepAngle, useCenter, + *draw.fMatrix, oval, startAngle, sweepAngle, useCenter, GrStyle(paint)); } @@ -617,10 +617,11 @@ void SkGpuDevice::drawArc(const SkRect& oval, SkScalar startAngle, /////////////////////////////////////////////////////////////////////////////// void SkGpuDevice::drawStrokedLine(const SkPoint points[2], + const SkDraw& draw, const SkPaint& origPaint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawStrokedLine", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); // Adding support for round capping would require a // GrRenderTargetContext::fillRRectWithLocalMatrix entry point @@ -658,7 +659,7 @@ void SkGpuDevice::drawStrokedLine(const SkPoint points[2], SkMatrix local = m; - m.postConcat(this->ctm()); + m.postConcat(*draw.fMatrix); GrPaint grPaint; if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), newPaint, m, &grPaint)) { @@ -669,7 +670,7 @@ void SkGpuDevice::drawStrokedLine(const SkPoint points[2], fClip, std::move(grPaint), GrBoolToAA(newPaint.isAntiAlias()), m, rect, local); } -void SkGpuDevice::drawPath(const SkPath& origSrcPath, +void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, const SkPaint& paint, const SkMatrix* prePathMatrix, bool pathIsMutable) { ASSERT_SINGLE_OWNER @@ -677,40 +678,40 @@ void SkGpuDevice::drawPath(const SkPath& origSrcPath, SkPoint points[2]; if (SkPaint::kStroke_Style == paint.getStyle() && paint.getStrokeWidth() > 0 && !paint.getMaskFilter() && SkPaint::kRound_Cap != paint.getStrokeCap() && - this->ctm().preservesRightAngles() && origSrcPath.isLine(points)) { + draw.fMatrix->preservesRightAngles() && origSrcPath.isLine(points)) { // Path-based stroking looks better for thin rects - SkScalar strokeWidth = this->ctm().getMaxScale() * paint.getStrokeWidth(); + SkScalar strokeWidth = draw.fMatrix->getMaxScale() * paint.getStrokeWidth(); if (strokeWidth >= 1.0f) { // Round capping support is currently disabled b.c. it would require a RRect // GrDrawOp that takes a localMatrix. - this->drawStrokedLine(points, paint); + this->drawStrokedLine(points, draw, paint); return; } } bool isClosed; SkRect rect; if (origSrcPath.isRect(&rect, &isClosed) && isClosed) { - this->drawRect(rect, paint); + this->drawRect(draw, rect, paint); return; } if (origSrcPath.isOval(&rect)) { - this->drawOval(rect, paint); + this->drawOval(draw, rect, paint); return; } SkRRect rrect; if (origSrcPath.isRRect(&rrect)) { - this->drawRRect(rrect, paint); + this->drawRRect(draw, rrect, paint); return; } } - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext.get()); GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(), fClip, origSrcPath, paint, - this->ctm(), prePathMatrix, - this->devClipBounds(), pathIsMutable); + *draw.fMatrix, prePathMatrix, + this->devClipBounds(draw), pathIsMutable); } static const int kBmpSmallTileSize = 1 << 10; @@ -856,13 +857,14 @@ bool SkGpuDevice::shouldTileImage(const SkImage* image, const SkRect* srcRectPtr &outClippedSrcRect); } -void SkGpuDevice::drawBitmap(const SkBitmap& bitmap, +void SkGpuDevice::drawBitmap(const SkDraw& origDraw, + const SkBitmap& bitmap, const SkMatrix& m, const SkPaint& paint) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(origDraw); SkMatrix viewMatrix; - viewMatrix.setConcat(this->ctm(), m); + viewMatrix.setConcat(*origDraw.fMatrix, m); int maxTileSize = fContext->caps()->maxTileSize(); @@ -1119,10 +1121,10 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap, fRenderTargetContext->drawRect(fClip, std::move(grPaint), aa, viewMatrix, dstRect); } -void SkGpuDevice::drawSprite(const SkBitmap& bitmap, +void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, int left, int top, const SkPaint& paint) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSprite", fContext.get()); if (fContext->abandoned()) { @@ -1134,22 +1136,23 @@ void SkGpuDevice::drawSprite(const SkBitmap& bitmap, return; } - this->drawSpecial(srcImg.get(), left, top, paint); + this->drawSpecial(draw, srcImg.get(), left, top, paint); } -void SkGpuDevice::drawSpecial(SkSpecialImage* special1, +void SkGpuDevice::drawSpecial(const SkDraw& draw, + SkSpecialImage* special1, int left, int top, const SkPaint& paint) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSpecial", fContext.get()); SkIPoint offset = { 0, 0 }; sk_sp<SkSpecialImage> result; if (paint.getImageFilter()) { - result = this->filterTexture(special1, left, top, + result = this->filterTexture(draw, special1, left, top, &offset, paint.getImageFilter()); if (!result) { @@ -1201,11 +1204,11 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special1, SkRect::Make(subset)); } -void SkGpuDevice::drawBitmapRect(const SkBitmap& bitmap, +void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, const SkRect* src, const SkRect& origDst, const SkPaint& paint, SkCanvas::SrcRectConstraint constraint) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); // The src rect is inferred to be the bmp bounds if not provided. Otherwise, the src rect must // be clipped to the bmp bounds. To determine tiling parameters we need the filter mode which @@ -1253,7 +1256,7 @@ void SkGpuDevice::drawBitmapRect(const SkBitmap& bitmap, GrSamplerParams params; bool doBicubic; GrSamplerParams::FilterMode textureFilterMode = - GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), this->ctm(), srcToDstMatrix, + GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, srcToDstMatrix, &doBicubic); int tileFilterPad; @@ -1268,16 +1271,16 @@ void SkGpuDevice::drawBitmapRect(const SkBitmap& bitmap, params.setFilterMode(textureFilterMode); int maxTileSizeForFilter = fContext->caps()->maxTileSize() - 2 * tileFilterPad; - if (this->shouldTileImageID(bitmap.getGenerationID(), bitmap.getSubset(), this->ctm(), + if (this->shouldTileImageID(bitmap.getGenerationID(), bitmap.getSubset(), *draw.fMatrix, srcToDstMatrix, params, src, maxTileSizeForFilter, &tileSize, &clippedSrcRect)) { - this->drawTiledBitmap(bitmap, this->ctm(), srcToDstMatrix, *src, clippedSrcRect, + this->drawTiledBitmap(bitmap, *draw.fMatrix, srcToDstMatrix, *src, clippedSrcRect, params, paint, constraint, tileSize, doBicubic); return; } } GrBitmapTextureMaker maker(fContext.get(), bitmap); - this->drawTextureProducer(&maker, src, dst, constraint, this->ctm(), fClip, paint); + this->drawTextureProducer(&maker, src, dst, constraint, *draw.fMatrix, fClip, paint); } sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkBitmap& bitmap) { @@ -1346,7 +1349,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() { &this->surfaceProps()); } -void SkGpuDevice::drawDevice(SkBaseDevice* device, +void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, int left, int top, const SkPaint& paint) { SkASSERT(!paint.getImageFilter()); @@ -1355,7 +1358,7 @@ void SkGpuDevice::drawDevice(SkBaseDevice* device, GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDevice", fContext.get()); // drawDevice is defined to be in device coords. - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); SkGpuDevice* dev = static_cast<SkGpuDevice*>(device); sk_sp<SkSpecialImage> srcImg(dev->snapSpecial()); @@ -1363,17 +1366,17 @@ void SkGpuDevice::drawDevice(SkBaseDevice* device, return; } - this->drawSpecial(srcImg.get(), left, top, paint); + this->drawSpecial(draw, srcImg.get(), left, top, paint); } -void SkGpuDevice::drawImage(const SkImage* image, SkScalar x, SkScalar y, +void SkGpuDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar x, SkScalar y, const SkPaint& paint) { ASSERT_SINGLE_OWNER - SkMatrix viewMatrix = this->ctm(); + SkMatrix viewMatrix = *draw.fMatrix; viewMatrix.preTranslate(x, y); uint32_t pinnedUniqueID; if (sk_sp<GrTexture> tex = as_IB(image)->refPinnedTexture(&pinnedUniqueID)) { - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GrTextureAdjuster adjuster(tex.get(), image->alphaType(), image->bounds(), pinnedUniqueID, as_IB(image)->onImageInfo().colorSpace()); this->drawTextureProducer(&adjuster, nullptr, nullptr, SkCanvas::kFast_SrcRectConstraint, @@ -1382,66 +1385,66 @@ void SkGpuDevice::drawImage(const SkImage* image, SkScalar x, SkScalar y, } else { SkBitmap bm; if (this->shouldTileImage(image, nullptr, SkCanvas::kFast_SrcRectConstraint, - paint.getFilterQuality(), this->ctm(), SkMatrix::I())) { + paint.getFilterQuality(), *draw.fMatrix, SkMatrix::I())) { // only support tiling as bitmap at the moment, so force raster-version if (!as_IB(image)->getROPixels(&bm, fRenderTargetContext->getColorSpace())) { return; } - this->drawBitmap(bm, SkMatrix::MakeTrans(x, y), paint); + this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint); } else if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) { - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint); this->drawTextureProducer(&maker, nullptr, nullptr, SkCanvas::kFast_SrcRectConstraint, viewMatrix, fClip, paint); } else if (as_IB(image)->getROPixels(&bm, fRenderTargetContext->getColorSpace())) { - this->drawBitmap(bm, SkMatrix::MakeTrans(x, y), paint); + this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint); } } } -void SkGpuDevice::drawImageRect(const SkImage* image, const SkRect* src, +void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src, const SkRect& dst, const SkPaint& paint, SkCanvas::SrcRectConstraint constraint) { ASSERT_SINGLE_OWNER uint32_t pinnedUniqueID; if (sk_sp<GrTexture> tex = as_IB(image)->refPinnedTexture(&pinnedUniqueID)) { - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GrTextureAdjuster adjuster(tex.get(), image->alphaType(), image->bounds(), pinnedUniqueID, as_IB(image)->onImageInfo().colorSpace()); - this->drawTextureProducer(&adjuster, src, &dst, constraint, this->ctm(), fClip, paint); + this->drawTextureProducer(&adjuster, src, &dst, constraint, *draw.fMatrix, fClip, paint); return; } SkBitmap bm; SkMatrix srcToDstRect; srcToDstRect.setRectToRect((src ? *src : SkRect::MakeIWH(image->width(), image->height())), dst, SkMatrix::kFill_ScaleToFit); - if (this->shouldTileImage(image, src, constraint, paint.getFilterQuality(), this->ctm(), + if (this->shouldTileImage(image, src, constraint, paint.getFilterQuality(), *draw.fMatrix, srcToDstRect)) { // only support tiling as bitmap at the moment, so force raster-version if (!as_IB(image)->getROPixels(&bm, fRenderTargetContext->getColorSpace())) { return; } - this->drawBitmapRect(bm, src, dst, paint, constraint); + this->drawBitmapRect(draw, bm, src, dst, paint, constraint); } else if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) { - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint); - this->drawTextureProducer(&maker, src, &dst, constraint, this->ctm(), fClip, paint); + this->drawTextureProducer(&maker, src, &dst, constraint, *draw.fMatrix, fClip, paint); } else if (as_IB(image)->getROPixels(&bm, fRenderTargetContext->getColorSpace())) { - this->drawBitmapRect(bm, src, dst, paint, constraint); + this->drawBitmapRect(draw, bm, src, dst, paint, constraint); } } -void SkGpuDevice::drawProducerNine(GrTextureProducer* producer, +void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* producer, const SkIRect& center, const SkRect& dst, const SkPaint& paint) { GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawProducerNine", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); bool useFallback = paint.getMaskFilter() || paint.isAntiAlias() || fRenderTargetContext->isUnifiedMultisampled(); bool doBicubic; GrSamplerParams::FilterMode textureFilterMode = - GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), this->ctm(), SkMatrix::I(), + GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, SkMatrix::I(), &doBicubic); if (useFallback || doBicubic || GrSamplerParams::kNone_FilterMode != textureFilterMode) { SkLatticeIter iter(producer->width(), producer->height(), center, dst); @@ -1449,7 +1452,7 @@ void SkGpuDevice::drawProducerNine(GrTextureProducer* producer, SkRect srcR, dstR; while (iter.next(&srcR, &dstR)) { this->drawTextureProducer(producer, &srcR, &dstR, SkCanvas::kStrict_SrcRectConstraint, - this->ctm(), fClip, paint); + *draw.fMatrix, fClip, paint); } return; } @@ -1462,51 +1465,51 @@ void SkGpuDevice::drawProducerNine(GrTextureProducer* producer, &kMode, fRenderTargetContext->getColorSpace())); GrPaint grPaint; if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext.get(), paint, - this->ctm(), std::move(fp), producer->isAlphaOnly(), + *draw.fMatrix, std::move(fp), producer->isAlphaOnly(), &grPaint)) { return; } std::unique_ptr<SkLatticeIter> iter( new SkLatticeIter(producer->width(), producer->height(), center, dst)); - fRenderTargetContext->drawImageLattice(fClip, std::move(grPaint), this->ctm(), + fRenderTargetContext->drawImageLattice(fClip, std::move(grPaint), *draw.fMatrix, producer->width(), producer->height(), std::move(iter), dst); } -void SkGpuDevice::drawImageNine(const SkImage* image, +void SkGpuDevice::drawImageNine(const SkDraw& draw, const SkImage* image, const SkIRect& center, const SkRect& dst, const SkPaint& paint) { ASSERT_SINGLE_OWNER uint32_t pinnedUniqueID; if (sk_sp<GrTexture> tex = as_IB(image)->refPinnedTexture(&pinnedUniqueID)) { - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GrTextureAdjuster adjuster(tex.get(), image->alphaType(), image->bounds(), pinnedUniqueID, as_IB(image)->onImageInfo().colorSpace()); - this->drawProducerNine(&adjuster, center, dst, paint); + this->drawProducerNine(draw, &adjuster, center, dst, paint); } else { SkBitmap bm; if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) { GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint); - this->drawProducerNine(&maker, center, dst, paint); + this->drawProducerNine(draw, &maker, center, dst, paint); } else if (as_IB(image)->getROPixels(&bm, fRenderTargetContext->getColorSpace())) { - this->drawBitmapNine(bm, center, dst, paint); + this->drawBitmapNine(draw, bm, center, dst, paint); } } } -void SkGpuDevice::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, +void SkGpuDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, const SkPaint& paint) { ASSERT_SINGLE_OWNER GrBitmapTextureMaker maker(fContext.get(), bitmap); - this->drawProducerNine(&maker, center, dst, paint); + this->drawProducerNine(draw, &maker, center, dst, paint); } -void SkGpuDevice::drawProducerLattice(GrTextureProducer* producer, +void SkGpuDevice::drawProducerLattice(const SkDraw& draw, GrTextureProducer* producer, const SkCanvas::Lattice& lattice, const SkRect& dst, const SkPaint& paint) { GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawProducerLattice", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); static const GrSamplerParams::FilterMode kMode = GrSamplerParams::kNone_FilterMode; sk_sp<GrFragmentProcessor> fp( @@ -1516,45 +1519,45 @@ void SkGpuDevice::drawProducerLattice(GrTextureProducer* producer, &kMode, fRenderTargetContext->getColorSpace())); GrPaint grPaint; if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext.get(), paint, - this->ctm(), std::move(fp), producer->isAlphaOnly(), + *draw.fMatrix, std::move(fp), producer->isAlphaOnly(), &grPaint)) { return; } std::unique_ptr<SkLatticeIter> iter( new SkLatticeIter(lattice, dst)); - fRenderTargetContext->drawImageLattice(fClip, std::move(grPaint), this->ctm(), + fRenderTargetContext->drawImageLattice(fClip, std::move(grPaint), *draw.fMatrix, producer->width(), producer->height(), std::move(iter), dst); } -void SkGpuDevice::drawImageLattice(const SkImage* image, +void SkGpuDevice::drawImageLattice(const SkDraw& draw, const SkImage* image, const SkCanvas::Lattice& lattice, const SkRect& dst, const SkPaint& paint) { ASSERT_SINGLE_OWNER uint32_t pinnedUniqueID; if (sk_sp<GrTexture> tex = as_IB(image)->refPinnedTexture(&pinnedUniqueID)) { - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GrTextureAdjuster adjuster(tex.get(), image->alphaType(), image->bounds(), pinnedUniqueID, as_IB(image)->onImageInfo().colorSpace()); - this->drawProducerLattice(&adjuster, lattice, dst, paint); + this->drawProducerLattice(draw, &adjuster, lattice, dst, paint); } else { SkBitmap bm; if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) { GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint); - this->drawProducerLattice(&maker, lattice, dst, paint); + this->drawProducerLattice(draw, &maker, lattice, dst, paint); } else if (as_IB(image)->getROPixels(&bm, fRenderTargetContext->getColorSpace())) { - this->drawBitmapLattice(bm, lattice, dst, paint); + this->drawBitmapLattice(draw, bm, lattice, dst, paint); } } } -void SkGpuDevice::drawBitmapLattice(const SkBitmap& bitmap, +void SkGpuDevice::drawBitmapLattice(const SkDraw& draw, const SkBitmap& bitmap, const SkCanvas::Lattice& lattice, const SkRect& dst, const SkPaint& paint) { ASSERT_SINGLE_OWNER GrBitmapTextureMaker maker(fContext.get(), bitmap); - this->drawProducerLattice(&maker, lattice, dst, paint); + this->drawProducerLattice(draw, &maker, lattice, dst, paint); } bool init_vertices_paint(const SkPaint& skPaint, const SkMatrix& matrix, SkBlendMode bmode, @@ -1582,14 +1585,14 @@ bool init_vertices_paint(const SkPaint& skPaint, const SkMatrix& matrix, SkBlend } } -void SkGpuDevice::drawVertices(SkCanvas::VertexMode vmode, +void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkBlendMode bmode, const uint16_t indices[], int indexCount, const SkPaint& paint) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawVertices", fContext.get()); // If both textures and vertex-colors are nullptr, strokes hairlines with the paint's color. @@ -1639,7 +1642,7 @@ void SkGpuDevice::drawVertices(SkCanvas::VertexMode vmode, } fRenderTargetContext->drawVertices(fClip, std::move(grPaint), - this->ctm(), + *draw.fMatrix, kLines_GrPrimitiveType, vertexCount, vertices, @@ -1653,13 +1656,13 @@ void SkGpuDevice::drawVertices(SkCanvas::VertexMode vmode, GrPrimitiveType primType = SkVertexModeToGrPrimitiveType(vmode); GrPaint grPaint; - if (!init_vertices_paint(paint, this->ctm(), bmode, SkToBool(texs), SkToBool(colors), + if (!init_vertices_paint(paint, *draw.fMatrix, bmode, SkToBool(texs), SkToBool(colors), fRenderTargetContext.get(), &grPaint)) { return; } fRenderTargetContext->drawVertices(fClip, std::move(grPaint), - this->ctm(), + *draw.fMatrix, primType, vertexCount, vertices, @@ -1670,10 +1673,10 @@ void SkGpuDevice::drawVertices(SkCanvas::VertexMode vmode, GrRenderTargetContext::ColorArrayType::kSkColor); } -void SkGpuDevice::drawVerticesObject(sk_sp<SkVertices> vertices, +void SkGpuDevice::drawVerticesObject(const SkDraw& draw, sk_sp<SkVertices> vertices, SkBlendMode mode, const SkPaint& paint, uint32_t flags) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawVerticesObject", fContext.get()); SkASSERT(vertices); @@ -1682,30 +1685,30 @@ void SkGpuDevice::drawVerticesObject(sk_sp<SkVertices> vertices, bool hasTexs = vertices->hasTexCoords() & !(SkCanvas::kIgnoreTexCoords_VerticesFlag & flags); if (!hasTexs && !hasColors) { // The dreaded wireframe mode. Fallback to drawVertices and go so slooooooow. - this->drawVertices(vertices->mode(), vertices->vertexCount(), vertices->positions(), + this->drawVertices(draw, vertices->mode(), vertices->vertexCount(), vertices->positions(), nullptr, nullptr, mode, vertices->indices(), vertices->indexCount(), paint); } - if (!init_vertices_paint(paint, this->ctm(), mode, hasTexs, hasColors, + if (!init_vertices_paint(paint, *draw.fMatrix, mode, hasTexs, hasColors, fRenderTargetContext.get(), &grPaint)) { return; } - fRenderTargetContext->drawVertices(fClip, std::move(grPaint), this->ctm(), + fRenderTargetContext->drawVertices(fClip, std::move(grPaint), *draw.fMatrix, std::move(vertices), flags); } /////////////////////////////////////////////////////////////////////////////// -void SkGpuDevice::drawAtlas(const SkImage* atlas, const SkRSXform xform[], +void SkGpuDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRSXform xform[], const SkRect texRect[], const SkColor colors[], int count, SkBlendMode mode, const SkPaint& paint) { ASSERT_SINGLE_OWNER if (paint.isAntiAlias()) { - this->INHERITED::drawAtlas(atlas, xform, texRect, colors, count, mode, paint); + this->INHERITED::drawAtlas(draw, atlas, xform, texRect, colors, count, mode, paint); return; } - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext.get()); SkPaint p(paint); @@ -1714,58 +1717,58 @@ void SkGpuDevice::drawAtlas(const SkImage* atlas, const SkRSXform xform[], GrPaint grPaint; if (colors) { if (!SkPaintToGrPaintWithXfermode(this->context(), fRenderTargetContext.get(), p, - this->ctm(), (SkBlendMode)mode, true, &grPaint)) { + *draw.fMatrix, (SkBlendMode)mode, true, &grPaint)) { return; } } else { - if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), p, this->ctm(), + if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), p, *draw.fMatrix, &grPaint)) { return; } } SkDEBUGCODE(this->validate();) - fRenderTargetContext->drawAtlas(fClip, std::move(grPaint), this->ctm(), count, xform, texRect, + fRenderTargetContext->drawAtlas(fClip, std::move(grPaint), *draw.fMatrix, count, xform, texRect, colors); } /////////////////////////////////////////////////////////////////////////////// -void SkGpuDevice::drawText(const void* text, +void SkGpuDevice::drawText(const SkDraw& draw, const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { ASSERT_SINGLE_OWNER - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext.get()); SkDEBUGCODE(this->validate();) - fRenderTargetContext->drawText(fClip, paint, this->ctm(), - (const char*)text, byteLength, x, y, this->devClipBounds()); + fRenderTargetContext->drawText(fClip, paint, *draw.fMatrix, + (const char*)text, byteLength, x, y, this->devClipBounds(draw)); } -void SkGpuDevice::drawPosText(const void* text, size_t byteLength, +void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteLength, const SkScalar pos[], int scalarsPerPos, const SkPoint& offset, const SkPaint& paint) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPosText", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); SkDEBUGCODE(this->validate();) - fRenderTargetContext->drawPosText(fClip, paint, this->ctm(), + fRenderTargetContext->drawPosText(fClip, paint, *draw.fMatrix, (const char*)text, byteLength, pos, scalarsPerPos, offset, - this->devClipBounds()); + this->devClipBounds(draw)); } -void SkGpuDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, +void SkGpuDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint, SkDrawFilter* drawFilter) { ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawTextBlob", fContext.get()); - CHECK_SHOULD_DRAW(); + CHECK_SHOULD_DRAW(draw); SkDEBUGCODE(this->validate();) - fRenderTargetContext->drawTextBlob(fClip, paint, this->ctm(), - blob, x, y, drawFilter, this->devClipBounds()); + fRenderTargetContext->drawTextBlob(fClip, paint, *draw.fMatrix, + blob, x, y, drawFilter, this->devClipBounds(draw)); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index 655724ca90..31ade05f4c 100644 --- a/src/gpu/SkGpuDevice.h +++ b/src/gpu/SkGpuDevice.h @@ -65,55 +65,55 @@ public: GrRenderTargetContext* accessRenderTargetContext() override; - void drawPaint(const SkPaint& paint) override; - void drawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint[], + void drawPaint(const SkDraw&, const SkPaint& paint) override; + void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count, const SkPoint[], const SkPaint& paint) override; - void drawRect(const SkRect& r, const SkPaint& paint) override; - void drawRRect(const SkRRect& r, const SkPaint& paint) override; - void drawDRRect(const SkRRect& outer, const SkRRect& inner, + void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint) override; + void drawRRect(const SkDraw&, const SkRRect& r, const SkPaint& paint) override; + void drawDRRect(const SkDraw& draw, const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) override; - void drawRegion(const SkRegion& r, const SkPaint& paint) override; - void drawOval(const SkRect& oval, const SkPaint& paint) override; - void drawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, + void drawRegion(const SkDraw&, const SkRegion& r, const SkPaint& paint) override; + void drawOval(const SkDraw&, const SkRect& oval, const SkPaint& paint) override; + void drawArc(const SkDraw&, const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint& paint) override; - void drawPath(const SkPath& path, const SkPaint& paint, + void drawPath(const SkDraw&, const SkPath& path, const SkPaint& paint, const SkMatrix* prePathMatrix, bool pathIsMutable) override; - void drawBitmap(const SkBitmap& bitmap, const SkMatrix&, + void drawBitmap(const SkDraw&, const SkBitmap& bitmap, const SkMatrix&, const SkPaint&) override; - void drawBitmapRect(const SkBitmap&, const SkRect* srcOrNull, const SkRect& dst, + void drawBitmapRect(const SkDraw&, const SkBitmap&, const SkRect* srcOrNull, const SkRect& dst, const SkPaint& paint, SkCanvas::SrcRectConstraint) override; - void drawSprite(const SkBitmap& bitmap, int x, int y, + void drawSprite(const SkDraw&, const SkBitmap& bitmap, int x, int y, const SkPaint& paint) override; - void drawText(const void* text, size_t len, SkScalar x, SkScalar y, + void drawText(const SkDraw&, const void* text, size_t len, SkScalar x, SkScalar y, const SkPaint&) override; - void drawPosText(const void* text, size_t len, const SkScalar pos[], + void drawPosText(const SkDraw&, const void* text, size_t len, const SkScalar pos[], int scalarsPerPos, const SkPoint& offset, const SkPaint&) override; - void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, + void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint& paint, SkDrawFilter* drawFilter) override; - void drawVertices(SkCanvas::VertexMode, int vertexCount, const SkPoint verts[], + void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCount, const SkPoint verts[], const SkPoint texs[], const SkColor colors[], SkBlendMode, const uint16_t indices[], int indexCount, const SkPaint&) override; - void drawVerticesObject(sk_sp<SkVertices>, SkBlendMode, const SkPaint&, + void drawVerticesObject(const SkDraw&, sk_sp<SkVertices>, SkBlendMode, const SkPaint&, uint32_t flags) override; - void drawAtlas(const SkImage* atlas, const SkRSXform[], const SkRect[], + void drawAtlas(const SkDraw&, const SkImage* atlas, const SkRSXform[], const SkRect[], const SkColor[], int count, SkBlendMode, const SkPaint&) override; - void drawDevice(SkBaseDevice*, int x, int y, const SkPaint&) override; + void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&) override; - void drawImage(const SkImage*, SkScalar x, SkScalar y, const SkPaint&) override; - void drawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, + void drawImage(const SkDraw&, const SkImage*, SkScalar x, SkScalar y, const SkPaint&) override; + void drawImageRect(const SkDraw&, const SkImage*, const SkRect* src, const SkRect& dst, const SkPaint&, SkCanvas::SrcRectConstraint) override; - void drawImageNine(const SkImage* image, const SkIRect& center, + void drawImageNine(const SkDraw& draw, const SkImage* image, const SkIRect& center, const SkRect& dst, const SkPaint& paint) override; - void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, + void drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, const SkPaint& paint) override; - void drawImageLattice(const SkImage*, const SkCanvas::Lattice&, + void drawImageLattice(const SkDraw&, const SkImage*, const SkCanvas::Lattice&, const SkRect& dst, const SkPaint&) override; - void drawBitmapLattice(const SkBitmap&, const SkCanvas::Lattice&, + void drawBitmapLattice(const SkDraw&, const SkBitmap&, const SkCanvas::Lattice&, const SkRect& dst, const SkPaint&) override; - void drawSpecial(SkSpecialImage*, + void drawSpecial(const SkDraw&, SkSpecialImage*, int left, int top, const SkPaint& paint) override; sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override; sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override; @@ -157,7 +157,7 @@ private: bool forceConservativeRasterClip() const override { return true; } // sets the render target and clip on context - void prepareDraw(); + void prepareDraw(const SkDraw&); /** * Helper functions called by drawBitmapCommon. By the time these are called the SkDraw's @@ -179,7 +179,8 @@ private: SkCanvas::SrcRectConstraint constraint, SkFilterQuality quality, const SkMatrix& viewMatrix, const SkMatrix& srcToDstRect) const; - sk_sp<SkSpecialImage> filterTexture(SkSpecialImage*, + sk_sp<SkSpecialImage> filterTexture(const SkDraw&, + SkSpecialImage*, int left, int top, SkIPoint* offset, const SkImageFilter* filter); @@ -227,14 +228,14 @@ private: bool drawFilledDRRect(const SkMatrix& viewMatrix, const SkRRect& outer, const SkRRect& inner, const SkPaint& paint); - void drawProducerNine(GrTextureProducer*, const SkIRect& center, + void drawProducerNine(const SkDraw&, GrTextureProducer*, const SkIRect& center, const SkRect& dst, const SkPaint&); - void drawProducerLattice(GrTextureProducer*, const SkCanvas::Lattice& lattice, + void drawProducerLattice(const SkDraw&, GrTextureProducer*, const SkCanvas::Lattice& lattice, const SkRect& dst, const SkPaint&); bool drawDashLine(const SkPoint pts[2], const SkPaint& paint); - void drawStrokedLine(const SkPoint pts[2], const SkPaint&); + void drawStrokedLine(const SkPoint pts[2], const SkDraw&, const SkPaint&); static sk_sp<GrRenderTargetContext> MakeRenderTargetContext(GrContext*, SkBudgeted, |