| Index: cc/tiles/gpu_image_decode_cache.cc
|
| diff --git a/cc/tiles/gpu_image_decode_cache.cc b/cc/tiles/gpu_image_decode_cache.cc
|
| index 0f152a44ae55604840581be6c2a7ac844af8e564..3dbff0423513d1bc6e7051882e74c07f6d495a90 100644
|
| --- a/cc/tiles/gpu_image_decode_cache.cc
|
| +++ b/cc/tiles/gpu_image_decode_cache.cc
|
| @@ -1090,6 +1090,15 @@ void GpuImageDecodeCache::DecodeImageIfNecessary(const DrawImage& draw_image,
|
| {
|
| base::AutoUnlock unlock(lock_);
|
|
|
| + // TODO(ccameron,msarett): This does color conversion on the CPU side. Move
|
| + // this conversion to UploadImageIfNecessary.
|
| + sk_sp<const SkImage> decoder_image = draw_image.image();
|
| + if (draw_image.target_color_space().IsValid()) {
|
| + decoder_image = decoder_image->makeColorSpace(
|
| + draw_image.target_color_space().ToSkColorSpace(),
|
| + SkTransferFunctionBehavior::kIgnore);
|
| + }
|
| +
|
| backing_memory = base::DiscardableMemoryAllocator::GetInstance()
|
| ->AllocateLockedDiscardableMemory(image_data->size);
|
|
|
| @@ -1104,7 +1113,7 @@ void GpuImageDecodeCache::DecodeImageIfNecessary(const DrawImage& draw_image,
|
| image_info.minRowBytes());
|
| // Note that scalePixels falls back to readPixels if the sale is 1x, so
|
| // no need to special case that as an optimization.
|
| - if (!draw_image.image()->scalePixels(
|
| + if (!decoder_image->scalePixels(
|
| image_pixmap, CalculateUploadScaleFilterQuality(draw_image),
|
| SkImage::kDisallow_CachingHint)) {
|
| DLOG(ERROR) << "scalePixels failed.";
|
| @@ -1117,7 +1126,7 @@ void GpuImageDecodeCache::DecodeImageIfNecessary(const DrawImage& draw_image,
|
| // TODO(crbug.com/649167): Params should not have changed since initial
|
| // sizing. Somehow this still happens. We should investigate and re-add
|
| // DCHECKs here to enforce this.
|
| - if (!draw_image.image()->getDeferredTextureImageData(
|
| + if (!decoder_image->getDeferredTextureImageData(
|
| *context_threadsafe_proxy_.get(), &image_data->upload_params, 1,
|
| backing_memory->data(), nullptr)) {
|
| DLOG(ERROR) << "getDeferredTextureImageData failed despite params "
|
| @@ -1130,9 +1139,6 @@ void GpuImageDecodeCache::DecodeImageIfNecessary(const DrawImage& draw_image,
|
| }
|
| }
|
|
|
| - // TODO(ccameron,msarett): Convert image to target color space.
|
| - // http://crbug.com/706613
|
| -
|
| if (image_data->decode.data()) {
|
| // An at-raster task decoded this before us. Ingore our decode.
|
| return;
|
| @@ -1193,6 +1199,10 @@ void GpuImageDecodeCache::UploadImageIfNecessary(const DrawImage& draw_image,
|
| }
|
| }
|
| }
|
| +
|
| + // TODO(ccameron,msarett): Convert image to target color space using
|
| + // makeColorSpace here. http://crbug.com/706613
|
| +
|
| image_data->decode.mark_used();
|
| DCHECK(uploaded_image);
|
|
|
| @@ -1214,8 +1224,7 @@ GpuImageDecodeCache::CreateImageData(const DrawImage& draw_image) {
|
| draw_image.matrix(), CalculateUploadScaleFilterQuality(draw_image),
|
| upload_scale_mip_level);
|
| size_t data_size = draw_image.image()->getDeferredTextureImageData(
|
| - *context_threadsafe_proxy_.get(), ¶ms, 1, nullptr,
|
| - draw_image.target_color_space().ToSkColorSpace().get());
|
| + *context_threadsafe_proxy_.get(), ¶ms, 1, nullptr, nullptr);
|
|
|
| if (data_size == 0) {
|
| // Can't upload image, too large or other failure. Try to use SW fallback.
|
|
|