| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 OwnPtr<ImageSource> source = adoptPtr(new ImageSource()); | 176 OwnPtr<ImageSource> source = adoptPtr(new ImageSource()); |
| 177 source->setData(*sharedBuffer, true); | 177 source->setData(*sharedBuffer, true); |
| 178 | 178 |
| 179 RefPtr<SkImage> frame = source->createFrameAtIndex(0); | 179 RefPtr<SkImage> frame = source->createFrameAtIndex(0); |
| 180 ASSERT(!frame || (frame->width() && frame->height())); | 180 ASSERT(!frame || (frame->width() && frame->height())); |
| 181 if (!frame) { | 181 if (!frame) { |
| 182 rejectPromise(); | 182 rejectPromise(); |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 | 185 |
| 186 RefPtr<Image> image = StaticBitmapImage::create(frame); | 186 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(frame); |
| 187 image->setOriginClean(true); |
| 187 if (!m_cropRect.width() && !m_cropRect.height()) { | 188 if (!m_cropRect.width() && !m_cropRect.height()) { |
| 188 // No cropping variant was called. | 189 // No cropping variant was called. |
| 189 m_cropRect = IntRect(IntPoint(), image->size()); | 190 m_cropRect = IntRect(IntPoint(), image->size()); |
| 190 } | 191 } |
| 191 | 192 |
| 192 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(
), m_cropRect); | 193 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image, m_c
ropRect); |
| 193 m_resolver->resolve(imageBitmap.release()); | 194 m_resolver->resolve(imageBitmap.release()); |
| 194 m_factory->didFinishLoading(this); | 195 m_factory->didFinishLoading(this); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) | 198 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) |
| 198 { | 199 { |
| 199 rejectPromise(); | 200 rejectPromise(); |
| 200 } | 201 } |
| 201 | 202 |
| 202 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) | 203 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) |
| 203 { | 204 { |
| 204 visitor->trace(m_factory); | 205 visitor->trace(m_factory); |
| 205 visitor->trace(m_resolver); | 206 visitor->trace(m_resolver); |
| 206 } | 207 } |
| 207 | 208 |
| 208 } // namespace blink | 209 } // namespace blink |
| OLD | NEW |