| 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, true); |
| 187 if (!m_cropRect.width() && !m_cropRect.height()) { | 187 if (!m_cropRect.width() && !m_cropRect.height()) { |
| 188 // No cropping variant was called. | 188 // No cropping variant was called. |
| 189 m_cropRect = IntRect(IntPoint(), image->size()); | 189 m_cropRect = IntRect(IntPoint(), image->size()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(
), m_cropRect); | 192 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(
), m_cropRect); |
| 193 m_resolver->resolve(imageBitmap.release()); | 193 m_resolver->resolve(imageBitmap.release()); |
| 194 m_factory->didFinishLoading(this); | 194 m_factory->didFinishLoading(this); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) | 197 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) |
| 198 { | 198 { |
| 199 rejectPromise(); | 199 rejectPromise(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) | 202 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) |
| 203 { | 203 { |
| 204 visitor->trace(m_factory); | 204 visitor->trace(m_factory); |
| 205 visitor->trace(m_resolver); | 205 visitor->trace(m_resolver); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace blink | 208 } // namespace blink |
| OLD | NEW |