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

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

Issue 2482793005: Implement tex{Sub}Image3D taking sub-rectangles of HTMLImageElements. (Closed)
Patch Set: Early out in case of error. Roll WebGL conformance tests too. Created 4 years, 1 month 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
Index: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index b1cfe9ebbed5c87bc3ff8c02ebeb92e8b6e6bd5d..0d7f2fd898e4884bc7e0eb14432299276595b68a 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -1331,7 +1331,7 @@ void WebGL2RenderingContextBase::texImage2D(GLenum target,
texImageHelperHTMLImageElement(TexImage2D, target, level, internalformat,
format, type, 0, 0, 0, image, sourceImageRect,
- exceptionState);
+ 1, m_unpackImageHeight, exceptionState);
}
void WebGL2RenderingContextBase::texImage2D(GLenum target,
@@ -1484,8 +1484,8 @@ void WebGL2RenderingContextBase::texSubImage2D(GLenum target,
}
texImageHelperHTMLImageElement(TexSubImage2D, target, level, 0, format, type,
- xoffset, yoffset, 0, image, sourceImageRect,
- exceptionState);
+ xoffset, yoffset, 0, image, sourceImageRect, 1,
+ m_unpackImageHeight, exceptionState);
}
void WebGL2RenderingContextBase::texSubImage2D(GLenum target,
@@ -1701,7 +1701,15 @@ void WebGL2RenderingContextBase::texImage3D(GLenum target,
GLenum type,
HTMLImageElement* image,
ExceptionState& exceptionState) {
- // TODO(zmo): To be implemented.
+ IntRect sourceImageRect;
+ if (image) {
+ sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows));
+ sourceImageRect.setSize(IntSize(width, height));
+ }
+
+ texImageHelperHTMLImageElement(TexImage3D, target, level, internalformat,
+ format, type, 0, 0, 0, image, sourceImageRect,
+ depth, m_unpackImageHeight, exceptionState);
}
void WebGL2RenderingContextBase::texImage3D(GLenum target,
@@ -1821,7 +1829,15 @@ void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
GLenum type,
HTMLImageElement* image,
ExceptionState& exceptionState) {
- // TODO(zmo): To be implemented.
+ IntRect sourceImageRect;
+ if (image) {
+ sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows));
+ sourceImageRect.setSize(IntSize(width, height));
+ }
+
+ texImageHelperHTMLImageElement(
+ TexSubImage3D, target, level, 0, format, type, xoffset, yoffset, zoffset,
+ image, sourceImageRect, depth, m_unpackImageHeight, exceptionState);
}
void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
@@ -1888,20 +1904,6 @@ void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
GLint zoffset,
GLenum format,
GLenum type,
- HTMLImageElement* image,
- ExceptionState& exceptionState) {
- texImageHelperHTMLImageElement(TexSubImage3D, target, level, 0, format, type,
- xoffset, yoffset, zoffset, image,
- sentinelEmptyRect(), exceptionState);
-}
-
-void WebGL2RenderingContextBase::texSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLenum format,
- GLenum type,
HTMLCanvasElement* canvas,
ExceptionState& exceptionState) {
texImageHelperHTMLCanvasElement(TexSubImage3D, target, level, 0, format, type,

Powered by Google App Engine
This is Rietveld 408576698