Index: Source/core/html/HTMLCanvasElement.cpp |
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp |
index a6b3d958f42631f5ebcfa7fbb1413c2180284ed3..a41bd5beb6c08ff3077a3349eed785e68b5293e3 100644 |
--- a/Source/core/html/HTMLCanvasElement.cpp |
+++ b/Source/core/html/HTMLCanvasElement.cpp |
@@ -463,43 +463,28 @@ |
return AtomicString(toDataURLInternal("image/png", 0, FrontBuffer)); |
} |
-ImageData* HTMLCanvasElement::toImageData(SourceDrawingBuffer sourceBuffer) const |
-{ |
- ImageData* imageData; |
- if (is3D()) { |
- // Get non-premultiplied data because of inaccurate premultiplied alpha conversion of buffer()->toDataURL(). |
- imageData = m_context->paintRenderingResultsToImageData(sourceBuffer); |
- if (imageData) |
- return imageData; |
- |
- m_context->paintRenderingResultsToCanvas(sourceBuffer); |
- imageData = ImageData::create(m_size); |
- SkImageInfo imageInfo = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, kUnpremul_SkAlphaType); |
- buffer()->bitmap().readPixels(imageInfo, imageData->data()->data(), imageInfo.minRowBytes(), 0, 0); |
- return imageData; |
- } |
- |
- imageData = ImageData::create(m_size); |
- |
- if (m_context) { |
- ASSERT(m_context->is2d()); |
- SkImageInfo imageInfo = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, kUnpremul_SkAlphaType); |
- buffer()->bitmap().readPixels(imageInfo, imageData->data()->data(), imageInfo.minRowBytes(), 0, 0); |
- } |
- return imageData; |
-} |
- |
String HTMLCanvasElement::toDataURLInternal(const String& mimeType, const double* quality, SourceDrawingBuffer sourceBuffer) const |
{ |
if (!isPaintable()) |
return String("data:,"); |
String encodingMimeType = toEncodingMimeType(mimeType); |
- |
- ImageData* imageData = toImageData(sourceBuffer); |
- ScopedDisposal<ImageData> disposer(imageData); |
- |
- return ImageDataBuffer(imageData->size(), imageData->data()->data()).toDataURL(encodingMimeType, quality); |
+ if (!m_context) { |
+ ImageData* imageData = ImageData::create(m_size); |
+ ScopedDisposal<ImageData> disposer(imageData); |
+ return ImageDataBuffer(imageData->size(), imageData->data()->data()).toDataURL(encodingMimeType, quality); |
+ } |
+ |
+ if (m_context->is3d()) { |
+ // Get non-premultiplied data because of inaccurate premultiplied alpha conversion of buffer()->toDataURL(). |
+ ImageData* imageData = m_context->paintRenderingResultsToImageData(sourceBuffer); |
+ ScopedDisposal<ImageData> disposer(imageData); |
+ if (imageData) |
+ return ImageDataBuffer(imageData->size(), imageData->data()->data()).toDataURL(encodingMimeType, quality); |
+ m_context->paintRenderingResultsToCanvas(sourceBuffer); |
+ } |
+ |
+ return buffer()->toDataURL(encodingMimeType, quality); |
} |
String HTMLCanvasElement::toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState& exceptionState) const |