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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 shouldFailContextCreationForTesting = true; | 642 shouldFailContextCreationForTesting = true; |
643 } | 643 } |
644 | 644 |
645 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() | 645 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() |
646 { | 646 { |
647 if (!drawingBuffer()) | 647 if (!drawingBuffer()) |
648 return nullptr; | 648 return nullptr; |
649 return ImageBitmap::create(drawingBuffer()->transferToStaticBitmapImage()); | 649 return ImageBitmap::create(drawingBuffer()->transferToStaticBitmapImage()); |
650 } | 650 } |
651 | 651 |
652 PassRefPtr<Image> WebGLRenderingContextBase::getImage(SnapshotReason reason) con
st | 652 PassRefPtr<Image> WebGLRenderingContextBase::getImage(AccelerationHint hint, Sna
pshotReason reason) const |
653 { | 653 { |
654 if (!drawingBuffer()) | 654 if (!drawingBuffer()) |
655 return nullptr; | 655 return nullptr; |
656 | 656 |
657 drawingBuffer()->commit(); | 657 drawingBuffer()->commit(); |
658 IntSize size = clampedCanvasSize(); | 658 IntSize size = clampedCanvasSize(); |
659 OpacityMode opacityMode = creationAttributes().hasAlpha() ? NonOpaque : Opaq
ue; | 659 OpacityMode opacityMode = creationAttributes().hasAlpha() ? NonOpaque : Opaq
ue; |
660 std::unique_ptr<AcceleratedImageBufferSurface> surface = wrapUnique(new Acce
leratedImageBufferSurface(size, opacityMode)); | 660 std::unique_ptr<AcceleratedImageBufferSurface> surface = wrapUnique(new Acce
leratedImageBufferSurface(size, opacityMode)); |
661 if (!surface->isValid()) | 661 if (!surface->isValid()) |
662 return nullptr; | 662 return nullptr; |
663 std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(std::move(surface)
); | 663 std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(std::move(surface)
); |
664 if (!buffer->copyRenderingResultsFromDrawingBuffer(drawingBuffer(), BackBuff
er)) { | 664 if (!buffer->copyRenderingResultsFromDrawingBuffer(drawingBuffer(), BackBuff
er)) { |
665 // copyRenderingResultsFromDrawingBuffer is expected to always succeed b
ecause we've | 665 // copyRenderingResultsFromDrawingBuffer is expected to always succeed b
ecause we've |
666 // explicitly created an Accelerated surface and have already validated
it. | 666 // explicitly created an Accelerated surface and have already validated
it. |
667 NOTREACHED(); | 667 NOTREACHED(); |
668 return nullptr; | 668 return nullptr; |
669 } | 669 } |
670 return buffer->newImageSnapshot(PreferAcceleration, reason); | 670 return buffer->newImageSnapshot(hint, reason); |
671 } | 671 } |
672 | 672 |
673 namespace { | 673 namespace { |
674 | 674 |
675 // ES2 enums | 675 // ES2 enums |
676 static const GLenum kSupportedInternalFormatsES2[] = { | 676 static const GLenum kSupportedInternalFormatsES2[] = { |
677 GL_RGB, | 677 GL_RGB, |
678 GL_RGBA, | 678 GL_RGBA, |
679 GL_LUMINANCE_ALPHA, | 679 GL_LUMINANCE_ALPHA, |
680 GL_LUMINANCE, | 680 GL_LUMINANCE, |
(...skipping 5756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6437 | 6437 |
6438 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const | 6438 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const |
6439 { | 6439 { |
6440 if (canvas()) | 6440 if (canvas()) |
6441 result.setHTMLCanvasElement(canvas()); | 6441 result.setHTMLCanvasElement(canvas()); |
6442 else | 6442 else |
6443 result.setOffscreenCanvas(getOffscreenCanvas()); | 6443 result.setOffscreenCanvas(getOffscreenCanvas()); |
6444 } | 6444 } |
6445 | 6445 |
6446 } // namespace blink | 6446 } // namespace blink |
OLD | NEW |