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

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

Issue 2165243002: Make TexImage2D(ImageBitmap) supports some more formats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4506 matching lines...) Expand 10 before | Expand all | Expand 10 after
4517 if (!texture) 4517 if (!texture)
4518 return; 4518 return;
4519 TexImageFunctionType functionType; 4519 TexImageFunctionType functionType;
4520 if (functionID == TexImage2D) 4520 if (functionID == TexImage2D)
4521 functionType = TexImage; 4521 functionType = TexImage;
4522 else 4522 else
4523 functionType = TexSubImage; 4523 functionType = TexSubImage;
4524 if (!validateTexFunc(funcName, functionType, SourceImageBitmap, target, leve l, internalformat, bitmap->width(), bitmap->height(), 1, 0, format, type, xoffse t, yoffset, zoffset)) 4524 if (!validateTexFunc(funcName, functionType, SourceImageBitmap, target, leve l, internalformat, bitmap->width(), bitmap->height(), 1, 0, format, type, xoffse t, yoffset, zoffset))
4525 return; 4525 return;
4526 ASSERT(bitmap->bitmapImage()); 4526 ASSERT(bitmap->bitmapImage());
4527 // TODO(xidachen): find out why GPU-GPU copy fails on r8_red, rg8_rg, rgb8_r gb, rgba8_rgba only. 4527
4528 if (functionID != TexSubImage3D && bitmap->isTextureBacked() && canUseTexIma geByGPU(functionID, internalformat, type) 4528 if (functionID != TexSubImage3D && bitmap->isTextureBacked() && canUseTexIma geByGPU(functionID, internalformat, type)) {
4529 && internalformat != GL_R8 && internalformat != GL_RG8 && internalformat != GL_RGB8 && internalformat != GL_RGBA8) {
4530 if (functionID == TexImage2D) { 4529 if (functionID == TexImage2D) {
4531 texImage2DBase(target, level, internalformat, bitmap->width(), bitma p->height(), 0, format, type, 0); 4530 texImage2DBase(target, level, internalformat, bitmap->width(), bitma p->height(), 0, format, type, 0);
4532 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma t, type, 0, 0, 0, bitmap); 4531 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma t, type, 0, 0, 0, bitmap);
4533 } else if (functionID == TexSubImage2D) { 4532 } else if (functionID == TexSubImage2D) {
4534 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t ype, xoffset, yoffset, 0, bitmap); 4533 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t ype, xoffset, yoffset, 0, bitmap);
4535 } 4534 }
4536 return; 4535 return;
4537 } 4536 }
4538 RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); 4537 RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame();
4539 SkPixmap pixmap; 4538 SkPixmap pixmap;
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
6491 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6490 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6492 } 6491 }
6493 6492
6494 void WebGLRenderingContextBase::restoreUnpackParameters() 6493 void WebGLRenderingContextBase::restoreUnpackParameters()
6495 { 6494 {
6496 if (m_unpackAlignment != 1) 6495 if (m_unpackAlignment != 1)
6497 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6496 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6498 } 6497 }
6499 6498
6500 } // namespace blink 6499 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698