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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2359723003: Implement OffscreenCanvas Accelerated 2D commit() (Closed)
Patch Set: Temporary code for Unaccelerated case Created 4 years, 2 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
OLDNEW
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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return; 658 return;
659 } 659 }
660 // no HTMLCanvas associated, thrown InvalidStateError 660 // no HTMLCanvas associated, thrown InvalidStateError
661 if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) { 661 if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) {
662 exceptionState.throwDOMException(InvalidStateError, "Commit() was called on a context whose OffscreenCanvas is not associated with a canvas element."); 662 exceptionState.throwDOMException(InvalidStateError, "Commit() was called on a context whose OffscreenCanvas is not associated with a canvas element.");
663 return; 663 return;
664 } 664 }
665 if (!drawingBuffer()) 665 if (!drawingBuffer())
666 return; 666 return;
667 // TODO(crbug.com/646864): Make commit() work correctly with { preserveDrawi ngBuffer : true }. 667 // TODO(crbug.com/646864): Make commit() work correctly with { preserveDrawi ngBuffer : true }.
668 getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame(std::move( drawingBuffer()->transferToStaticBitmapImage())); 668 getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame(std::move( drawingBuffer()->transferToStaticBitmapImage()), this->isAccelerated());
xlai (Olivia) 2016/09/22 16:12:24 In WebGL, this->isAccelerated() is confirmed to re
669 } 669 }
670 670
671 PassRefPtr<Image> WebGLRenderingContextBase::getImage(AccelerationHint hint, Sna pshotReason reason) const 671 PassRefPtr<Image> WebGLRenderingContextBase::getImage(AccelerationHint hint, Sna pshotReason reason) const
672 { 672 {
673 if (!drawingBuffer()) 673 if (!drawingBuffer())
674 return nullptr; 674 return nullptr;
675 675
676 drawingBuffer()->commit(); 676 drawingBuffer()->commit();
677 IntSize size = clampedCanvasSize(); 677 IntSize size = clampedCanvasSize();
678 OpacityMode opacityMode = creationAttributes().hasAlpha() ? NonOpaque : Opaq ue; 678 OpacityMode opacityMode = creationAttributes().hasAlpha() ? NonOpaque : Opaq ue;
(...skipping 5794 matching lines...) Expand 10 before | Expand all | Expand 10 after
6473 6473
6474 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const 6474 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const
6475 { 6475 {
6476 if (canvas()) 6476 if (canvas())
6477 result.setHTMLCanvasElement(canvas()); 6477 result.setHTMLCanvasElement(canvas());
6478 else 6478 else
6479 result.setOffscreenCanvas(getOffscreenCanvas()); 6479 result.setOffscreenCanvas(getOffscreenCanvas());
6480 } 6480 }
6481 6481
6482 } // namespace blink 6482 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698