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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1474513003: Upgrade PixelStorei to ES3/WebGL2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: client side Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index 3c910122869fceaa697e4caee925d4a34671c312..52ab7a8cdf423802205757b611cefb852b8f1224 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -4179,11 +4179,9 @@ void WebGLRenderingContextBase::texImage2DImpl(GLenum target, GLint level, GLenu
}
}
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ resetUnpackParameters();
texImage2DBase(target, level, internalformat, imageExtractor.imageWidth(), imageExtractor.imageHeight(), 0, format, type, needConversion ? data.data() : imagePixelData);
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
+ restoreUnpackParameters();
}
bool WebGLRenderingContextBase::validateTexFunc(const char* functionName, TexImageFunctionType functionType, TexFuncValidationSourceType sourceType, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint xoffset, GLint yoffset)
@@ -4302,10 +4300,10 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
changeUnpackAlignment = true;
}
if (changeUnpackAlignment)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ resetUnpackParameters();
texImage2DBase(target, level, internalformat, width, height, border, format, type, data);
if (changeUnpackAlignment)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
+ restoreUnpackParameters();
}
void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat,
@@ -4333,11 +4331,9 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
return;
}
}
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ resetUnpackParameters();
texImage2DBase(target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, needConversion ? data.data() : pixels->data()->data());
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
+ restoreUnpackParameters();
}
void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat,
@@ -4602,11 +4598,9 @@ void WebGLRenderingContextBase::texSubImage2DImpl(GLenum target, GLint level, GL
}
}
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ resetUnpackParameters();
webContext()->texSubImage2D(target, level, xoffset, yoffset, imageExtractor.imageWidth(), imageExtractor.imageHeight(), format, type, needConversion ? data.data() : imagePixelData);
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
+ restoreUnpackParameters();
}
void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
@@ -4627,10 +4621,10 @@ void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
changeUnpackAlignment = true;
}
if (changeUnpackAlignment)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ resetUnpackParameters();
webContext()->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, data);
if (changeUnpackAlignment)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
+ restoreUnpackParameters();
}
void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
@@ -4658,11 +4652,9 @@ void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
return;
}
}
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ resetUnpackParameters();
webContext()->texSubImage2D(target, level, xoffset, yoffset, pixels->width(), pixels->height(), format, type, needConversion ? data.data() : pixels->data()->data());
- if (m_unpackAlignment != 1)
- webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
+ restoreUnpackParameters();
}
void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
@@ -6934,4 +6926,16 @@ DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
return m_drawingBuffer.get();
}
+void WebGLRenderingContextBase::resetUnpackParameters()
+{
+ if (m_unpackAlignment != 1)
+ webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
+}
+
+void WebGLRenderingContextBase::restoreUnpackParameters()
+{
+ if (m_unpackAlignment != 1)
+ webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698