diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBitmapDevice.cpp | 3 | ||||
-rw-r--r-- | src/core/SkBlurImageFilter.cpp | 3 | ||||
-rw-r--r-- | src/core/SkImageFilter.cpp | 5 | ||||
-rw-r--r-- | src/core/SkLocalMatrixImageFilter.cpp | 3 |
4 files changed, 10 insertions, 4 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 4f8074d3a6..440de68345 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -395,7 +395,8 @@ void SkBitmapDevice::drawSpecial(const SkDraw& draw, SkSpecialImage* srcImg, int matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y); SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache()); - SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); + SkImageFilter::OutputProperties outputProperties(fBitmap.colorSpace()); + SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), outputProperties); sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg, ctx, &offset)); if (resultImg) { diff --git a/src/core/SkBlurImageFilter.cpp b/src/core/SkBlurImageFilter.cpp index ccb3ed8fdd..78fa071acd 100644 --- a/src/core/SkBlurImageFilter.cpp +++ b/src/core/SkBlurImageFilter.cpp @@ -157,6 +157,9 @@ sk_sp<SkSpecialImage> SkBlurImageFilterImpl::onFilterImage(SkSpecialImage* sourc offset->fY = dstBounds.fTop; inputBounds.offset(-inputOffset); dstBounds.offset(-inputOffset); + // We intentionally use the source's color space, not the destination's (from ctx). We + // always blur in the source's config, so we need a compatible color space. We also want to + // avoid doing gamut conversion on every fetch of the texture. sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur( context, inputTexture.get(), diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 64b62759e2..9ec6f2c28f 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -278,11 +278,12 @@ bool SkImageFilter::canComputeFastBounds() const { sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context, sk_sp<GrFragmentProcessor> fp, const SkIRect& bounds, - sk_sp<SkColorSpace> colorSpace) { + const OutputProperties& outputProperties) { GrPaint paint; paint.addColorFragmentProcessor(std::move(fp)); paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); + sk_sp<SkColorSpace> colorSpace = sk_ref_sp(outputProperties.colorSpace()); GrPixelConfig config = GrRenderableConfigForColorSpace(colorSpace.get()); sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(), @@ -416,7 +417,7 @@ SkIRect SkImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix&, M SkImageFilter::Context SkImageFilter::mapContext(const Context& ctx) const { SkIRect clipBounds = this->onFilterNodeBounds(ctx.clipBounds(), ctx.ctm(), MapDirection::kReverse_MapDirection); - return Context(ctx.ctm(), clipBounds, ctx.cache()); + return Context(ctx.ctm(), clipBounds, ctx.cache(), ctx.outputProperties()); } sk_sp<SkImageFilter> SkImageFilter::MakeMatrixFilter(const SkMatrix& matrix, diff --git a/src/core/SkLocalMatrixImageFilter.cpp b/src/core/SkLocalMatrixImageFilter.cpp index b4d5bb2741..864b24b0fc 100644 --- a/src/core/SkLocalMatrixImageFilter.cpp +++ b/src/core/SkLocalMatrixImageFilter.cpp @@ -45,7 +45,8 @@ void SkLocalMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { sk_sp<SkSpecialImage> SkLocalMatrixImageFilter::onFilterImage(SkSpecialImage* source, const Context& ctx, SkIPoint* offset) const { - Context localCtx(SkMatrix::Concat(ctx.ctm(), fLocalM), ctx.clipBounds(), ctx.cache()); + Context localCtx(SkMatrix::Concat(ctx.ctm(), fLocalM), ctx.clipBounds(), ctx.cache(), + ctx.outputProperties()); return this->filterInput(0, source, localCtx, offset); } |