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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 837643002: Remove Uint8ClampedArray use from ImageBuffer.h ImageDataBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | Source/platform/graphics/ImageBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
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 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 String HTMLCanvasElement::toDataURLInternal(const String& mimeType, const double * quality, SourceDrawingBuffer sourceBuffer) const 462 String HTMLCanvasElement::toDataURLInternal(const String& mimeType, const double * quality, SourceDrawingBuffer sourceBuffer) const
463 { 463 {
464 if (!isPaintable()) 464 if (!isPaintable())
465 return String("data:,"); 465 return String("data:,");
466 466
467 String encodingMimeType = toEncodingMimeType(mimeType); 467 String encodingMimeType = toEncodingMimeType(mimeType);
468 if (!m_context) { 468 if (!m_context) {
469 RefPtrWillBeRawPtr<ImageData> imageData = ImageData::create(m_size); 469 RefPtrWillBeRawPtr<ImageData> imageData = ImageData::create(m_size);
470 return ImageDataToDataURL(ImageDataBuffer(imageData->size(), imageData-> data()), encodingMimeType, quality); 470 return ImageDataBuffer(imageData->size(), imageData->data()->data()).toD ataURL(encodingMimeType, quality);
471 } 471 }
472 472
473 if (m_context->is3d()) { 473 if (m_context->is3d()) {
474 // Get non-premultiplied data because of inaccurate premultiplied alpha conversion of buffer()->toDataURL(). 474 // Get non-premultiplied data because of inaccurate premultiplied alpha conversion of buffer()->toDataURL().
475 RefPtrWillBeRawPtr<ImageData> imageData = 475 RefPtrWillBeRawPtr<ImageData> imageData =
476 toWebGLRenderingContext(m_context.get())->paintRenderingResultsToIma geData(sourceBuffer); 476 toWebGLRenderingContext(m_context.get())->paintRenderingResultsToIma geData(sourceBuffer);
477 if (imageData) 477 if (imageData)
478 return ImageDataToDataURL(ImageDataBuffer(imageData->size(), imageDa ta->data()), encodingMimeType, quality); 478 return ImageDataBuffer(imageData->size(), imageData->data()->data()) .toDataURL(encodingMimeType, quality);
479 m_context->paintRenderingResultsToCanvas(sourceBuffer); 479 m_context->paintRenderingResultsToCanvas(sourceBuffer);
480 } 480 }
481 481
482 return buffer()->toDataURL(encodingMimeType, quality); 482 return buffer()->toDataURL(encodingMimeType, quality);
483 } 483 }
484 484
485 String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit y, ExceptionState& exceptionState) const 485 String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit y, ExceptionState& exceptionState) const
486 { 486 {
487 if (!m_originClean) { 487 if (!m_originClean) {
488 exceptionState.throwSecurityError("Tainted canvases may not be exported. "); 488 exceptionState.throwSecurityError("Tainted canvases may not be exported. ");
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 { 843 {
844 return !originClean(); 844 return !originClean();
845 } 845 }
846 846
847 FloatSize HTMLCanvasElement::sourceSize() const 847 FloatSize HTMLCanvasElement::sourceSize() const
848 { 848 {
849 return FloatSize(width(), height()); 849 return FloatSize(width(), height());
850 } 850 }
851 851
852 } 852 }
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/ImageBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698