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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp

Issue 2559013002: Add ColorBehavior to blink::Image draw methods (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/gpu/WebGLImageConversion.h" 5 #include "platform/graphics/gpu/WebGLImageConversion.h"
6 6
7 #include "platform/graphics/ImageObserver.h" 7 #include "platform/graphics/ImageObserver.h"
8 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" 8 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h"
9 #include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h" 9 #include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h"
10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h" 10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h"
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 extractImage(premultiplyAlpha, ignoreColorSpace); 2732 extractImage(premultiplyAlpha, ignoreColorSpace);
2733 } 2733 }
2734 2734
2735 void WebGLImageConversion::ImageExtractor::extractImage(bool premultiplyAlpha, 2735 void WebGLImageConversion::ImageExtractor::extractImage(bool premultiplyAlpha,
2736 bool ignoreColorSpace) { 2736 bool ignoreColorSpace) {
2737 ASSERT(!m_imagePixelLocker); 2737 ASSERT(!m_imagePixelLocker);
2738 2738
2739 if (!m_image) 2739 if (!m_image)
2740 return; 2740 return;
2741 2741
2742 sk_sp<SkImage> skiaImage = m_image->imageForCurrentFrame(); 2742 // TODO(ccameron): WebGL should operate in sRGB.
2743 // https://crbug.com/672299
2744 sk_sp<SkImage> skiaImage =
2745 m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget());
2743 SkImageInfo info = skiaImage ? SkImageInfo::MakeN32Premul(m_image->width(), 2746 SkImageInfo info = skiaImage ? SkImageInfo::MakeN32Premul(m_image->width(),
2744 m_image->height()) 2747 m_image->height())
2745 : SkImageInfo::MakeUnknown(); 2748 : SkImageInfo::MakeUnknown();
2746 m_alphaOp = AlphaDoNothing; 2749 m_alphaOp = AlphaDoNothing;
2747 bool hasAlpha = skiaImage ? !skiaImage->isOpaque() : true; 2750 bool hasAlpha = skiaImage ? !skiaImage->isOpaque() : true;
2748 2751
2749 if ((!skiaImage || ignoreColorSpace || (hasAlpha && !premultiplyAlpha)) && 2752 if ((!skiaImage || ignoreColorSpace || (hasAlpha && !premultiplyAlpha)) &&
2750 m_image->data()) { 2753 m_image->data()) {
2751 // Attempt to get raw unpremultiplied image data. 2754 // Attempt to get raw unpremultiplied image data.
2752 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create( 2755 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
3168 pack<WebGLImageConversion::DataFormatRGB565, 3171 pack<WebGLImageConversion::DataFormatRGB565,
3169 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, 3172 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart,
3170 pixelsPerRow); 3173 pixelsPerRow);
3171 } break; 3174 } break;
3172 default: 3175 default:
3173 break; 3176 break;
3174 } 3177 }
3175 } 3178 }
3176 3179
3177 } // namespace blink 3180 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698