| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 { | 428 { |
| 429 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 429 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 430 | 430 |
| 431 Vector<char> encodedImage; | 431 Vector<char> encodedImage; |
| 432 if (!isSurfaceValid() || !encodeImage(m_surface->bitmap(), mimeType, quality
, &encodedImage)) | 432 if (!isSurfaceValid() || !encodeImage(m_surface->bitmap(), mimeType, quality
, &encodedImage)) |
| 433 return "data:,"; | 433 return "data:,"; |
| 434 | 434 |
| 435 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 435 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
| 436 } | 436 } |
| 437 | 437 |
| 438 String ImageDataToDataURL(const ImageDataBuffer& imageData, const String& mimeTy
pe, const double* quality) | |
| 439 { | |
| 440 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | |
| 441 | |
| 442 Vector<char> encodedImage; | |
| 443 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | |
| 444 return "data:,"; | |
| 445 | |
| 446 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | |
| 447 } | |
| 448 | |
| 449 } // namespace blink | 438 } // namespace blink |
| OLD | NEW |