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

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

Issue 1899403002: MediaStream Image Capture (2): Platform::ImageCaptureFrameGrabber and grabFrame() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 // 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 396
397 void ImageBitmap::close() 397 void ImageBitmap::close()
398 { 398 {
399 if (!m_image || m_isNeutered) 399 if (!m_image || m_isNeutered)
400 return; 400 return;
401 m_image.clear(); 401 m_image.clear();
402 m_isNeutered = true; 402 m_isNeutered = true;
403 } 403 }
404 404
405 // static
406 ImageBitmap* ImageBitmap::take(ScriptPromiseResolver*, PassOwnPtr<SkBitmap> bitm ap)
407 {
408 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(
409 adoptRef(SkImage::NewFromBitmap(*bitmap.leakPtr())));
Reilly Grant (use Gerrit) 2016/04/25 22:37:33 I think you just want SkImage::NewFromBitmap(*bitm
mcasas 2016/04/27 00:51:29 Done.
410
411 return ImageBitmap::create(image.release());
Reilly Grant (use Gerrit) 2016/04/25 22:37:33 It shouldn't be necessary to call release here. Th
mcasas 2016/04/27 00:51:28 Done.
412 }
413
405 PassOwnPtr<uint8_t[]> ImageBitmap::copyBitmapData(AlphaDisposition alphaOp) 414 PassOwnPtr<uint8_t[]> ImageBitmap::copyBitmapData(AlphaDisposition alphaOp)
406 { 415 {
407 SkImageInfo info = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorTy pe, (alphaOp == PremultiplyAlpha) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType) ; 416 SkImageInfo info = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorTy pe, (alphaOp == PremultiplyAlpha) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType) ;
408 OwnPtr<uint8_t[]> dstPixels = copySkImageData(m_image->imageForCurrentFrame( ).get(), info); 417 OwnPtr<uint8_t[]> dstPixels = copySkImageData(m_image->imageForCurrentFrame( ).get(), info);
409 return dstPixels.release(); 418 return dstPixels.release();
410 } 419 }
411 420
412 unsigned long ImageBitmap::width() const 421 unsigned long ImageBitmap::width() const
413 { 422 {
414 if (!m_image) 423 if (!m_image)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 FloatSize ImageBitmap::elementSize(const FloatSize&) const 480 FloatSize ImageBitmap::elementSize(const FloatSize&) const
472 { 481 {
473 return FloatSize(width(), height()); 482 return FloatSize(width(), height());
474 } 483 }
475 484
476 DEFINE_TRACE(ImageBitmap) 485 DEFINE_TRACE(ImageBitmap)
477 { 486 {
478 } 487 }
479 488
480 } // namespace blink 489 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.h ('k') | third_party/WebKit/Source/modules/imagecapture/ImageCapture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698