| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 70 PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opa
cityMode) | 70 PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opa
cityMode, ImageInitializationMode initializationMode) |
| 71 { | 71 { |
| 72 OwnPtr<ImageBufferSurface> surface(adoptPtr(new UnacceleratedImageBufferSurf
ace(size, opacityMode))); | 72 OwnPtr<ImageBufferSurface> surface(adoptPtr(new UnacceleratedImageBufferSurf
ace(size, opacityMode, initializationMode))); |
| 73 if (!surface->isValid()) | 73 if (!surface->isValid()) |
| 74 return nullptr; | 74 return nullptr; |
| 75 return adoptPtr(new ImageBuffer(surface.release())); | 75 return adoptPtr(new ImageBuffer(surface.release())); |
| 76 } | 76 } |
| 77 | 77 |
| 78 ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface) | 78 ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface) |
| 79 : m_snapshotState(InitialSnapshotState) | 79 : m_snapshotState(InitialSnapshotState) |
| 80 , m_surface(surface) | 80 , m_surface(surface) |
| 81 , m_client(0) | 81 , m_client(0) |
| 82 { | 82 { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 376 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 377 | 377 |
| 378 Vector<char> encodedImage; | 378 Vector<char> encodedImage; |
| 379 if (!encodeImage(mimeType, quality, &encodedImage)) | 379 if (!encodeImage(mimeType, quality, &encodedImage)) |
| 380 return "data:,"; | 380 return "data:,"; |
| 381 | 381 |
| 382 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 382 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace blink | 385 } // namespace blink |
| OLD | NEW |