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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 2495953002: Support uploads of sub-rectangles of canvases to 2D and 3D textures. (Closed)
Patch Set: Fixed regression in accelerated video-to-texture uploads. Marked Mac Intel failures. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 return true; 667 return true;
668 } 668 }
669 669
670 bool DrawingBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, 670 bool DrawingBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl,
671 GLuint texture, 671 GLuint texture,
672 GLenum internalFormat, 672 GLenum internalFormat,
673 GLenum destType, 673 GLenum destType,
674 GLint level, 674 GLint level,
675 bool premultiplyAlpha, 675 bool premultiplyAlpha,
676 bool flipY, 676 bool flipY,
677 const IntPoint& destTextureOffset,
678 const IntRect& sourceSubRectangle,
677 SourceDrawingBuffer sourceBuffer) { 679 SourceDrawingBuffer sourceBuffer) {
678 ScopedStateRestorer scopedStateRestorer(this); 680 ScopedStateRestorer scopedStateRestorer(this);
679 681
680 if (m_contentsChanged) { 682 if (m_contentsChanged) {
681 if (m_antiAliasingMode != None) 683 if (m_antiAliasingMode != None)
682 resolveMultisampleFramebufferInternal(); 684 resolveMultisampleFramebufferInternal();
683 m_gl->Flush(); 685 m_gl->Flush();
684 } 686 }
685 687
686 // Assume that the destination target is GL_TEXTURE_2D. 688 // Assume that the destination target is GL_TEXTURE_2D.
(...skipping 25 matching lines...) Expand all
712 GLuint sourceTexture = 714 GLuint sourceTexture =
713 gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name); 715 gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name);
714 716
715 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; 717 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE;
716 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; 718 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE;
717 if (m_wantAlphaChannel && m_premultipliedAlpha && !premultiplyAlpha) 719 if (m_wantAlphaChannel && m_premultipliedAlpha && !premultiplyAlpha)
718 unpackUnpremultiplyAlphaNeeded = GL_TRUE; 720 unpackUnpremultiplyAlphaNeeded = GL_TRUE;
719 else if (m_wantAlphaChannel && !m_premultipliedAlpha && premultiplyAlpha) 721 else if (m_wantAlphaChannel && !m_premultipliedAlpha && premultiplyAlpha)
720 unpackPremultiplyAlphaNeeded = GL_TRUE; 722 unpackPremultiplyAlphaNeeded = GL_TRUE;
721 723
722 gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, 724 gl->CopySubTextureCHROMIUM(
723 flipY, unpackPremultiplyAlphaNeeded, 725 sourceTexture, texture, destTextureOffset.x(), destTextureOffset.y(),
724 unpackUnpremultiplyAlphaNeeded); 726 sourceSubRectangle.x(), sourceSubRectangle.y(),
727 sourceSubRectangle.width(), sourceSubRectangle.height(), flipY,
728 unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded);
725 729
726 gl->DeleteTextures(1, &sourceTexture); 730 gl->DeleteTextures(1, &sourceTexture);
727 731
728 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); 732 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM();
729 733
730 gl->Flush(); 734 gl->Flush();
731 gpu::SyncToken syncToken; 735 gpu::SyncToken syncToken;
732 gl->GenSyncTokenCHROMIUM(fenceSync, syncToken.GetData()); 736 gl->GenSyncTokenCHROMIUM(fenceSync, syncToken.GetData());
733 m_gl->WaitSyncTokenCHROMIUM(syncToken.GetData()); 737 m_gl->WaitSyncTokenCHROMIUM(syncToken.GetData());
734 738
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 if (m_pixelUnpackBufferBindingDirty) 1257 if (m_pixelUnpackBufferBindingDirty)
1254 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); 1258 client->DrawingBufferClientRestorePixelUnpackBufferBinding();
1255 } 1259 }
1256 1260
1257 bool DrawingBuffer::shouldUseChromiumImage() { 1261 bool DrawingBuffer::shouldUseChromiumImage() {
1258 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && 1262 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() &&
1259 m_chromiumImageUsage == AllowChromiumImage; 1263 m_chromiumImageUsage == AllowChromiumImage;
1260 } 1264 }
1261 1265
1262 } // namespace blink 1266 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698