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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 2212163002: Add some plumbing for the color management of canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webgl/WebGL2RenderingContextBase.h" 5 #include "modules/webgl/WebGL2RenderingContextBase.h"
6 6
7 #include "bindings/modules/v8/WebGLAny.h" 7 #include "bindings/modules/v8/WebGLAny.h"
8 #include "core/frame/ImageBitmap.h" 8 #include "core/frame/ImageBitmap.h"
9 #include "core/html/HTMLCanvasElement.h" 9 #include "core/html/HTMLCanvasElement.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 GL_COMPRESSED_RG11_EAC, 163 GL_COMPRESSED_RG11_EAC,
164 GL_COMPRESSED_SIGNED_RG11_EAC, 164 GL_COMPRESSED_SIGNED_RG11_EAC,
165 GL_COMPRESSED_RGB8_ETC2, 165 GL_COMPRESSED_RGB8_ETC2,
166 GL_COMPRESSED_SRGB8_ETC2, 166 GL_COMPRESSED_SRGB8_ETC2,
167 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 167 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
168 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 168 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
169 GL_COMPRESSED_RGBA8_ETC2_EAC, 169 GL_COMPRESSED_RGBA8_ETC2_EAC,
170 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 170 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
171 }; 171 };
172 172
173 WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed Canvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const Web GLContextAttributes& requestedAttributes) 173 WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed Canvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const Can vasContextCreationAttributes& requestedAttributes)
174 : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), reques tedAttributes, 2) 174 : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), reques tedAttributes, 2)
175 { 175 {
176 m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, k SupportedInternalFormatsStorage + WTF_ARRAY_LENGTH(kSupportedInternalFormatsStor age)); 176 m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, k SupportedInternalFormatsStorage + WTF_ARRAY_LENGTH(kSupportedInternalFormatsStor age));
177 m_supportedInternalFormatsStorage.insert(kCompressedTextureFormatsETC2EAC, k CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2 EAC)); 177 m_supportedInternalFormatsStorage.insert(kCompressedTextureFormatsETC2EAC, k CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2 EAC));
178 m_compressedTextureFormatsETC2EAC.insert(kCompressedTextureFormatsETC2EAC, k CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2 EAC)); 178 m_compressedTextureFormatsETC2EAC.insert(kCompressedTextureFormatsETC2EAC, k CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2 EAC));
179 m_compressedTextureFormats.append(kCompressedTextureFormatsETC2EAC, WTF_ARRA Y_LENGTH(kCompressedTextureFormatsETC2EAC)); 179 m_compressedTextureFormats.append(kCompressedTextureFormatsETC2EAC, WTF_ARRA Y_LENGTH(kCompressedTextureFormatsETC2EAC));
180 } 180 }
181 181
182 WebGL2RenderingContextBase::~WebGL2RenderingContextBase() 182 WebGL2RenderingContextBase::~WebGL2RenderingContextBase()
183 { 183 {
(...skipping 2997 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 { 3181 {
3182 const char kFunctionName[] = "getFramebufferAttachmentParameter"; 3182 const char kFunctionName[] = "getFramebufferAttachmentParameter";
3183 if (isContextLost() || !validateGetFramebufferAttachmentParameterFunc(kFunct ionName, target, attachment)) 3183 if (isContextLost() || !validateGetFramebufferAttachmentParameterFunc(kFunct ionName, target, attachment))
3184 return ScriptValue::createNull(scriptState); 3184 return ScriptValue::createNull(scriptState);
3185 3185
3186 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); 3186 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
3187 ASSERT(!framebufferBinding || framebufferBinding->object()); 3187 ASSERT(!framebufferBinding || framebufferBinding->object());
3188 3188
3189 // Default framebuffer (an internal fbo) 3189 // Default framebuffer (an internal fbo)
3190 if (!framebufferBinding) { 3190 if (!framebufferBinding) {
3191 // We can use m_requestedAttribs because in WebGL 2, they are required t o be honored. 3191 // We can use creationAttributes() because in WebGL 2, they are required to be honored.
3192 bool hasDepth = m_requestedAttributes.depth(); 3192 bool hasDepth = creationAttributes().depth();
3193 bool hasStencil = m_requestedAttributes.stencil(); 3193 bool hasStencil = creationAttributes().stencil();
3194 bool hasAlpha = m_requestedAttributes.alpha(); 3194 bool hasAlpha = creationAttributes().alpha();
3195 bool missingImage = (attachment == GL_DEPTH && !hasDepth) 3195 bool missingImage = (attachment == GL_DEPTH && !hasDepth)
3196 || (attachment == GL_STENCIL && !hasStencil); 3196 || (attachment == GL_STENCIL && !hasStencil);
3197 if (missingImage) { 3197 if (missingImage) {
3198 switch (pname) { 3198 switch (pname) {
3199 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 3199 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
3200 return WebGLAny(scriptState, GL_NONE); 3200 return WebGLAny(scriptState, GL_NONE);
3201 default: 3201 default:
3202 synthesizeGLError(GL_INVALID_OPERATION, kFunctionName, "invalid parameter name"); 3202 synthesizeGLError(GL_INVALID_OPERATION, kFunctionName, "invalid parameter name");
3203 return ScriptValue::createNull(scriptState); 3203 return ScriptValue::createNull(scriptState);
3204 } 3204 }
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 params.skipPixels = m_unpackSkipPixels; 3492 params.skipPixels = m_unpackSkipPixels;
3493 params.skipRows = m_unpackSkipRows; 3493 params.skipRows = m_unpackSkipRows;
3494 if (dimension == Tex3D) { 3494 if (dimension == Tex3D) {
3495 params.imageHeight = m_unpackImageHeight; 3495 params.imageHeight = m_unpackImageHeight;
3496 params.skipImages = m_unpackSkipImages; 3496 params.skipImages = m_unpackSkipImages;
3497 } 3497 }
3498 return params; 3498 return params;
3499 } 3499 }
3500 3500
3501 } // namespace blink 3501 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698