Adding color space to SkSpecialImage

Mostly means that GPU backed special images need to be supplied (and
store) a color space object.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2163343002

Review-Url: https://codereview.chromium.org/2163343002
This commit is contained in:
brianosman 2016-07-21 07:15:37 -07:00 committed by Commit bot
parent 1b93bd1e6e
commit afbf71dd92
16 changed files with 75 additions and 32 deletions

View File

@ -11,6 +11,7 @@
#include "../private/SkTArray.h" #include "../private/SkTArray.h"
#include "../private/SkTemplates.h" #include "../private/SkTemplates.h"
#include "../private/SkMutex.h" #include "../private/SkMutex.h"
#include "SkColorSpace.h"
#include "SkFilterQuality.h" #include "SkFilterQuality.h"
#include "SkFlattenable.h" #include "SkFlattenable.h"
#include "SkMatrix.h" #include "SkMatrix.h"
@ -131,7 +132,8 @@ public:
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
static sk_sp<SkSpecialImage> DrawWithFP(GrContext* context, static sk_sp<SkSpecialImage> DrawWithFP(GrContext* context,
sk_sp<GrFragmentProcessor> fp, sk_sp<GrFragmentProcessor> fp,
const SkIRect& bounds); const SkIRect& bounds,
sk_sp<SkColorSpace> colorSpace);
#endif #endif
/** /**

View File

@ -275,7 +275,8 @@ bool SkImageFilter::canComputeFastBounds() const {
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context, sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
sk_sp<GrFragmentProcessor> fp, sk_sp<GrFragmentProcessor> fp,
const SkIRect& bounds) { const SkIRect& bounds,
sk_sp<SkColorSpace> colorSpace) {
GrPaint paint; GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp)); paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
@ -293,8 +294,9 @@ sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
GrFixedClip clip(dstIRect); GrFixedClip clip(dstIRect);
drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
// TODO: Get the colorSpace from the drawContext (once it has one)
return SkSpecialImage::MakeFromGpu(dstIRect, kNeedNewImageUniqueID_SpecialImage, return SkSpecialImage::MakeFromGpu(dstIRect, kNeedNewImageUniqueID_SpecialImage,
drawContext->asTexture()); drawContext->asTexture(), std::move(colorSpace));
} }
#endif #endif

View File

@ -45,6 +45,8 @@ public:
virtual GrTexture* onPeekTexture() const { return nullptr; } virtual GrTexture* onPeekTexture() const { return nullptr; }
virtual SkColorSpace* onGetColorSpace() const = 0;
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
virtual sk_sp<GrTexture> onAsTextureRef(GrContext* context) const = 0; virtual sk_sp<GrTexture> onAsTextureRef(GrContext* context) const = 0;
#endif #endif
@ -111,7 +113,8 @@ sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(GrContext* context) {
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(resultTex->width(), resultTex->height()), return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(resultTex->width(), resultTex->height()),
this->uniqueID(), this->uniqueID(),
resultTex, &this->props(), at); resultTex, sk_ref_sp(this->getColorSpace()), &this->props(),
at);
#else #else
return nullptr; return nullptr;
#endif #endif
@ -144,6 +147,10 @@ GrContext* SkSpecialImage::getContext() const {
return nullptr; return nullptr;
} }
SkColorSpace* SkSpecialImage::getColorSpace() const {
return as_SIB(this)->onGetColorSpace();
}
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
sk_sp<GrTexture> SkSpecialImage::asTextureRef(GrContext* context) const { sk_sp<GrTexture> SkSpecialImage::asTextureRef(GrContext* context) const {
return as_SIB(this)->onAsTextureRef(context); return as_SIB(this)->onAsTextureRef(context);
@ -187,7 +194,8 @@ sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(const SkIRect& subset,
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
if (GrTexture* texture = as_IB(image)->peekTexture()) { if (GrTexture* texture = as_IB(image)->peekTexture()) {
return MakeFromGpu(subset, image->uniqueID(), sk_ref_sp(texture), props); return MakeFromGpu(subset, image->uniqueID(), sk_ref_sp(texture),
sk_ref_sp(as_IB(image)->onImageInfo().colorSpace()), props);
} else } else
#endif #endif
{ {
@ -230,6 +238,10 @@ public:
return true; return true;
} }
SkColorSpace* onGetColorSpace() const override {
return fBitmap.colorSpace();
}
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override { sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override {
if (context) { if (context) {
@ -311,10 +323,11 @@ class SkSpecialImage_Gpu : public SkSpecialImage_Base {
public: public:
SkSpecialImage_Gpu(const SkIRect& subset, SkSpecialImage_Gpu(const SkIRect& subset,
uint32_t uniqueID, sk_sp<GrTexture> tex, SkAlphaType at, uint32_t uniqueID, sk_sp<GrTexture> tex, SkAlphaType at,
const SkSurfaceProps* props) sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* props)
: INHERITED(subset, uniqueID, props) : INHERITED(subset, uniqueID, props)
, fTexture(std::move(tex)) , fTexture(std::move(tex))
, fAlphaType(at) , fAlphaType(at)
, fColorSpace(std::move(colorSpace))
, fAddedRasterVersionToCache(false) { , fAddedRasterVersionToCache(false) {
} }
@ -334,10 +347,9 @@ public:
SkRect dst = SkRect::MakeXYWH(x, y, SkRect dst = SkRect::MakeXYWH(x, y,
this->subset().width(), this->subset().height()); this->subset().width(), this->subset().height());
// TODO: Supply correct color space after we're storing it here
auto img = sk_sp<SkImage>(new SkImage_Gpu(fTexture->width(), fTexture->height(), auto img = sk_sp<SkImage>(new SkImage_Gpu(fTexture->width(), fTexture->height(),
this->uniqueID(), fAlphaType, fTexture.get(), this->uniqueID(), fAlphaType, fTexture.get(),
nullptr, SkBudgeted::kNo)); fColorSpace, SkBudgeted::kNo));
canvas->drawImageRect(img, this->subset(), canvas->drawImageRect(img, this->subset(),
dst, paint, SkCanvas::kStrict_SrcRectConstraint); dst, paint, SkCanvas::kStrict_SrcRectConstraint);
@ -357,7 +369,8 @@ public:
SkImageInfo info = SkImageInfo::MakeN32(this->width(), this->height(), SkImageInfo info = SkImageInfo::MakeN32(this->width(), this->height(),
this->isOpaque() ? kOpaque_SkAlphaType this->isOpaque() ? kOpaque_SkAlphaType
: kPremul_SkAlphaType); : kPremul_SkAlphaType,
fColorSpace);
if (!dst->tryAllocPixels(info)) { if (!dst->tryAllocPixels(info)) {
return false; return false;
@ -374,10 +387,14 @@ public:
return true; return true;
} }
SkColorSpace* onGetColorSpace() const override {
return fColorSpace.get();
}
bool getBitmapDeprecated(SkBitmap* result) const override { bool getBitmapDeprecated(SkBitmap* result) const override {
const SkImageInfo info = GrMakeInfoFromTexture(fTexture.get(), const SkImageInfo info = GrMakeInfoFromTexture(fTexture.get(),
this->width(), this->height(), this->width(), this->height(),
this->isOpaque()); this->isOpaque(), fColorSpace);
if (!result->setInfo(info)) { if (!result->setInfo(info)) {
return false; return false;
} }
@ -405,6 +422,7 @@ public:
return SkSpecialImage::MakeFromGpu(subset, return SkSpecialImage::MakeFromGpu(subset,
this->uniqueID(), this->uniqueID(),
fTexture, fTexture,
fColorSpace,
&this->props(), &this->props(),
fAlphaType); fAlphaType);
} }
@ -414,10 +432,10 @@ public:
fTexture->width() == subset.width() && fTexture->width() == subset.width() &&
fTexture->height() == subset.height()) { fTexture->height() == subset.height()) {
// The existing GrTexture is already tight so reuse it in the SkImage // The existing GrTexture is already tight so reuse it in the SkImage
// TODO: Supply correct color space after we're storing it here
return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height(), return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height(),
kNeedNewImageUniqueID, kNeedNewImageUniqueID,
fAlphaType, fTexture.get(), nullptr, SkBudgeted::kYes); fAlphaType, fTexture.get(), fColorSpace,
SkBudgeted::kYes);
} }
GrContext* ctx = fTexture->getContext(); GrContext* ctx = fTexture->getContext();
@ -430,9 +448,8 @@ public:
return nullptr; return nullptr;
} }
ctx->copySurface(subTx.get(), fTexture.get(), subset, SkIPoint::Make(0, 0)); ctx->copySurface(subTx.get(), fTexture.get(), subset, SkIPoint::Make(0, 0));
// TODO: Supply correct color space after we're storing it here
return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID, return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
fAlphaType, subTx.get(), nullptr, SkBudgeted::kYes); fAlphaType, subTx.get(), fColorSpace, SkBudgeted::kYes);
} }
sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override { sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
@ -442,6 +459,7 @@ public:
private: private:
sk_sp<GrTexture> fTexture; sk_sp<GrTexture> fTexture;
const SkAlphaType fAlphaType; const SkAlphaType fAlphaType;
sk_sp<SkColorSpace> fColorSpace;
mutable SkAtomic<bool> fAddedRasterVersionToCache; mutable SkAtomic<bool> fAddedRasterVersionToCache;
typedef SkSpecialImage_Base INHERITED; typedef SkSpecialImage_Base INHERITED;
@ -450,10 +468,12 @@ private:
sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(const SkIRect& subset, sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(const SkIRect& subset,
uint32_t uniqueID, uint32_t uniqueID,
sk_sp<GrTexture> tex, sk_sp<GrTexture> tex,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* props, const SkSurfaceProps* props,
SkAlphaType at) { SkAlphaType at) {
SkASSERT(rect_fits(subset, tex->width(), tex->height())); SkASSERT(rect_fits(subset, tex->width(), tex->height()));
return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, props); return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at,
std::move(colorSpace), props);
} }
#endif #endif

View File

@ -50,6 +50,7 @@ public:
int width() const { return fSubset.width(); } int width() const { return fSubset.width(); }
int height() const { return fSubset.height(); } int height() const { return fSubset.height(); }
const SkIRect& subset() const { return fSubset; } const SkIRect& subset() const { return fSubset; }
SkColorSpace* getColorSpace() const;
uint32_t uniqueID() const { return fUniqueID; } uint32_t uniqueID() const { return fUniqueID; }
virtual bool isOpaque() const { return false; } virtual bool isOpaque() const { return false; }
@ -77,6 +78,7 @@ public:
static sk_sp<SkSpecialImage> MakeFromGpu(const SkIRect& subset, static sk_sp<SkSpecialImage> MakeFromGpu(const SkIRect& subset,
uint32_t uniqueID, uint32_t uniqueID,
sk_sp<GrTexture>, sk_sp<GrTexture>,
sk_sp<SkColorSpace>,
const SkSurfaceProps* = nullptr, const SkSurfaceProps* = nullptr,
SkAlphaType at = kPremul_SkAlphaType); SkAlphaType at = kPremul_SkAlphaType);
#endif #endif

View File

@ -137,9 +137,11 @@ public:
~SkSpecialSurface_Gpu() override { } ~SkSpecialSurface_Gpu() override { }
sk_sp<SkSpecialImage> onMakeImageSnapshot() override { sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
// TODO: Supply color space from fDrawContext, once it's present
sk_sp<SkSpecialImage> tmp(SkSpecialImage::MakeFromGpu(this->subset(), sk_sp<SkSpecialImage> tmp(SkSpecialImage::MakeFromGpu(this->subset(),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
fDrawContext->asTexture(), fDrawContext->asTexture(),
nullptr,
&this->props())); &this->props()));
fDrawContext = nullptr; fDrawContext = nullptr;
return tmp; return tmp;

View File

@ -180,7 +180,7 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage*
return nullptr; return nullptr;
} }
return DrawWithFP(context, std::move(fp), bounds); return DrawWithFP(context, std::move(fp), bounds, sk_ref_sp(input->getColorSpace()));
} }
#endif #endif

View File

@ -132,9 +132,11 @@ sk_sp<SkSpecialImage> SkBlurImageFilter::onFilterImage(SkSpecialImage* source,
return nullptr; return nullptr;
} }
// TODO: Get the colorSpace from the drawContext (once it has one)
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), dstBounds.height()), return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), dstBounds.height()),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
drawContext->asTexture(), &source->props()); drawContext->asTexture(),
sk_ref_sp(input->getColorSpace()), &source->props());
} }
#endif #endif

View File

@ -346,9 +346,11 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
offset->fX = bounds.left(); offset->fX = bounds.left();
offset->fY = bounds.top(); offset->fY = bounds.top();
// TODO: Get the colorSpace from the drawContext (once it has one)
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()), return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
drawContext->asTexture()); drawContext->asTexture(),
sk_ref_sp(source->getColorSpace()));
} }
#endif #endif

View File

@ -453,9 +453,11 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma
this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRight, this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRight,
kBottomRight_BoundaryMode, pSrcBounds, offsetBounds); kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
// TODO: Get the colorSpace from the drawContext (once it has one)
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()), return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
drawContext->asTexture()); drawContext->asTexture(),
sk_ref_sp(source->getColorSpace()));
} }
#endif #endif

View File

@ -337,7 +337,7 @@ sk_sp<SkSpecialImage> SkMagnifierImageFilter::onFilterImage(SkSpecialImage* sour
return nullptr; return nullptr;
} }
return DrawWithFP(context, std::move(fp), bounds); return DrawWithFP(context, std::move(fp), bounds, sk_ref_sp(input->getColorSpace()));
} }
#endif #endif

View File

@ -328,7 +328,7 @@ sk_sp<SkSpecialImage> SkMatrixConvolutionImageFilter::onFilterImage(SkSpecialIma
return nullptr; return nullptr;
} }
return DrawWithFP(context, std::move(fp), bounds); return DrawWithFP(context, std::move(fp), bounds, sk_ref_sp(input->getColorSpace()));
} }
#endif #endif

View File

@ -519,9 +519,11 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context,
srcTexture = dstDrawContext->asTexture(); srcTexture = dstDrawContext->asTexture();
} }
// TODO: Get the colorSpace from the drawContext (once it has one)
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()), return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
std::move(srcTexture), &input->props()); std::move(srcTexture), sk_ref_sp(input->getColorSpace()),
&input->props());
} }
#endif #endif

View File

@ -252,9 +252,11 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top())); matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds)); drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
// TODO: Get the colorSpace from the drawContext (once it has one)
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()), return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
drawContext->asTexture()); drawContext->asTexture(),
sk_ref_sp(source->getColorSpace()));
} }
#endif #endif

View File

@ -1241,6 +1241,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
sk_sp<SkSpecialImage> srcImg(SkSpecialImage::MakeFromGpu(srcRect, sk_sp<SkSpecialImage> srcImg(SkSpecialImage::MakeFromGpu(srcRect,
bitmap.getGenerationID(), bitmap.getGenerationID(),
std::move(texture), std::move(texture),
sk_ref_sp(bitmap.colorSpace()),
&this->surfaceProps())); &this->surfaceProps()));
this->drawSpecial(draw, srcImg.get(), left, top, paint); this->drawSpecial(draw, srcImg.get(), left, top, paint);
@ -1407,6 +1408,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkBitmap& bitmap) {
return SkSpecialImage::MakeFromGpu(bitmap.bounds(), return SkSpecialImage::MakeFromGpu(bitmap.bounds(),
bitmap.getGenerationID(), bitmap.getGenerationID(),
sk_ref_sp(texture), sk_ref_sp(texture),
sk_ref_sp(bitmap.colorSpace()),
&this->surfaceProps()); &this->surfaceProps());
} }
@ -1418,6 +1420,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkImage* image) {
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(image->width(), image->height()), return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(image->width(), image->height()),
image->uniqueID(), image->uniqueID(),
sk_ref_sp(texture), sk_ref_sp(texture),
sk_ref_sp(as_IB(image)->onImageInfo().colorSpace()),
&this->surfaceProps()); &this->surfaceProps());
} else if (image->peekPixels(&pm)) { } else if (image->peekPixels(&pm)) {
SkBitmap bm; SkBitmap bm;
@ -1452,6 +1455,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
return SkSpecialImage::MakeFromGpu(srcRect, return SkSpecialImage::MakeFromGpu(srcRect,
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
std::move(texture), std::move(texture),
sk_ref_sp(ii.colorSpace()),
&this->surfaceProps()); &this->surfaceProps());
} }

View File

@ -222,13 +222,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo
sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(full, sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(full,
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
srcTexture)); srcTexture, nullptr));
const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(subset, sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(subset,
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
srcTexture)); srcTexture, nullptr));
test_find_existing(reporter, fullImg, subsetImg); test_find_existing(reporter, fullImg, subsetImg);
test_dont_find_if_diff_key(reporter, fullImg, subsetImg); test_dont_find_if_diff_key(reporter, fullImg, subsetImg);

View File

@ -187,6 +187,7 @@ static void test_texture_backed(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID());
REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().width() && REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().width() &&
gpuBacked->subset().height() == orig->subset().height()); gpuBacked->subset().height() == orig->subset().height());
REPORTER_ASSERT(reporter, gpuBacked->getColorSpace() == orig->getColorSpace());
} }
// Test out the SkSpecialImage::makeTextureImage entry point // Test out the SkSpecialImage::makeTextureImage entry point
@ -236,7 +237,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
SkIRect::MakeWH(kFullSize, SkIRect::MakeWH(kFullSize,
kFullSize), kFullSize),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
std::move(texture))); std::move(texture), nullptr));
{ {
sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(context)); sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(context));
@ -272,7 +273,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeFromGpu( sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeFromGpu(
SkIRect::MakeWH(kFullSize, kFullSize), SkIRect::MakeWH(kFullSize, kFullSize),
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
texture)); texture, nullptr));
const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
@ -280,7 +281,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromGpu( sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromGpu(
subset, subset,
kNeedNewImageUniqueID_SpecialImage, kNeedNewImageUniqueID_SpecialImage,
texture)); texture, nullptr));
test_image(subSImg1, reporter, context, true, kPad, kFullSize); test_image(subSImg1, reporter, context, true, kPad, kFullSize);
} }