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

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

Issue 2025703002: Pack repeated code in tex(Sub)Image2D and texSubImage3D into helper func (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass enum instead of const char*, use a wrapper for validate2D(3D)Binding Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
index f6738b88b58248e6ae101cf6b1e65dac499bdb38..415275a6e49fd79d9e7b8e165d2f25fcd70b18e3 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -780,6 +780,12 @@ protected:
CopyTexImage,
CompressedTexImage
};
+ enum TexImageFunctionName {
+ TexImage2D,
+ TexSubImage2D,
+ TexImage3D,
+ TexSubImage3D
+ };
enum TexImageByGPUType {
TexImage2DByGPU,
TexSubImage2DByGPU,
@@ -819,6 +825,9 @@ protected:
// null. Otherwise, return the texture bound to the target.
WebGLTexture* validateTextureBinding(const char* functionName, GLenum target);
+ // Wrapper function for validateTexture2D(3D)Binding, used in texImageHelper functions.
+ virtual WebGLTexture* validateTexImageBinding(const char*, TexImageFunctionName, GLenum);
+
// Helper function to check texture 2D target and texture bound to the target.
// Generate GL errors and return 0 if target is invalid or texture bound is
// null. Otherwise, return the texture bound to the target.
@@ -1088,6 +1097,16 @@ protected:
CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakThisPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase>(this); }
ImageBitmap* transferToImageBitmapBase();
+
+ // Helper functions for tex(Sub)Image2D && texSubImage3D
+ void texImageHelperDOMArrayBufferView(TexImageFunctionName, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMArrayBufferView*);
+ void texImageHelperImageData(TexImageFunctionName, GLenum, GLint, GLint, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*);
+ bool texImageHelperHTMLImageElement(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&);
+ WebGLTexture* texImageHelperHTMLCanvasElement(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&);
+ WebGLTexture* texImageHelperHTMLVideoElement(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&);
+ void texImageHelperImageBitmap(TexImageFunctionName, GLenum, GLint, GLint, GLenum, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&);
+ static const char* getTexImageFunctionName(TexImageFunctionName);
+
private:
WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&);
static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned);

Powered by Google App Engine
This is Rietveld 408576698