Chromium Code Reviews| Index: cc/blink/web_external_texture_layer_impl.cc |
| diff --git a/cc/blink/web_external_texture_layer_impl.cc b/cc/blink/web_external_texture_layer_impl.cc |
| index 2eef8658361ce36e26bad09113ed390b5d4ac225..b45d921ddc996136d79f11dcb3636051fb8bd5bc 100644 |
| --- a/cc/blink/web_external_texture_layer_impl.cc |
| +++ b/cc/blink/web_external_texture_layer_impl.cc |
| @@ -61,6 +61,24 @@ void WebExternalTextureLayerImpl::setNearestNeighbor(bool nearest_neighbor) { |
| ->SetNearestNeighbor(nearest_neighbor); |
| } |
| +static gfx::ColorSpace toGfxColorSpace(const SkColorSpace* skColorSpace) { |
|
danakj
2016/08/12 21:03:48
how about SkColorSpaceToColorSpace (like SkRectToR
Justin Novosad
2016/08/15 18:07:03
Done.
|
| + // TODO(crbug.com/634102): eliminate this clumsy conversion by unifying |
| + // SkColorSpace and gfx::ColorSpace |
|
danakj
2016/08/12 21:03:48
comments need punctuation and capitalization
Justin Novosad
2016/08/15 18:07:03
Done.
|
| + if (!skColorSpace) |
| + return gfx::ColorSpace(); |
| + |
| + // Assumption: using srgb or linear-rgb |
|
danakj
2016/08/12 21:03:48
comments need punctuation, should be proper senten
Justin Novosad
2016/08/15 18:07:03
Done.
|
| + DCHECK(skColorSpace->gammaNamed() == SkColorSpace::kSRGB_GammaNamed || |
| + skColorSpace->gammaNamed() == SkColorSpace::kLinear_GammaNamed); |
| + gfx::ColorSpace::TransferID transfer = |
| + skColorSpace->gammaNamed() == SkColorSpace::kSRGB_GammaNamed |
|
danakj
2016/08/12 21:03:48
can this be a switch instead? so new enum values f
Justin Novosad
2016/08/15 18:07:04
Done.
|
| + ? gfx::ColorSpace::TransferID::IEC61966_2_1 |
| + : gfx::ColorSpace::TransferID::LINEAR; |
| + return gfx::ColorSpace::ColorSpace(gfx::ColorSpace::PrimaryID::BT709, |
|
danakj
2016/08/12 21:03:48
what is gfx::ColorSpace::ColorSpace()? is that the
Justin Novosad
2016/08/15 18:07:04
This was bad code. somehow the compiler was lettin
|
| + transfer, gfx::ColorSpace::MatrixID::RGB, |
| + gfx::ColorSpace::RangeID::FULL); |
| +} |
| + |
| bool WebExternalTextureLayerImpl::PrepareTextureMailbox( |
| cc::TextureMailbox* mailbox, |
| std::unique_ptr<cc::SingleReleaseCallback>* release_callback, |
| @@ -97,6 +115,7 @@ bool WebExternalTextureLayerImpl::PrepareTextureMailbox( |
| client_mailbox.allowOverlay, false); |
| } |
| mailbox->set_nearest_neighbor(client_mailbox.nearestNeighbor); |
| + mailbox->set_color_space(toGfxColorSpace(client_mailbox.colorSpace)); |
| if (mailbox->IsValid()) { |
| *release_callback = cc::SingleReleaseCallback::Create( |