Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 31 #include "core/imagebitmap/ImageBitmapFactories.h" | 31 #include "core/imagebitmap/ImageBitmapFactories.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "core/dom/DOMException.h" | 34 #include "core/dom/DOMException.h" |
| 35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
| 36 #include "core/fileapi/Blob.h" | 36 #include "core/fileapi/Blob.h" |
| 37 #include "core/frame/ImageBitmap.h" | 37 #include "core/frame/ImageBitmap.h" |
| 38 #include "core/frame/LocalDOMWindow.h" | 38 #include "core/frame/LocalDOMWindow.h" |
| 39 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" |
| 40 #include "core/html/Float32ImageData.h" | |
| 40 #include "core/html/HTMLCanvasElement.h" | 41 #include "core/html/HTMLCanvasElement.h" |
| 41 #include "core/html/HTMLImageElement.h" | 42 #include "core/html/HTMLImageElement.h" |
| 42 #include "core/html/HTMLVideoElement.h" | 43 #include "core/html/HTMLVideoElement.h" |
| 43 #include "core/html/ImageData.h" | 44 #include "core/html/ImageData.h" |
| 44 #include "core/imagebitmap/ImageBitmapOptions.h" | 45 #include "core/imagebitmap/ImageBitmapOptions.h" |
| 45 #include "core/offscreencanvas/OffscreenCanvas.h" | 46 #include "core/offscreencanvas/OffscreenCanvas.h" |
| 46 #include "core/svg/graphics/SVGImage.h" | 47 #include "core/svg/graphics/SVGImage.h" |
| 47 #include "core/workers/WorkerGlobalScope.h" | 48 #include "core/workers/WorkerGlobalScope.h" |
| 48 #include "platform/CrossThreadFunctional.h" | 49 #include "platform/CrossThreadFunctional.h" |
| 49 #include "platform/SharedBuffer.h" | 50 #include "platform/SharedBuffer.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 return imageElement; | 86 return imageElement; |
| 86 } | 87 } |
| 87 if (value.isHTMLVideoElement()) | 88 if (value.isHTMLVideoElement()) |
| 88 return value.getAsHTMLVideoElement(); | 89 return value.getAsHTMLVideoElement(); |
| 89 if (value.isHTMLCanvasElement()) | 90 if (value.isHTMLCanvasElement()) |
| 90 return value.getAsHTMLCanvasElement(); | 91 return value.getAsHTMLCanvasElement(); |
| 91 if (value.isBlob()) | 92 if (value.isBlob()) |
| 92 return value.getAsBlob(); | 93 return value.getAsBlob(); |
| 93 if (value.isImageData()) | 94 if (value.isImageData()) |
| 94 return value.getAsImageData(); | 95 return value.getAsImageData(); |
| 96 if (value.isFloat32ImageData()) { | |
| 97 if (RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() && | |
| 98 (RuntimeEnabledFeatures::trueColorRenderingEnabled() || | |
| 99 RuntimeEnabledFeatures::colorCorrectRenderingEnabled())) { | |
| 100 return value.getAsFloat32ImageData(); | |
| 101 } | |
| 102 exceptionState.throwDOMException( | |
|
Justin Novosad
2016/12/16 18:38:11
This should never be reached since the creation of
zakerinasab1
2016/12/19 19:57:39
Done.
| |
| 103 V8TypeError, | |
| 104 "Float32ImageData is still experimental. It needs one of " | |
| 105 "enable-color-correct-rendering or enable-true-color-rendering flags " | |
| 106 "besides enable-experimental-canvas-features flag to work."); | |
| 107 } | |
| 108 | |
| 95 if (value.isImageBitmap()) | 109 if (value.isImageBitmap()) |
| 96 return value.getAsImageBitmap(); | 110 return value.getAsImageBitmap(); |
| 97 if (value.isOffscreenCanvas()) | 111 if (value.isOffscreenCanvas()) |
| 98 return value.getAsOffscreenCanvas(); | 112 return value.getAsOffscreenCanvas(); |
| 99 ASSERT_NOT_REACHED(); | 113 ASSERT_NOT_REACHED(); |
| 100 return nullptr; | 114 return nullptr; |
| 101 } | 115 } |
| 102 | 116 |
| 103 ScriptPromise ImageBitmapFactories::createImageBitmapFromBlob( | 117 ScriptPromise ImageBitmapFactories::createImageBitmapFromBlob( |
| 104 ScriptState* scriptState, | 118 ScriptState* scriptState, |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 } | 335 } |
| 322 m_factory->didFinishLoading(this); | 336 m_factory->didFinishLoading(this); |
| 323 } | 337 } |
| 324 | 338 |
| 325 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { | 339 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { |
| 326 visitor->trace(m_factory); | 340 visitor->trace(m_factory); |
| 327 visitor->trace(m_resolver); | 341 visitor->trace(m_resolver); |
| 328 } | 342 } |
| 329 | 343 |
| 330 } // namespace blink | 344 } // namespace blink |
| OLD | NEW |