OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 } | 779 } |
780 | 780 |
781 void DrawingBuffer::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer) | 781 void DrawingBuffer::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer) |
782 { | 782 { |
783 paintFramebufferToCanvas(framebuffer(), size().width(), size().height(), !m_
attributes.premultipliedAlpha, imageBuffer); | 783 paintFramebufferToCanvas(framebuffer(), size().width(), size().height(), !m_
attributes.premultipliedAlpha, imageBuffer); |
784 } | 784 } |
785 | 785 |
786 PassRefPtr<Uint8ClampedArray> DrawingBuffer::paintRenderingResultsToImageData(in
t& width, int& height) | 786 PassRefPtr<Uint8ClampedArray> DrawingBuffer::paintRenderingResultsToImageData(in
t& width, int& height) |
787 { | 787 { |
788 if (m_attributes.premultipliedAlpha) | 788 if (m_attributes.premultipliedAlpha) |
789 return 0; | 789 return nullptr; |
790 | 790 |
791 width = size().width(); | 791 width = size().width(); |
792 height = size().height(); | 792 height = size().height(); |
793 | 793 |
794 Checked<int, RecordOverflow> dataSize = 4; | 794 Checked<int, RecordOverflow> dataSize = 4; |
795 dataSize *= width; | 795 dataSize *= width; |
796 dataSize *= height; | 796 dataSize *= height; |
797 if (dataSize.hasOverflowed()) | 797 if (dataSize.hasOverflowed()) |
798 return 0; | 798 return nullptr; |
799 | 799 |
800 RefPtr<Uint8ClampedArray> pixels = Uint8ClampedArray::createUninitialized(wi
dth * height * 4); | 800 RefPtr<Uint8ClampedArray> pixels = Uint8ClampedArray::createUninitialized(wi
dth * height * 4); |
801 | 801 |
802 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); | 802 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); |
803 readBackFramebuffer(pixels->data(), width, height, ReadbackRGBA, WebGLImageC
onversion::AlphaDoNothing); | 803 readBackFramebuffer(pixels->data(), width, height, ReadbackRGBA, WebGLImageC
onversion::AlphaDoNothing); |
804 flipVertically(pixels->data(), width, height); | 804 flipVertically(pixels->data(), width, height); |
805 | 805 |
806 return pixels.release(); | 806 return pixels.release(); |
807 } | 807 } |
808 | 808 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 } | 894 } |
895 } | 895 } |
896 | 896 |
897 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in
ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum
type, GLint unpackAlignment) | 897 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in
ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum
type, GLint unpackAlignment) |
898 { | 898 { |
899 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4
|| unpackAlignment == 8); | 899 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4
|| unpackAlignment == 8); |
900 m_context->texImage2D(target, level, internalformat, width, height, border,
format, type, 0); | 900 m_context->texImage2D(target, level, internalformat, width, height, border,
format, type, 0); |
901 } | 901 } |
902 | 902 |
903 } // namespace WebCore | 903 } // namespace WebCore |
OLD | NEW |