| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 { | 229 { |
| 230 ASSERT(!isNeutered()); | 230 ASSERT(!isNeutered()); |
| 231 m_isNeutered = true; | 231 m_isNeutered = true; |
| 232 return m_image.release(); | 232 return m_image.release(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 ImageBitmap::~ImageBitmap() | 235 ImageBitmap::~ImageBitmap() |
| 236 { | 236 { |
| 237 } | 237 } |
| 238 | 238 |
| 239 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image,
const IntRect& cropRect, Document* document, const ImageBitmapOptions& options) | 239 RawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect&
cropRect, Document* document, const ImageBitmapOptions& options) |
| 240 { | 240 { |
| 241 IntRect normalizedCropRect = normalizeRect(cropRect); | 241 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 242 return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect, documen
t, options)); | 242 return (new ImageBitmap(image, normalizedCropRect, document, options)); |
| 243 } | 243 } |
| 244 | 244 |
| 245 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video,
const IntRect& cropRect, Document* document, const ImageBitmapOptions& options) | 245 RawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect&
cropRect, Document* document, const ImageBitmapOptions& options) |
| 246 { | 246 { |
| 247 IntRect normalizedCropRect = normalizeRect(cropRect); | 247 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 248 return adoptRefWillBeNoop(new ImageBitmap(video, normalizedCropRect, documen
t, options)); | 248 return (new ImageBitmap(video, normalizedCropRect, document, options)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canva
s, const IntRect& cropRect, const ImageBitmapOptions& options) | 251 RawPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect
& cropRect, const ImageBitmapOptions& options) |
| 252 { | 252 { |
| 253 IntRect normalizedCropRect = normalizeRect(cropRect); | 253 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 254 return adoptRefWillBeNoop(new ImageBitmap(canvas, normalizedCropRect, option
s)); | 254 return (new ImageBitmap(canvas, normalizedCropRect, options)); |
| 255 } | 255 } |
| 256 | 256 |
| 257 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const I
ntRect& cropRect, const ImageBitmapOptions& options) | 257 RawPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const IntRect& cropRect
, const ImageBitmapOptions& options) |
| 258 { | 258 { |
| 259 IntRect normalizedCropRect = normalizeRect(cropRect); | 259 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 260 return adoptRefWillBeNoop(new ImageBitmap(data, normalizedCropRect, options)
); | 260 return (new ImageBitmap(data, normalizedCropRect, options)); |
| 261 } | 261 } |
| 262 | 262 |
| 263 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, con
st IntRect& cropRect, const ImageBitmapOptions& options) | 263 RawPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, const IntRect& crop
Rect, const ImageBitmapOptions& options) |
| 264 { | 264 { |
| 265 IntRect normalizedCropRect = normalizeRect(cropRect); | 265 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 266 return adoptRefWillBeNoop(new ImageBitmap(bitmap, normalizedCropRect, option
s)); | 266 return (new ImageBitmap(bitmap, normalizedCropRect, options)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapI
mage> image, const IntRect& cropRect, const ImageBitmapOptions& options) | 269 RawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapImage> image, con
st IntRect& cropRect, const ImageBitmapOptions& options) |
| 270 { | 270 { |
| 271 IntRect normalizedCropRect = normalizeRect(cropRect); | 271 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 272 return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect, options
)); | 272 return (new ImageBitmap(image, normalizedCropRect, options)); |
| 273 } | 273 } |
| 274 | 274 |
| 275 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapI
mage> image) | 275 RawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapImage> image) |
| 276 { | 276 { |
| 277 return adoptRefWillBeNoop(new ImageBitmap(image)); | 277 return (new ImageBitmap(image)); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void ImageBitmap::close() | 280 void ImageBitmap::close() |
| 281 { | 281 { |
| 282 if (!m_image || m_isNeutered) | 282 if (!m_image || m_isNeutered) |
| 283 return; | 283 return; |
| 284 m_image.clear(); | 284 m_image.clear(); |
| 285 m_isNeutered = true; | 285 m_isNeutered = true; |
| 286 } | 286 } |
| 287 | 287 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 { | 345 { |
| 346 return FloatSize(width(), height()); | 346 return FloatSize(width(), height()); |
| 347 } | 347 } |
| 348 | 348 |
| 349 DEFINE_TRACE(ImageBitmap) | 349 DEFINE_TRACE(ImageBitmap) |
| 350 { | 350 { |
| 351 ImageLoaderClient::trace(visitor); | 351 ImageLoaderClient::trace(visitor); |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace blink | 354 } // namespace blink |
| OLD | NEW |