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

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

Issue 2679323005: Update callsites to new SkColorSpace API, delete legacy flag (Closed)
Patch Set: Formatting Created 3 years, 10 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 return m_sourceToTargetColorTransform.get(); 517 return m_sourceToTargetColorTransform.get();
518 m_sourceToTargetColorTransformNeedsUpdate = false; 518 m_sourceToTargetColorTransformNeedsUpdate = false;
519 m_sourceToTargetColorTransform = nullptr; 519 m_sourceToTargetColorTransform = nullptr;
520 520
521 if (!m_colorBehavior.isTransformToTargetColorSpace()) 521 if (!m_colorBehavior.isTransformToTargetColorSpace())
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::MakeSRGB();
528 else 528 else
529 return nullptr; 529 return nullptr;
530 } 530 }
531 531
532 sk_sp<SkColorSpace> dstColorSpace = 532 sk_sp<SkColorSpace> dstColorSpace =
533 m_colorBehavior.targetColorSpace().ToSkColorSpace(); 533 m_colorBehavior.targetColorSpace().ToSkColorSpace();
534 534
535 if (SkColorSpace::Equals(srcColorSpace.get(), dstColorSpace.get())) { 535 if (SkColorSpace::Equals(srcColorSpace.get(), dstColorSpace.get())) {
536 return nullptr; 536 return nullptr;
537 } 537 }
538 538
539 m_sourceToTargetColorTransform = 539 m_sourceToTargetColorTransform =
540 SkColorSpaceXform::New(srcColorSpace.get(), dstColorSpace.get()); 540 SkColorSpaceXform::New(srcColorSpace.get(), dstColorSpace.get());
541 return m_sourceToTargetColorTransform.get(); 541 return m_sourceToTargetColorTransform.get();
542 } 542 }
543 543
544 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const { 544 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const {
545 if (!m_colorBehavior.isTag()) 545 if (!m_colorBehavior.isTag())
546 return nullptr; 546 return nullptr;
547 547
548 if (m_embeddedColorSpace) 548 if (m_embeddedColorSpace)
549 return m_embeddedColorSpace; 549 return m_embeddedColorSpace;
550 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); 550 return SkColorSpace::MakeSRGB();
551 } 551 }
552 552
553 } // namespace blink 553 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698