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

Side by Side Diff: Source/WebCore/html/canvas/WebGLRenderingContext.cpp

Issue 10441002: Merge 117918 - Must set/reset pixel unpack alignment to 1 during texSubImage2D (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-rgba5551-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3708 matching lines...) Expand 10 before | Expand all | Expand 10 after
3719 Image* image, bool flipY, bool pre multiplyAlpha, ExceptionCode& ec) 3719 Image* image, bool flipY, bool pre multiplyAlpha, ExceptionCode& ec)
3720 { 3720 {
3721 ec = 0; 3721 ec = 0;
3722 if (isContextLost()) 3722 if (isContextLost())
3723 return; 3723 return;
3724 Vector<uint8_t> data; 3724 Vector<uint8_t> data;
3725 if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlph a, m_unpackColorspaceConversion == GraphicsContext3D::NONE, data)) { 3725 if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlph a, m_unpackColorspaceConversion == GraphicsContext3D::NONE, data)) {
3726 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "ba d image"); 3726 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "ba d image");
3727 return; 3727 return;
3728 } 3728 }
3729 if (m_unpackAlignment != 1)
3730 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3729 texSubImage2DBase(target, level, xoffset, yoffset, image->width(), image->he ight(), 3731 texSubImage2DBase(target, level, xoffset, yoffset, image->width(), image->he ight(),
3730 format, type, data.data(), ec); 3732 format, type, data.data(), ec);
3733 if (m_unpackAlignment != 1)
3734 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlig nment);
3731 } 3735 }
3732 3736
3733 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din t xoffset, GC3Dint yoffset, 3737 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din t xoffset, GC3Dint yoffset,
3734 GC3Dsizei width, GC3Dsizei height, 3738 GC3Dsizei width, GC3Dsizei height,
3735 GC3Denum format, GC3Denum type, ArrayB ufferView* pixels, ExceptionCode& ec) 3739 GC3Denum format, GC3Denum type, ArrayB ufferView* pixels, ExceptionCode& ec)
3736 { 3740 {
3737 if (isContextLost() || !validateTexFuncData("texSubImage2D", width, height, format, type, pixels, NullNotAllowed)) 3741 if (isContextLost() || !validateTexFuncData("texSubImage2D", width, height, format, type, pixels, NullNotAllowed))
3738 return; 3742 return;
3739 void* data = pixels->baseAddress(); 3743 void* data = pixels->baseAddress();
3740 Vector<uint8_t> tempData; 3744 Vector<uint8_t> tempData;
(...skipping 19 matching lines...) Expand all
3760 GC3Denum format, GC3Denum type, ImageD ata* pixels, ExceptionCode& ec) 3764 GC3Denum format, GC3Denum type, ImageD ata* pixels, ExceptionCode& ec)
3761 { 3765 {
3762 ec = 0; 3766 ec = 0;
3763 if (isContextLost()) 3767 if (isContextLost())
3764 return; 3768 return;
3765 Vector<uint8_t> data; 3769 Vector<uint8_t> data;
3766 if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpa ckPremultiplyAlpha, data)) { 3770 if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpa ckPremultiplyAlpha, data)) {
3767 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "ba d image data"); 3771 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "ba d image data");
3768 return; 3772 return;
3769 } 3773 }
3774 if (m_unpackAlignment != 1)
3775 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
3770 texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels-> height(), 3776 texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels-> height(),
3771 format, type, data.data(), ec); 3777 format, type, data.data(), ec);
3778 if (m_unpackAlignment != 1)
3779 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlig nment);
3772 } 3780 }
3773 3781
3774 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din t xoffset, GC3Dint yoffset, 3782 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din t xoffset, GC3Dint yoffset,
3775 GC3Denum format, GC3Denum type, HTMLIm ageElement* image, ExceptionCode& ec) 3783 GC3Denum format, GC3Denum type, HTMLIm ageElement* image, ExceptionCode& ec)
3776 { 3784 {
3777 ec = 0; 3785 ec = 0;
3778 if (isContextLost()) 3786 if (isContextLost())
3779 return; 3787 return;
3780 if (!validateHTMLImageElement("texSubImage2D", image)) 3788 if (!validateHTMLImageElement("texSubImage2D", image))
3781 return; 3789 return;
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
5550 { 5558 {
5551 if (enable) 5559 if (enable)
5552 m_context->enable(capability); 5560 m_context->enable(capability);
5553 else 5561 else
5554 m_context->disable(capability); 5562 m_context->disable(capability);
5555 } 5563 }
5556 5564
5557 } // namespace WebCore 5565 } // namespace WebCore
5558 5566
5559 #endif // ENABLE(WEBGL) 5567 #endif // ENABLE(WEBGL)
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-rgba5551-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698