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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 1693863002: Revert of Revise the code for premultiplyAlpha=false for createImageBitmap(HTMLCanvasElement) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-with-options-expected.txt ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "core/frame/ImageBitmap.h" 5 #include "core/frame/ImageBitmap.h"
6 6
7 #include "core/html/HTMLCanvasElement.h" 7 #include "core/html/HTMLCanvasElement.h"
8 #include "core/html/HTMLVideoElement.h" 8 #include "core/html/HTMLVideoElement.h"
9 #include "core/html/ImageData.h" 9 #include "core/html/ImageData.h"
10 #include "platform/image-decoders/ImageDecoder.h" 10 #include "platform/image-decoders/ImageDecoder.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 m_image->setOriginClean(!video->wouldTaintOrigin(document->securityOrigin()) ); 175 m_image->setOriginClean(!video->wouldTaintOrigin(document->securityOrigin()) );
176 } 176 }
177 177
178 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect, con st ImageBitmapOptions& options) 178 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect, con st ImageBitmapOptions& options)
179 { 179 {
180 ASSERT(canvas->isPaintable()); 180 ASSERT(canvas->isPaintable());
181 bool imageOrientationFlipYFlag; 181 bool imageOrientationFlipYFlag;
182 bool premultiplyAlphaEnabledFlag; 182 bool premultiplyAlphaEnabledFlag;
183 parseOptions(options, imageOrientationFlipYFlag, premultiplyAlphaEnabledFlag ); 183 parseOptions(options, imageOrientationFlipYFlag, premultiplyAlphaEnabledFlag );
184 // canvas is always premultiplied, so set the last parameter to true and con vert to un-premul later 184 m_image = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration).get( ), cropRect, imageOrientationFlipYFlag, premultiplyAlphaEnabledFlag);
185 m_image = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration).get( ), cropRect, imageOrientationFlipYFlag, true);
186 if (!premultiplyAlphaEnabledFlag)
187 m_image = StaticBitmapImage::create(adoptRef(premulSkImageToUnPremul(m_i mage->imageForCurrentFrame().get())));
188 m_image->setOriginClean(canvas->originClean()); 185 m_image->setOriginClean(canvas->originClean());
189 } 186 }
190 187
191 ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect, const ImageBi tmapOptions& options) 188 ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect, const ImageBi tmapOptions& options)
192 { 189 {
193 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size())); 190 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size()));
194 191
195 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); 192 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels);
196 if (!buffer) 193 if (!buffer)
197 return; 194 return;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 { 351 {
355 return FloatSize(width(), height()); 352 return FloatSize(width(), height());
356 } 353 }
357 354
358 DEFINE_TRACE(ImageBitmap) 355 DEFINE_TRACE(ImageBitmap)
359 { 356 {
360 ImageLoaderClient::trace(visitor); 357 ImageLoaderClient::trace(visitor);
361 } 358 }
362 359
363 } // namespace blink 360 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-with-options-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698