Remove SkPixelRef::getTexture()
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2264293003 Review-Url: https://codereview.chromium.org/2264293003
This commit is contained in:
parent
457b42a639
commit
19fe41e85e
@ -206,10 +206,6 @@ public:
|
|||||||
|
|
||||||
bool requestLock(const LockRequest&, LockResult*);
|
bool requestLock(const LockRequest&, LockResult*);
|
||||||
|
|
||||||
/** Are we really wrapping a texture instead of a bitmap?
|
|
||||||
*/
|
|
||||||
virtual GrTexture* getTexture() { return NULL; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this can efficiently return YUV data, this should return true.
|
* If this can efficiently return YUV data, this should return true.
|
||||||
* Otherwise this returns false and does not modify any of the parameters.
|
* Otherwise this returns false and does not modify any of the parameters.
|
||||||
|
@ -281,14 +281,8 @@ void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
|
|||||||
// since we may need to clamp to the borders of the src rect within
|
// since we may need to clamp to the borders of the src rect within
|
||||||
// the bitmap, we extract a subset.
|
// the bitmap, we extract a subset.
|
||||||
const SkIRect srcIR = tmpSrc.roundOut();
|
const SkIRect srcIR = tmpSrc.roundOut();
|
||||||
if(bitmap.pixelRef()->getTexture()) {
|
if (!bitmap.extractSubset(&tmpBitmap, srcIR)) {
|
||||||
// Accelerated source canvas, don't use extractSubset but readPixels to get the subset.
|
return;
|
||||||
// This way, the pixels are copied in CPU memory instead of GPU memory.
|
|
||||||
bitmap.pixelRef()->readPixels(&tmpBitmap, kN32_SkColorType, &srcIR);
|
|
||||||
} else {
|
|
||||||
if (!bitmap.extractSubset(&tmpBitmap, srcIR)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bitmapPtr = &tmpBitmap;
|
bitmapPtr = &tmpBitmap;
|
||||||
|
|
||||||
|
@ -75,8 +75,6 @@ extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage);
|
|||||||
// surface needs to perform a copy-on-write
|
// surface needs to perform a copy-on-write
|
||||||
extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
|
extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
|
||||||
|
|
||||||
GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will attempt to upload and lock the contents of the image as a texture, so that subsequent
|
* Will attempt to upload and lock the contents of the image as a texture, so that subsequent
|
||||||
* draws to a gpu-target will come from that texture (and not by looking at the original image
|
* draws to a gpu-target will come from that texture (and not by looking at the original image
|
||||||
|
@ -296,23 +296,6 @@ sk_sp<SkImage> SkImage::MakeFromBitmap(const SkBitmap& bm) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
|
||||||
if (GrTexture* tex = pr->getTexture()) {
|
|
||||||
SkAutoTUnref<GrTexture> unrefCopy;
|
|
||||||
if (!bm.isImmutable()) {
|
|
||||||
tex = GrDeepCopyTexture(tex, SkBudgeted::kNo);
|
|
||||||
if (nullptr == tex) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
unrefCopy.reset(tex);
|
|
||||||
}
|
|
||||||
const SkImageInfo info = bm.info();
|
|
||||||
return sk_make_sp<SkImage_Gpu>(info.width(), info.height(), bm.getGenerationID(),
|
|
||||||
info.alphaType(), tex, sk_ref_sp(info.colorSpace()),
|
|
||||||
SkBudgeted::kNo);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return SkMakeImageFromRasterBitmap(bm, kIfMutable_SkCopyPixelsMode);
|
return SkMakeImageFromRasterBitmap(bm, kIfMutable_SkCopyPixelsMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,22 +540,6 @@ sk_sp<SkImage> SkImage::MakeFromDeferredTextureImageData(GrContext* context, con
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted budgeted) {
|
|
||||||
GrContext* ctx = src->getContext();
|
|
||||||
|
|
||||||
GrSurfaceDesc desc = src->desc();
|
|
||||||
GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, nullptr, 0);
|
|
||||||
if (!dst) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
|
|
||||||
const SkIPoint dstP = SkIPoint::Make(0, 0);
|
|
||||||
ctx->copySurface(dst, src, srcR, dstP);
|
|
||||||
ctx->flushSurfaceWrites(dst);
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo& info,
|
sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo& info,
|
||||||
const GrMipLevel* texels, int mipLevelCount,
|
const GrMipLevel* texels, int mipLevelCount,
|
||||||
SkBudgeted budgeted) {
|
SkBudgeted budgeted) {
|
||||||
|
Loading…
Reference in New Issue
Block a user