Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 return AtomicString(toDataURLInternal("image/png", 0, FrontBuffer)); | 477 return AtomicString(toDataURLInternal("image/png", 0, FrontBuffer)); |
| 478 } | 478 } |
| 479 | 479 |
| 480 String HTMLCanvasElement::toDataURLInternal(const String& mimeType, const double * quality, SourceDrawingBuffer sourceBuffer) const | 480 String HTMLCanvasElement::toDataURLInternal(const String& mimeType, const double * quality, SourceDrawingBuffer sourceBuffer) const |
| 481 { | 481 { |
| 482 if (!isPaintable()) | 482 if (!isPaintable()) |
| 483 return String("data:,"); | 483 return String("data:,"); |
| 484 | 484 |
| 485 String encodingMimeType = toEncodingMimeType(mimeType); | 485 String encodingMimeType = toEncodingMimeType(mimeType); |
| 486 if (!m_context) { | 486 if (!m_context) { |
| 487 RefPtrWillBeRawPtr<ImageData> imageData = ImageData::create(m_size); | 487 ImageData* imageData = ImageData::create(m_size); |
|
Justin Novosad
2015/05/06 20:14:03
In this case the image data is just a temporary lo
| |
| 488 return ImageDataBuffer(imageData->size(), imageData->data()->data()).toD ataURL(encodingMimeType, quality); | 488 return ImageDataBuffer(imageData->size(), imageData->data()->data()).toD ataURL(encodingMimeType, quality); |
| 489 } | 489 } |
| 490 | 490 |
| 491 if (m_context->is3d()) { | 491 if (m_context->is3d()) { |
| 492 // Get non-premultiplied data because of inaccurate premultiplied alpha conversion of buffer()->toDataURL(). | 492 // Get non-premultiplied data because of inaccurate premultiplied alpha conversion of buffer()->toDataURL(). |
| 493 RefPtrWillBeRawPtr<ImageData> imageData = | 493 ImageData* imageData = toWebGLRenderingContextBase(m_context.get())->pai ntRenderingResultsToImageData(sourceBuffer); |
|
Justin Novosad
2015/05/06 20:14:03
same here
| |
| 494 toWebGLRenderingContextBase(m_context.get())->paintRenderingResultsT oImageData(sourceBuffer); | |
| 495 if (imageData) | 494 if (imageData) |
| 496 return ImageDataBuffer(imageData->size(), imageData->data()->data()) .toDataURL(encodingMimeType, quality); | 495 return ImageDataBuffer(imageData->size(), imageData->data()->data()) .toDataURL(encodingMimeType, quality); |
| 497 m_context->paintRenderingResultsToCanvas(sourceBuffer); | 496 m_context->paintRenderingResultsToCanvas(sourceBuffer); |
| 498 } | 497 } |
| 499 | 498 |
| 500 return buffer()->toDataURL(encodingMimeType, quality); | 499 return buffer()->toDataURL(encodingMimeType, quality); |
| 501 } | 500 } |
| 502 | 501 |
| 503 String HTMLCanvasElement::toDataURL(const String& mimeType, const ScriptValue& q ualityArgument, ExceptionState& exceptionState) const | 502 String HTMLCanvasElement::toDataURL(const String& mimeType, const ScriptValue& q ualityArgument, ExceptionState& exceptionState) const |
| 504 { | 503 { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 877 { | 876 { |
| 878 return FloatSize(width(), height()); | 877 return FloatSize(width(), height()); |
| 879 } | 878 } |
| 880 | 879 |
| 881 bool HTMLCanvasElement::isOpaque() const | 880 bool HTMLCanvasElement::isOpaque() const |
| 882 { | 881 { |
| 883 return m_context && !m_context->hasAlpha(); | 882 return m_context && !m_context->hasAlpha(); |
| 884 } | 883 } |
| 885 | 884 |
| 886 } // blink | 885 } // blink |
| OLD | NEW |