| OLD | NEW |
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 SkImageInfo info = SkImageInfo::Make(input->width(), input->height(), kN32_S
kColorType, kUnpremul_SkAlphaType); | 87 SkImageInfo info = SkImageInfo::Make(input->width(), input->height(), kN32_S
kColorType, kUnpremul_SkAlphaType); |
| 88 OwnPtr<uint8_t[]> dstPixels = copySkImageData(input, info); | 88 OwnPtr<uint8_t[]> dstPixels = copySkImageData(input, info); |
| 89 return newSkImageFromRaster(info, dstPixels.release(), input->width() * info
.bytesPerPixel()); | 89 return newSkImageFromRaster(info, dstPixels.release(), input->width() * info
.bytesPerPixel()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 PassRefPtr<SkImage> ImageBitmap::getSkImageFromDecoder(PassOwnPtr<ImageDecoder>
decoder) | 92 PassRefPtr<SkImage> ImageBitmap::getSkImageFromDecoder(PassOwnPtr<ImageDecoder>
decoder) |
| 93 { | 93 { |
| 94 if (!decoder->frameCount()) | 94 if (!decoder->frameCount()) |
| 95 return nullptr; | 95 return nullptr; |
| 96 ImageFrame* frame = decoder->frameBufferAtIndex(0); | 96 ImageFrame* frame = decoder->frameBufferAtIndex(0); |
| 97 if (!frame || frame->status() != ImageFrame::FrameComplete) | 97 if (!frame || frame->getStatus() != ImageFrame::FrameComplete) |
| 98 return nullptr; | 98 return nullptr; |
| 99 SkBitmap bitmap = frame->bitmap(); | 99 SkBitmap bitmap = frame->bitmap(); |
| 100 if (!frameIsValid(bitmap)) | 100 if (!frameIsValid(bitmap)) |
| 101 return nullptr; | 101 return nullptr; |
| 102 return adoptRef(SkImage::NewFromBitmap(bitmap)); | 102 return adoptRef(SkImage::NewFromBitmap(bitmap)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 static PassRefPtr<StaticBitmapImage> cropImage(Image* image, const IntRect& crop
Rect, bool flipY, bool premultiplyAlpha, bool isBitmapPremultiplied = true) | 105 static PassRefPtr<StaticBitmapImage> cropImage(Image* image, const IntRect& crop
Rect, bool flipY, bool premultiplyAlpha, bool isBitmapPremultiplied = true) |
| 106 { | 106 { |
| 107 ASSERT(image); | 107 ASSERT(image); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 FloatSize ImageBitmap::elementSize() const | 446 FloatSize ImageBitmap::elementSize() const |
| 447 { | 447 { |
| 448 return FloatSize(width(), height()); | 448 return FloatSize(width(), height()); |
| 449 } | 449 } |
| 450 | 450 |
| 451 DEFINE_TRACE(ImageBitmap) | 451 DEFINE_TRACE(ImageBitmap) |
| 452 { | 452 { |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |