OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
6 #include "core/frame/ImageBitmap.h" | 6 #include "core/frame/ImageBitmap.h" |
7 | 7 |
8 #include "bindings/core/v8/UnionTypesCore.h" | 8 #include "bindings/core/v8/UnionTypesCore.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/fetch/MemoryCache.h" | 10 #include "core/fetch/MemoryCache.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 { | 41 { |
42 RefPtrWillBeRawPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::cre
ate(*Document::create().get()); | 42 RefPtrWillBeRawPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::cre
ate(*Document::create().get()); |
43 canvasElement->setHeight(40); | 43 canvasElement->setHeight(40); |
44 canvasElement->setWidth(40); | 44 canvasElement->setWidth(40); |
45 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapDerived = nullptr; | 45 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapDerived = nullptr; |
46 { | 46 { |
47 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre
ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he
ight())); | 47 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre
ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he
ight())); |
48 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In
tRect(0, 0, 20, 20)); | 48 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In
tRect(0, 0, 20, 20)); |
49 } | 49 } |
50 CanvasContextCreationAttributes attributes; | 50 CanvasContextCreationAttributes attributes; |
51 CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(c
anvasElement->getCanvasRenderingContext("2d", attributes)); | 51 CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(c
anvasElement->getCanvasRenderingContext(nullptr, "2d", attributes)); |
52 TrackExceptionState exceptionState; | 52 TrackExceptionState exceptionState; |
53 CanvasImageSourceUnion imageSource; | 53 CanvasImageSourceUnion imageSource; |
54 imageSource.setImageBitmap(imageBitmapDerived); | 54 imageSource.setImageBitmap(imageBitmapDerived); |
55 context->drawImage(imageSource, 0, 0, exceptionState); | 55 context->drawImage(imageSource, 0, 0, exceptionState); |
56 } | 56 } |
57 | 57 |
58 } // namespace | 58 } // namespace |
OLD | NEW |