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

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

Issue 1732563007: [NOT FOR COMMIT] Pass defaultObjectSize to get image size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 /* 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 3902 matching lines...) Expand 10 before | Expand all | Expand 10 after
3913 IntSize size(width, height); 3913 IntSize size(width, height);
3914 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size); 3914 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size);
3915 if (!buf) { 3915 if (!buf) {
3916 synthesizeGLError(GL_OUT_OF_MEMORY, functionName, "out of memory"); 3916 synthesizeGLError(GL_OUT_OF_MEMORY, functionName, "out of memory");
3917 return nullptr; 3917 return nullptr;
3918 } 3918 }
3919 3919
3920 if (!image->currentFrameKnownToBeOpaque()) 3920 if (!image->currentFrameKnownToBeOpaque())
3921 buf->canvas()->clear(SK_ColorTRANSPARENT); 3921 buf->canvas()->clear(SK_ColorTRANSPARENT);
3922 3922
3923 IntRect srcRect(IntPoint(), image->size()); 3923 IntRect srcRect(IntPoint(), image->defaultConcreteObjectSize());
3924 IntRect destRect(0, 0, size.width(), size.height()); 3924 IntRect destRect(0, 0, size.width(), size.height());
3925 SkPaint paint; 3925 SkPaint paint;
3926 image->draw(buf->canvas(), paint, destRect, srcRect, DoNotRespectImageOrient ation, Image::DoNotClampImageToSourceRect); 3926 image->draw(buf->canvas(), paint, destRect, srcRect, DoNotRespectImageOrient ation, Image::DoNotClampImageToSourceRect);
3927 return buf->newImageSnapshot(); 3927 return buf->newImageSnapshot();
3928 } 3928 }
3929 3929
3930 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int ernalformat, 3930 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int ernalformat,
3931 GLsizei width, GLsizei height, GLint border, 3931 GLsizei width, GLsizei height, GLint border,
3932 GLenum format, GLenum type, DOMArrayBufferView* pixels) 3932 GLenum format, GLenum type, DOMArrayBufferView* pixels)
3933 { 3933 {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4000 return; 4000 return;
4001 if (!validateHTMLImageElement("texImage2D", image, exceptionState)) 4001 if (!validateHTMLImageElement("texImage2D", image, exceptionState))
4002 return; 4002 return;
4003 if (!validateTexture2DBinding("texImage2D", target)) 4003 if (!validateTexture2DBinding("texImage2D", target))
4004 return; 4004 return;
4005 4005
4006 RefPtr<Image> imageForRender = image->cachedImage()->image(); 4006 RefPtr<Image> imageForRender = image->cachedImage()->image();
4007 if (imageForRender && imageForRender->isSVGImage()) 4007 if (imageForRender && imageForRender->isSVGImage())
4008 imageForRender = drawImageIntoBuffer(imageForRender.release(), image->wi dth(), image->height(), "texImage2D"); 4008 imageForRender = drawImageIntoBuffer(imageForRender.release(), image->wi dth(), image->height(), "texImage2D");
4009 4009
4010 if (!imageForRender || !validateTexFunc("texImage2D", TexImage, SourceHTMLIm ageElement, target, level, internalformat, imageForRender->width(), imageForRend er->height(), 1, 0, format, type, 0, 0, 0)) 4010 if (!imageForRender || !validateTexFunc("texImage2D", TexImage, SourceHTMLIm ageElement, target, level, internalformat, imageForRender->defaultConcreteObject SizeWidth(), imageForRender->defaultConcreteObjectSizeHeight(), 1, 0, format, ty pe, 0, 0, 0))
4011 return; 4011 return;
4012 4012
4013 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { 4013 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) {
4014 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. 4014 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented.
4015 type = GL_FLOAT; 4015 type = GL_FLOAT;
4016 } 4016 }
4017 texImage2DImpl(target, level, internalformat, format, type, imageForRender.g et(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlph a); 4017 texImage2DImpl(target, level, internalformat, format, type, imageForRender.g et(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlph a);
4018 } 4018 }
4019 4019
4020 bool WebGLRenderingContextBase::canUseTexImageCanvasByGPU(GLint internalformat, GLenum type) 4020 bool WebGLRenderingContextBase::canUseTexImageCanvasByGPU(GLint internalformat, GLenum type)
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 return; 4373 return;
4374 if (!validateHTMLImageElement("texSubImage2D", image, exceptionState)) 4374 if (!validateHTMLImageElement("texSubImage2D", image, exceptionState))
4375 return; 4375 return;
4376 if (!validateTexture2DBinding("texSubImage2D", target)) 4376 if (!validateTexture2DBinding("texSubImage2D", target))
4377 return; 4377 return;
4378 4378
4379 RefPtr<Image> imageForRender = image->cachedImage()->image(); 4379 RefPtr<Image> imageForRender = image->cachedImage()->image();
4380 if (imageForRender && imageForRender->isSVGImage()) 4380 if (imageForRender && imageForRender->isSVGImage())
4381 imageForRender = drawImageIntoBuffer(imageForRender.release(), image->wi dth(), image->height(), "texSubImage2D"); 4381 imageForRender = drawImageIntoBuffer(imageForRender.release(), image->wi dth(), image->height(), "texSubImage2D");
4382 4382
4383 if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage, Source HTMLImageElement, target, level, 0, imageForRender->width(), imageForRender->hei ght(), 1, 0, format, type, xoffset, yoffset, 0)) 4383 if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage, Source HTMLImageElement, target, level, 0, imageForRender->defaultConcreteObjectSizeWid th(), imageForRender->defaultConcreteObjectSizeHeight(), 1, 0, format, type, xof fset, yoffset, 0))
4384 return; 4384 return;
4385 4385
4386 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { 4386 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) {
4387 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. 4387 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented.
4388 type = GL_FLOAT; 4388 type = GL_FLOAT;
4389 } 4389 }
4390 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen der.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultipl yAlpha); 4390 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen der.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultipl yAlpha);
4391 } 4391 }
4392 4392
4393 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 4393 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after
6266 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); 6266 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1);
6267 } 6267 }
6268 6268
6269 void WebGLRenderingContextBase::restoreUnpackParameters() 6269 void WebGLRenderingContextBase::restoreUnpackParameters()
6270 { 6270 {
6271 if (m_unpackAlignment != 1) 6271 if (m_unpackAlignment != 1)
6272 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6272 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6273 } 6273 }
6274 6274
6275 } // namespace blink 6275 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp ('k') | third_party/WebKit/Source/platform/Cursor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698