| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // TODO(xidachen): GammaAndColorProfileApplied needs to be changed when
working on color-space conversion | 110 // TODO(xidachen): GammaAndColorProfileApplied needs to be changed when
working on color-space conversion |
| 111 OwnPtr<ImageDecoder> decoder(ImageDecoder::create( | 111 OwnPtr<ImageDecoder> decoder(ImageDecoder::create( |
| 112 *(image->data()), ImageDecoder::AlphaNotPremultiplied, | 112 *(image->data()), ImageDecoder::AlphaNotPremultiplied, |
| 113 ImageDecoder::GammaAndColorProfileApplied)); | 113 ImageDecoder::GammaAndColorProfileApplied)); |
| 114 if (!decoder) | 114 if (!decoder) |
| 115 return nullptr; | 115 return nullptr; |
| 116 decoder->setData(image->data(), true); | 116 decoder->setData(image->data(), true); |
| 117 if (!decoder->frameCount()) | 117 if (!decoder->frameCount()) |
| 118 return nullptr; | 118 return nullptr; |
| 119 ImageFrame* frame = decoder->frameBufferAtIndex(0); | 119 ImageFrame* frame = decoder->frameBufferAtIndex(0); |
| 120 if (!frame || frame->status() != ImageFrame::FrameComplete) | 120 if (!frame || frame->getStatus() != ImageFrame::FrameComplete) |
| 121 return nullptr; | 121 return nullptr; |
| 122 SkBitmap bitmap = frame->bitmap(); | 122 SkBitmap bitmap = frame->bitmap(); |
| 123 if (!frameIsValid(bitmap)) | 123 if (!frameIsValid(bitmap)) |
| 124 return nullptr; | 124 return nullptr; |
| 125 skiaImage = adoptRef(SkImage::NewFromBitmap(bitmap)); | 125 skiaImage = adoptRef(SkImage::NewFromBitmap(bitmap)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 if (cropRect == srcRect) { | 128 if (cropRect == srcRect) { |
| 129 if (flipY) | 129 if (flipY) |
| 130 return StaticBitmapImage::create(flipSkImageVertically(skiaImage->ne
wSubset(srcRect))); | 130 return StaticBitmapImage::create(flipSkImageVertically(skiaImage->ne
wSubset(srcRect))); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 FloatSize ImageBitmap::elementSize() const | 439 FloatSize ImageBitmap::elementSize() const |
| 440 { | 440 { |
| 441 return FloatSize(width(), height()); | 441 return FloatSize(width(), height()); |
| 442 } | 442 } |
| 443 | 443 |
| 444 DEFINE_TRACE(ImageBitmap) | 444 DEFINE_TRACE(ImageBitmap) |
| 445 { | 445 { |
| 446 } | 446 } |
| 447 | 447 |
| 448 } // namespace blink | 448 } // namespace blink |
| OLD | NEW |