Commit d7946b44 authored by Adlai Holler's avatar Adlai Holler Committed by Commit Bot

Migrate to makeColorSpace API w/GrDirectContext

This allows us to remove the staging flag to use the image's
own context as the context for the color space conversion.

Bug: skia:104662
Change-Id: Ibe5947dd0be652de11dfbf5d8b1066183eb9ad2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2341018Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarRobert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Cr-Commit-Position: refs/heads/master@{#796564}
parent 591dc1e9
......@@ -574,7 +574,7 @@ sk_sp<SkImage> ServiceImageTransferCacheEntry::MakeSkImage(
if (!original)
return nullptr;
if (target_color_space) {
image = original->makeColorSpace(target_color_space);
image = original->makeColorSpace(target_color_space, nullptr);
// If color space conversion is a noop, use original data.
if (image == original)
image = SkImage::MakeRasterCopy(pixmap);
......
......@@ -245,7 +245,7 @@ bool PaintImage::DecodeFromSkImage(void* memory,
auto image = GetSkImageForFrame(frame_index, client_id);
DCHECK(image);
if (color_space) {
image = image->makeColorSpace(color_space);
image = image->makeColorSpace(color_space, nullptr);
if (!image)
return false;
}
......
......@@ -490,7 +490,8 @@ sk_sp<SkImage> MakeTextureImage(viz::RasterContextProvider* context,
// Step 2: Apply a color-space conversion if necessary.
if (uploaded_image && target_color_space) {
sk_sp<SkImage> pre_converted_image = uploaded_image;
uploaded_image = uploaded_image->makeColorSpace(target_color_space);
uploaded_image = uploaded_image->makeColorSpace(target_color_space,
context->GrContext());
if (uploaded_image != pre_converted_image)
DeleteSkImageAndPreventCaching(context, std::move(pre_converted_image));
......@@ -2885,7 +2886,8 @@ sk_sp<SkImage> GpuImageDecodeCache::CreateImageFromYUVATexturesInternal(
SkISize::Make(image_width, image_height), origin_temp,
std::move(decoded_color_space));
if (target_color_space)
return yuva_image->makeColorSpace(target_color_space);
return yuva_image->makeColorSpace(target_color_space,
context_->GrContext());
return yuva_image;
}
......
......@@ -228,9 +228,6 @@ SK_API void SkDebugf_FileLine(const char* file,
// Staging for lowp::bilerp_clamp_8888, and for planned misc. others.
#define SK_DISABLE_LOWP_BILERP_CLAMP_CLAMP_STAGE
// Staging for https://review.skia.org/302290
#define SK_IMAGE_MAKE_COLOR_TYPE_AND_SPACE_USE_SOURCE_CONTEXT
///////////////////////// Imported from BUILD.gn and skia_common.gypi
/* In some places Skia can use static initializers for global initialization,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment