OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 14 matching lines...) Expand all Loading... |
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 */ | 31 */ |
32 | 32 |
33 #include "platform/graphics/ImageBuffer.h" | 33 #include "platform/graphics/ImageBuffer.h" |
34 | 34 |
| 35 #include <memory> |
35 #include "gpu/command_buffer/client/gles2_interface.h" | 36 #include "gpu/command_buffer/client/gles2_interface.h" |
36 #include "gpu/command_buffer/common/mailbox.h" | 37 #include "gpu/command_buffer/common/mailbox.h" |
37 #include "gpu/command_buffer/common/sync_token.h" | 38 #include "gpu/command_buffer/common/sync_token.h" |
38 #include "platform/RuntimeEnabledFeatures.h" | 39 #include "platform/RuntimeEnabledFeatures.h" |
39 #include "platform/geometry/IntRect.h" | 40 #include "platform/geometry/IntRect.h" |
40 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 41 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
41 #include "platform/graphics/GraphicsContext.h" | 42 #include "platform/graphics/GraphicsContext.h" |
42 #include "platform/graphics/ImageBufferClient.h" | 43 #include "platform/graphics/ImageBufferClient.h" |
43 #include "platform/graphics/RecordingImageBufferSurface.h" | 44 #include "platform/graphics/RecordingImageBufferSurface.h" |
44 #include "platform/graphics/StaticBitmapImage.h" | 45 #include "platform/graphics/StaticBitmapImage.h" |
(...skipping 12 matching lines...) Expand all Loading... |
57 #include "third_party/skia/include/core/SkSwizzle.h" | 58 #include "third_party/skia/include/core/SkSwizzle.h" |
58 #include "third_party/skia/include/gpu/GrContext.h" | 59 #include "third_party/skia/include/gpu/GrContext.h" |
59 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" | 60 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
60 #include "wtf/CheckedNumeric.h" | 61 #include "wtf/CheckedNumeric.h" |
61 #include "wtf/MathExtras.h" | 62 #include "wtf/MathExtras.h" |
62 #include "wtf/PtrUtil.h" | 63 #include "wtf/PtrUtil.h" |
63 #include "wtf/Vector.h" | 64 #include "wtf/Vector.h" |
64 #include "wtf/text/Base64.h" | 65 #include "wtf/text/Base64.h" |
65 #include "wtf/text/WTFString.h" | 66 #include "wtf/text/WTFString.h" |
66 #include "wtf/typed_arrays/ArrayBufferContents.h" | 67 #include "wtf/typed_arrays/ArrayBufferContents.h" |
67 #include <memory> | |
68 | 68 |
69 namespace blink { | 69 namespace blink { |
70 | 70 |
71 std::unique_ptr<ImageBuffer> ImageBuffer::create( | 71 std::unique_ptr<ImageBuffer> ImageBuffer::create( |
72 std::unique_ptr<ImageBufferSurface> surface) { | 72 std::unique_ptr<ImageBufferSurface> surface) { |
73 if (!surface->isValid()) | 73 if (!surface->isValid()) |
74 return nullptr; | 74 return nullptr; |
75 return WTF::wrapUnique(new ImageBuffer(std::move(surface))); | 75 return WTF::wrapUnique(new ImageBuffer(std::move(surface))); |
76 } | 76 } |
77 | 77 |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 DCHECK(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 608 DCHECK(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
609 | 609 |
610 Vector<unsigned char> result; | 610 Vector<unsigned char> result; |
611 if (!encodeImage(mimeType, quality, &result)) | 611 if (!encodeImage(mimeType, quality, &result)) |
612 return "data:,"; | 612 return "data:,"; |
613 | 613 |
614 return "data:" + mimeType + ";base64," + base64Encode(result); | 614 return "data:" + mimeType + ";base64," + base64Encode(result); |
615 } | 615 } |
616 | 616 |
617 } // namespace blink | 617 } // namespace blink |
OLD | NEW |