| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 originalImageResource->image()->nativeImageForCurrentFrame()->bitmap().p
ixelRef()->pixels()); | 193 originalImageResource->image()->nativeImageForCurrentFrame()->bitmap().p
ixelRef()->pixels()); |
| 194 | 194 |
| 195 ASSERT_NE(imageBitmap->bitmapImage().get(), newImageResource->image()); | 195 ASSERT_NE(imageBitmap->bitmapImage().get(), newImageResource->image()); |
| 196 ASSERT_NE(imageBitmap->bitmapImage()->nativeImageForCurrentFrame()->bitmap()
.pixelRef()->pixels(), | 196 ASSERT_NE(imageBitmap->bitmapImage()->nativeImageForCurrentFrame()->bitmap()
.pixelRef()->pixels(), |
| 197 newImageResource->image()->nativeImageForCurrentFrame()->bitmap().pixelR
ef()->pixels()); | 197 newImageResource->image()->nativeImageForCurrentFrame()->bitmap().pixelR
ef()->pixels()); |
| 198 } | 198 } |
| 199 | 199 |
| 200 // Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own
Image. | 200 // Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own
Image. |
| 201 TEST_F(ImageBitmapTest, ImageResourceLifetime) | 201 TEST_F(ImageBitmapTest, ImageResourceLifetime) |
| 202 { | 202 { |
| 203 RefPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::create(*Documen
t::create().get()); | 203 RefPtrWillBeRawPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::cre
ate(*Document::create().get()); |
| 204 canvasElement->setHeight(40); | 204 canvasElement->setHeight(40); |
| 205 canvasElement->setWidth(40); | 205 canvasElement->setWidth(40); |
| 206 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapDerived = nullptr; | 206 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapDerived = nullptr; |
| 207 { | 207 { |
| 208 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre
ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he
ight())); | 208 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre
ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he
ight())); |
| 209 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In
tRect(0, 0, 20, 20)); | 209 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In
tRect(0, 0, 20, 20)); |
| 210 } | 210 } |
| 211 CanvasRenderingContext* context = canvasElement->getContext("2d"); | 211 CanvasRenderingContext* context = canvasElement->getContext("2d"); |
| 212 TrackExceptionState exceptionState; | 212 TrackExceptionState exceptionState; |
| 213 toCanvasRenderingContext2D(context)->drawImage(imageBitmapDerived.get(), 0,
0, exceptionState); | 213 toCanvasRenderingContext2D(context)->drawImage(imageBitmapDerived.get(), 0,
0, exceptionState); |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace | 216 } // namespace |
| OLD | NEW |