Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: Source/platform/graphics/ImageBuffer.cpp

Issue 1257253004: [HTMLCanvasElement.toBlob] Default callback version without scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Basic Callback version of toBlob function of HTMLCanvasElement Implemented Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 { 356 {
357 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 357 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
358 358
359 Vector<char> encodedImage; 359 Vector<char> encodedImage;
360 if (!encodeImage(*this, mimeType, quality, &encodedImage)) 360 if (!encodeImage(*this, mimeType, quality, &encodedImage))
361 return "data:,"; 361 return "data:,";
362 362
363 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); 363 return "data:" + mimeType + ";base64," + base64Encode(encodedImage);
364 } 364 }
365 365
366 bool ImageDataBuffer::toDataVector(const String& mimeType, const double* quality , Vector<char>& encodedDataVector) const
Justin Novosad 2015/08/13 21:03:40 This is just a dumb wrapper. You might as well jus
xlai (Olivia) 2015/08/20 19:46:44 Done.
367 {
368 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
369
370 return encodeImage(*this, mimeType, quality, &encodedDataVector);
371 }
372
366 } // namespace blink 373 } // namespace blink
OLDNEW
« Source/platform/graphics/ImageBuffer.h ('K') | « Source/platform/graphics/ImageBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698