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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 { | 394 { |
395 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 395 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
396 | 396 |
397 Vector<char> encodedImage; | 397 Vector<char> encodedImage; |
398 if (!isSurfaceValid() || !encodeImage(m_surface->bitmap(), mimeType, quality
, &encodedImage)) | 398 if (!isSurfaceValid() || !encodeImage(m_surface->bitmap(), mimeType, quality
, &encodedImage)) |
399 return "data:,"; | 399 return "data:,"; |
400 | 400 |
401 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 401 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
402 } | 402 } |
403 | 403 |
404 String ImageDataToDataURL(const ImageDataBuffer& imageData, const String& mimeTy
pe, const double* quality) | 404 String ImageDataBuffer::toDataURL(const String& mimeType, const double* quality)
const |
405 { | 405 { |
406 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 406 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
407 | 407 |
408 Vector<char> encodedImage; | 408 Vector<char> encodedImage; |
409 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 409 if (!encodeImage(*this, mimeType, quality, &encodedImage)) |
410 return "data:,"; | 410 return "data:,"; |
411 | 411 |
412 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 412 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
413 } | 413 } |
414 | 414 |
415 } // namespace blink | 415 } // namespace blink |
OLD | NEW |