readpixels GM uses GPU image in GPU configs
This now demonstrates that readPixels does not do color sapce conversion in Ganesh (and fails completely for unpremul F16). Next: fix those issues. BUG=skia:5853 Change-Id: If3bd1882249ae85b4738ef72e16cfb87b06b9363 Reviewed-on: https://skia-review.googlesource.com/9904 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
This commit is contained in:
parent
4c55027dbf
commit
8915058264
@ -132,7 +132,9 @@ static void draw_image(SkCanvas* canvas, SkImage* image, SkColorType dstColorTyp
|
||||
dstColorSpace = fix_for_colortype(dstColorSpace.get(), dstColorType);
|
||||
SkImageInfo dstInfo = SkImageInfo::Make(image->width(), image->height(), dstColorType,
|
||||
dstAlphaType, dstColorSpace);
|
||||
image->readPixels(dstInfo, data->writable_data(), rowBytes, 0, 0, hint);
|
||||
if (!image->readPixels(dstInfo, data->writable_data(), rowBytes, 0, 0, hint)) {
|
||||
memset(data->writable_data(), 0, rowBytes * image->height());
|
||||
}
|
||||
|
||||
// SkImage must be premul, so manually premul the data if we unpremul'd during readPixels
|
||||
if (kUnpremul_SkAlphaType == dstAlphaType) {
|
||||
@ -193,11 +195,16 @@ protected:
|
||||
for (SkColorType srcColorType : colorTypes) {
|
||||
canvas->save();
|
||||
sk_sp<SkImage> image = make_raster_image(srcColorType);
|
||||
for (SkColorType dstColorType : colorTypes) {
|
||||
for (SkAlphaType dstAlphaType : alphaTypes) {
|
||||
draw_image(canvas, image.get(), dstColorType, dstAlphaType,
|
||||
dstColorSpace, SkImage::kAllow_CachingHint);
|
||||
canvas->translate((float) kWidth, 0.0f);
|
||||
if (GrContext* context = canvas->getGrContext()) {
|
||||
image = image->makeTextureImage(context, canvas->imageInfo().colorSpace());
|
||||
}
|
||||
if (image) {
|
||||
for (SkColorType dstColorType : colorTypes) {
|
||||
for (SkAlphaType dstAlphaType : alphaTypes) {
|
||||
draw_image(canvas, image.get(), dstColorType, dstAlphaType,
|
||||
dstColorSpace, SkImage::kAllow_CachingHint);
|
||||
canvas->translate((float)kWidth, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas->restore();
|
||||
|
Loading…
Reference in New Issue
Block a user