Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp

Issue 2787053004: Respect colorSpace in DecodingImageGenerator::onGetPixels() (Closed)
Patch Set: Response to comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 542
543 m_sourceToTargetColorTransform = 543 m_sourceToTargetColorTransform =
544 SkColorSpaceXform::New(srcColorSpace.get(), dstColorSpace.get()); 544 SkColorSpaceXform::New(srcColorSpace.get(), dstColorSpace.get());
545 return m_sourceToTargetColorTransform.get(); 545 return m_sourceToTargetColorTransform.get();
546 } 546 }
547 547
548 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const { 548 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const {
549 if (!m_colorBehavior.isTag()) 549 if (!m_colorBehavior.isTag())
550 return nullptr; 550 return nullptr;
551 551
552 if (m_embeddedColorSpace) 552 if (m_embeddedColorSpace) {
553 return m_embeddedColorSpace; 553 SkColorSpaceTransferFn fn;
554 if (m_embeddedColorSpace->isNumericalTransferFn(&fn)) {
555 // The embedded color space is supported by Skia.
556 return m_embeddedColorSpace;
557 }
558
559 // In the rare case that the embedded color space is unsupported, xform at
560 // decode time.
561 SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
562 if (m_embeddedColorSpace->toXYZD50(&toXYZD50)) {
563 // Preserve the gamut, but convert to a standard transfer function.
564 return SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
565 toXYZD50);
566 }
567
568 // For color spaces without an identifiable gamut, just fall through to
569 // sRGB.
570 }
571
554 return SkColorSpace::MakeSRGB(); 572 return SkColorSpace::MakeSRGB();
555 } 573 }
556 574
557 } // namespace blink 575 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698