| OLD | NEW |
| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 return nullptr; | 522 return nullptr; |
| 523 | 523 |
| 524 sk_sp<SkColorSpace> srcColorSpace = m_embeddedColorSpace; | 524 sk_sp<SkColorSpace> srcColorSpace = m_embeddedColorSpace; |
| 525 if (!srcColorSpace) { | 525 if (!srcColorSpace) { |
| 526 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) | 526 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) |
| 527 srcColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); | 527 srcColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); |
| 528 else | 528 else |
| 529 return nullptr; | 529 return nullptr; |
| 530 } | 530 } |
| 531 | 531 |
| 532 if (SkColorSpace::Equals(m_embeddedColorSpace.get(), | 532 sk_sp<SkColorSpace> dstColorSpace = |
| 533 m_colorBehavior.targetColorSpace().get())) { | 533 m_colorBehavior.targetColorSpace().ToSkColorSpace(); |
| 534 |
| 535 if (SkColorSpace::Equals(srcColorSpace.get(), dstColorSpace.get())) { |
| 534 return nullptr; | 536 return nullptr; |
| 535 } | 537 } |
| 536 | 538 |
| 537 m_sourceToTargetColorTransform = SkColorSpaceXform::New( | 539 m_sourceToTargetColorTransform = |
| 538 m_embeddedColorSpace.get(), m_colorBehavior.targetColorSpace().get()); | 540 SkColorSpaceXform::New(srcColorSpace.get(), dstColorSpace.get()); |
| 539 return m_sourceToTargetColorTransform.get(); | 541 return m_sourceToTargetColorTransform.get(); |
| 540 } | 542 } |
| 541 | 543 |
| 542 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const { | 544 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const { |
| 543 if (!m_colorBehavior.isTag()) | 545 if (!m_colorBehavior.isTag()) |
| 544 return nullptr; | 546 return nullptr; |
| 545 | 547 |
| 546 if (m_embeddedColorSpace) | 548 if (m_embeddedColorSpace) |
| 547 return m_embeddedColorSpace; | 549 return m_embeddedColorSpace; |
| 548 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); | 550 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); |
| 549 } | 551 } |
| 550 | 552 |
| 551 } // namespace blink | 553 } // namespace blink |
| OLD | NEW |