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

Side by Side Diff: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp

Issue 1577783003: Revert of Add a origin clean flag in ImageBitmap class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 /* 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
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<StaticBitmapImage> image = StaticBitmapImage::create(frame); 186 RefPtr<Image> image = StaticBitmapImage::create(frame);
187 image->setOriginClean(true);
188 if (!m_cropRect.width() && !m_cropRect.height()) { 187 if (!m_cropRect.width() && !m_cropRect.height()) {
189 // No cropping variant was called. 188 // No cropping variant was called.
190 m_cropRect = IntRect(IntPoint(), image->size()); 189 m_cropRect = IntRect(IntPoint(), image->size());
191 } 190 }
192 191
193 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image, m_c ropRect); 192 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get( ), m_cropRect);
194 m_resolver->resolve(imageBitmap.release()); 193 m_resolver->resolve(imageBitmap.release());
195 m_factory->didFinishLoading(this); 194 m_factory->didFinishLoading(this);
196 } 195 }
197 196
198 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) 197 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode)
199 { 198 {
200 rejectPromise(); 199 rejectPromise();
201 } 200 }
202 201
203 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) 202 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader)
204 { 203 {
205 visitor->trace(m_factory); 204 visitor->trace(m_factory);
206 visitor->trace(m_resolver); 205 visitor->trace(m_resolver);
207 } 206 }
208 207
209 } // namespace blink 208 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698