| 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 12 matching lines...) Expand all Loading... |
| 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 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 "config.h" | 33 #include "sky/engine/config.h" |
| 34 #include "platform/graphics/ImageBuffer.h" | 34 #include "sky/engine/platform/graphics/ImageBuffer.h" |
| 35 | 35 |
| 36 #include "GrContext.h" | |
| 37 #include "platform/MIMETypeRegistry.h" | |
| 38 #include "platform/geometry/IntRect.h" | |
| 39 #include "platform/graphics/BitmapImage.h" | |
| 40 #include "platform/graphics/GraphicsContext.h" | |
| 41 #include "platform/graphics/GraphicsTypes3D.h" | |
| 42 #include "platform/graphics/ImageBufferClient.h" | |
| 43 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | |
| 44 #include "platform/graphics/gpu/DrawingBuffer.h" | |
| 45 #include "platform/graphics/gpu/Extensions3DUtil.h" | |
| 46 #include "platform/graphics/skia/NativeImageSkia.h" | |
| 47 #include "platform/graphics/skia/SkiaUtils.h" | |
| 48 #include "platform/image-encoders/skia/JPEGImageEncoder.h" | 36 #include "platform/image-encoders/skia/JPEGImageEncoder.h" |
| 49 #include "platform/image-encoders/skia/PNGImageEncoder.h" | 37 #include "platform/image-encoders/skia/PNGImageEncoder.h" |
| 50 #include "public/platform/Platform.h" | 38 #include "sky/engine/platform/MIMETypeRegistry.h" |
| 51 #include "public/platform/WebExternalTextureMailbox.h" | 39 #include "sky/engine/platform/geometry/IntRect.h" |
| 52 #include "public/platform/WebGraphicsContext3D.h" | 40 #include "sky/engine/platform/graphics/BitmapImage.h" |
| 53 #include "public/platform/WebGraphicsContext3DProvider.h" | 41 #include "sky/engine/platform/graphics/GraphicsContext.h" |
| 42 #include "sky/engine/platform/graphics/GraphicsTypes3D.h" |
| 43 #include "sky/engine/platform/graphics/ImageBufferClient.h" |
| 44 #include "sky/engine/platform/graphics/UnacceleratedImageBufferSurface.h" |
| 45 #include "sky/engine/platform/graphics/gpu/DrawingBuffer.h" |
| 46 #include "sky/engine/platform/graphics/gpu/Extensions3DUtil.h" |
| 47 #include "sky/engine/platform/graphics/skia/NativeImageSkia.h" |
| 48 #include "sky/engine/platform/graphics/skia/SkiaUtils.h" |
| 49 #include "sky/engine/public/platform/Platform.h" |
| 50 #include "sky/engine/public/platform/WebExternalTextureMailbox.h" |
| 51 #include "sky/engine/public/platform/WebGraphicsContext3D.h" |
| 52 #include "sky/engine/public/platform/WebGraphicsContext3DProvider.h" |
| 53 #include "sky/engine/wtf/MathExtras.h" |
| 54 #include "sky/engine/wtf/Vector.h" |
| 55 #include "sky/engine/wtf/text/Base64.h" |
| 56 #include "sky/engine/wtf/text/WTFString.h" |
| 54 #include "third_party/skia/include/core/SkPicture.h" | 57 #include "third_party/skia/include/core/SkPicture.h" |
| 55 #include "third_party/skia/include/effects/SkTableColorFilter.h" | 58 #include "third_party/skia/include/effects/SkTableColorFilter.h" |
| 56 #include "wtf/MathExtras.h" | 59 #include "third_party/skia/include/gpu/GrContext.h" |
| 57 #include "wtf/Vector.h" | |
| 58 #include "wtf/text/Base64.h" | |
| 59 #include "wtf/text/WTFString.h" | |
| 60 | 60 |
| 61 namespace blink { | 61 namespace blink { |
| 62 | 62 |
| 63 PassOwnPtr<ImageBuffer> ImageBuffer::create(PassOwnPtr<ImageBufferSurface> surfa
ce) | 63 PassOwnPtr<ImageBuffer> ImageBuffer::create(PassOwnPtr<ImageBufferSurface> surfa
ce) |
| 64 { | 64 { |
| 65 if (!surface->isValid()) | 65 if (!surface->isValid()) |
| 66 return nullptr; | 66 return nullptr; |
| 67 return adoptPtr(new ImageBuffer(surface)); | 67 return adoptPtr(new ImageBuffer(surface)); |
| 68 } | 68 } |
| 69 | 69 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 422 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) |
| 423 return "data:,"; | 423 return "data:,"; |
| 424 | 424 |
| 425 Vector<char> base64Data; | 425 Vector<char> base64Data; |
| 426 base64Encode(encodedImage, base64Data); | 426 base64Encode(encodedImage, base64Data); |
| 427 | 427 |
| 428 return "data:" + mimeType + ";base64," + base64Data; | 428 return "data:" + mimeType + ";base64," + base64Data; |
| 429 } | 429 } |
| 430 | 430 |
| 431 } // namespace blink | 431 } // namespace blink |
| OLD | NEW |