| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 { | 337 { |
| 338 ASSERT(!isNeutered()); | 338 ASSERT(!isNeutered()); |
| 339 m_isNeutered = true; | 339 m_isNeutered = true; |
| 340 return m_image.release(); | 340 return m_image.release(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 ImageBitmap::~ImageBitmap() | 343 ImageBitmap::~ImageBitmap() |
| 344 { | 344 { |
| 345 } | 345 } |
| 346 | 346 |
| 347 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image,
const IntRect& cropRect, Document* document, const ImageBitmapOptions& options) | 347 RawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect&
cropRect, Document* document, const ImageBitmapOptions& options) |
| 348 { | 348 { |
| 349 IntRect normalizedCropRect = normalizeRect(cropRect); | 349 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 350 return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect, documen
t, options)); | 350 return new ImageBitmap(image, normalizedCropRect, document, options); |
| 351 } | 351 } |
| 352 | 352 |
| 353 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video,
const IntRect& cropRect, Document* document, const ImageBitmapOptions& options) | 353 RawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect&
cropRect, Document* document, const ImageBitmapOptions& options) |
| 354 { | 354 { |
| 355 IntRect normalizedCropRect = normalizeRect(cropRect); | 355 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 356 return adoptRefWillBeNoop(new ImageBitmap(video, normalizedCropRect, documen
t, options)); | 356 return new ImageBitmap(video, normalizedCropRect, document, options); |
| 357 } | 357 } |
| 358 | 358 |
| 359 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canva
s, const IntRect& cropRect, const ImageBitmapOptions& options) | 359 RawPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect
& cropRect, const ImageBitmapOptions& options) |
| 360 { | 360 { |
| 361 IntRect normalizedCropRect = normalizeRect(cropRect); | 361 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 362 return adoptRefWillBeNoop(new ImageBitmap(canvas, normalizedCropRect, option
s)); | 362 return new ImageBitmap(canvas, normalizedCropRect, options); |
| 363 } | 363 } |
| 364 | 364 |
| 365 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const I
ntRect& cropRect, const ImageBitmapOptions& options) | 365 RawPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const IntRect& cropRect
, const ImageBitmapOptions& options) |
| 366 { | 366 { |
| 367 IntRect normalizedCropRect = normalizeRect(cropRect); | 367 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 368 return adoptRefWillBeNoop(new ImageBitmap(data, normalizedCropRect, options)
); | 368 return new ImageBitmap(data, normalizedCropRect, options); |
| 369 } | 369 } |
| 370 | 370 |
| 371 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, con
st IntRect& cropRect, const ImageBitmapOptions& options) | 371 RawPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, const IntRect& crop
Rect, const ImageBitmapOptions& options) |
| 372 { | 372 { |
| 373 IntRect normalizedCropRect = normalizeRect(cropRect); | 373 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 374 return adoptRefWillBeNoop(new ImageBitmap(bitmap, normalizedCropRect, option
s)); | 374 return new ImageBitmap(bitmap, normalizedCropRect, options); |
| 375 } | 375 } |
| 376 | 376 |
| 377 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapI
mage> image, const IntRect& cropRect, const ImageBitmapOptions& options) | 377 RawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapImage> image, con
st IntRect& cropRect, const ImageBitmapOptions& options) |
| 378 { | 378 { |
| 379 IntRect normalizedCropRect = normalizeRect(cropRect); | 379 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 380 return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect, options
)); | 380 return new ImageBitmap(image, normalizedCropRect, options); |
| 381 } | 381 } |
| 382 | 382 |
| 383 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapI
mage> image) | 383 RawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapImage> image) |
| 384 { | 384 { |
| 385 return adoptRefWillBeNoop(new ImageBitmap(image)); | 385 return new ImageBitmap(image); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void ImageBitmap::close() | 388 void ImageBitmap::close() |
| 389 { | 389 { |
| 390 if (!m_image || m_isNeutered) | 390 if (!m_image || m_isNeutered) |
| 391 return; | 391 return; |
| 392 m_image.clear(); | 392 m_image.clear(); |
| 393 m_isNeutered = true; | 393 m_isNeutered = true; |
| 394 } | 394 } |
| 395 | 395 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 462 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
| 463 { | 463 { |
| 464 return FloatSize(width(), height()); | 464 return FloatSize(width(), height()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 DEFINE_TRACE(ImageBitmap) | 467 DEFINE_TRACE(ImageBitmap) |
| 468 { | 468 { |
| 469 } | 469 } |
| 470 | 470 |
| 471 } // namespace blink | 471 } // namespace blink |
| OLD | NEW |