| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2009 Apple Inc. All rights reserved. |     2  * Copyright (C) 2009 Apple 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 |     5  * modification, are permitted provided that the following conditions | 
|     6  * are met: |     6  * are met: | 
|     7  * 1. Redistributions of source code must retain the above copyright |     7  * 1. Redistributions of source code must retain the above copyright | 
|     8  *    notice, this list of conditions and the following disclaimer. |     8  *    notice, this list of conditions and the following disclaimer. | 
|     9  * 2. Redistributions in binary form must reproduce the above copyright |     9  * 2. Redistributions in binary form must reproduce the above copyright | 
|    10  *    notice, this list of conditions and the following disclaimer in the |    10  *    notice, this list of conditions and the following disclaimer in the | 
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   643     shouldFailContextCreationForTesting = true; |   643     shouldFailContextCreationForTesting = true; | 
|   644 } |   644 } | 
|   645  |   645  | 
|   646 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() |   646 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() | 
|   647 { |   647 { | 
|   648     if (!drawingBuffer()) |   648     if (!drawingBuffer()) | 
|   649         return nullptr; |   649         return nullptr; | 
|   650     return ImageBitmap::create(drawingBuffer()->transferToStaticBitmapImage()); |   650     return ImageBitmap::create(drawingBuffer()->transferToStaticBitmapImage()); | 
|   651 } |   651 } | 
|   652  |   652  | 
 |   653 void WebGLRenderingContextBase::commit(ExceptionState& exceptionState) | 
 |   654 { | 
 |   655     if (!getOffscreenCanvas()) { | 
 |   656         exceptionState.throwDOMException(InvalidStateError, "Commit() was called
       on a rendering context that was not created from an OffscreenCanvas."); | 
 |   657         return; | 
 |   658     } | 
 |   659     // no HTMLCanvas associated, thrown InvalidStateError | 
 |   660     if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) { | 
 |   661         exceptionState.throwDOMException(InvalidStateError, "Commit() was called
       on a context whose OffscreenCanvas is not associated with a canvas element."); | 
 |   662         return; | 
 |   663     } | 
 |   664     if (!drawingBuffer()) | 
 |   665         return; | 
 |   666     // TODO(crbug.com/646864): Make commit() work correctly with { preserveDrawi
      ngBuffer : true }. | 
 |   667     getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame(std::move(
      drawingBuffer()->transferToStaticBitmapImage())); | 
 |   668 } | 
 |   669  | 
|   653 PassRefPtr<Image> WebGLRenderingContextBase::getImage(AccelerationHint hint, Sna
      pshotReason reason) const |   670 PassRefPtr<Image> WebGLRenderingContextBase::getImage(AccelerationHint hint, Sna
      pshotReason reason) const | 
|   654 { |   671 { | 
|   655     if (!drawingBuffer()) |   672     if (!drawingBuffer()) | 
|   656         return nullptr; |   673         return nullptr; | 
|   657  |   674  | 
|   658     drawingBuffer()->commit(); |   675     drawingBuffer()->commit(); | 
|   659     IntSize size = clampedCanvasSize(); |   676     IntSize size = clampedCanvasSize(); | 
|   660     OpacityMode opacityMode = creationAttributes().hasAlpha() ? NonOpaque : Opaq
      ue; |   677     OpacityMode opacityMode = creationAttributes().hasAlpha() ? NonOpaque : Opaq
      ue; | 
|   661     std::unique_ptr<AcceleratedImageBufferSurface> surface = wrapUnique(new Acce
      leratedImageBufferSurface(size, opacityMode)); |   678     std::unique_ptr<AcceleratedImageBufferSurface> surface = wrapUnique(new Acce
      leratedImageBufferSurface(size, opacityMode)); | 
|   662     if (!surface->isValid()) |   679     if (!surface->isValid()) | 
| (...skipping 5792 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6455  |  6472  | 
|  6456 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
      creenCanvas& result) const |  6473 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
      creenCanvas& result) const | 
|  6457 { |  6474 { | 
|  6458     if (canvas()) |  6475     if (canvas()) | 
|  6459         result.setHTMLCanvasElement(canvas()); |  6476         result.setHTMLCanvasElement(canvas()); | 
|  6460     else |  6477     else | 
|  6461         result.setOffscreenCanvas(getOffscreenCanvas()); |  6478         result.setOffscreenCanvas(getOffscreenCanvas()); | 
|  6462 } |  6479 } | 
|  6463  |  6480  | 
|  6464 } // namespace blink |  6481 } // namespace blink | 
| OLD | NEW |