зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1242794 - make SkGrPixelRef::deepCopy preserve alpha type. r=jmuizelaar
--HG-- extra : rebase_source : 5406d41a892877f3cbcf4bb6386b46d16ef3eca1
This commit is contained in:
Родитель
3759081484
Коммит
0fc3e0a084
|
@ -51,7 +51,8 @@ bool SkROLockPixelsPixelRef::onLockPixelsAreWritable() const {
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorType dstCT,
|
||||
SkColorProfileType dstPT, const SkIRect* subset) {
|
||||
SkAlphaType dstAT, SkColorProfileType dstPT,
|
||||
const SkIRect* subset) {
|
||||
if (nullptr == texture || kUnknown_SkColorType == dstCT) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -75,7 +76,7 @@ static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp
|
|||
srcRect = *subset;
|
||||
}
|
||||
desc.fFlags = kRenderTarget_GrSurfaceFlag;
|
||||
desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType, dstPT);
|
||||
desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, dstAT, dstPT);
|
||||
|
||||
GrTexture* dst = context->textureProvider()->createTexture(desc, false, nullptr, 0);
|
||||
if (nullptr == dst) {
|
||||
|
@ -88,8 +89,7 @@ static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp
|
|||
context->copySurface(dst->asRenderTarget(), texture, srcRect, SkIPoint::Make(0,0),
|
||||
GrContext::kFlushWrites_PixelOp);
|
||||
|
||||
SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPremul_SkAlphaType,
|
||||
dstPT);
|
||||
SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, dstAT, dstPT);
|
||||
SkGrPixelRef* pixelRef = new SkGrPixelRef(info, dst);
|
||||
SkSafeUnref(dst);
|
||||
return pixelRef;
|
||||
|
@ -142,7 +142,8 @@ SkPixelRef* SkGrPixelRef::deepCopy(SkColorType dstCT, SkColorProfileType dstPT,
|
|||
// a GrTexture owned elsewhere (e.g., SkGpuDevice), and cannot live
|
||||
// independently of that texture. Texture-backed pixel refs, on the other
|
||||
// hand, own their GrTextures, and are thus self-contained.
|
||||
return copy_to_new_texture_pixelref(fSurface->asTexture(), dstCT, dstPT, subset);
|
||||
return copy_to_new_texture_pixelref(fSurface->asTexture(), dstCT, this->info().alphaType(),
|
||||
dstPT, subset);
|
||||
}
|
||||
|
||||
static bool tryAllocBitmapPixels(SkBitmap* bitmap) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче