| OLD | NEW |
| 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { | 676 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
| 677 // It's possible that the drawing buffer allocation provokes a context loss, | 677 // It's possible that the drawing buffer allocation provokes a context loss, |
| 678 // so check again just in case. http://crbug.com/512302 | 678 // so check again just in case. http://crbug.com/512302 |
| 679 return false; | 679 return false; |
| 680 } | 680 } |
| 681 | 681 |
| 682 return true; | 682 return true; |
| 683 } | 683 } |
| 684 | 684 |
| 685 bool DrawingBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, | 685 bool DrawingBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, |
| 686 GLenum textureTarget, |
| 686 GLuint texture, | 687 GLuint texture, |
| 687 GLenum internalFormat, | |
| 688 GLenum destType, | |
| 689 GLint level, | |
| 690 bool premultiplyAlpha, | 688 bool premultiplyAlpha, |
| 691 bool flipY, | 689 bool flipY, |
| 692 const IntPoint& destTextureOffset, | 690 const IntPoint& destTextureOffset, |
| 693 const IntRect& sourceSubRectangle, | 691 const IntRect& sourceSubRectangle, |
| 694 SourceDrawingBuffer sourceBuffer) { | 692 SourceDrawingBuffer sourceBuffer) { |
| 695 ScopedStateRestorer scopedStateRestorer(this); | 693 ScopedStateRestorer scopedStateRestorer(this); |
| 696 | 694 |
| 697 if (m_contentsChanged) { | 695 if (m_contentsChanged) { |
| 698 if (m_antiAliasingMode != None) | 696 if (m_antiAliasingMode != None) |
| 699 resolveMultisampleFramebufferInternal(); | 697 resolveMultisampleFramebufferInternal(); |
| 700 m_gl->Flush(); | 698 m_gl->Flush(); |
| 701 } | 699 } |
| 702 | 700 |
| 703 // Assume that the destination target is GL_TEXTURE_2D. | 701 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(textureTarget)) |
| 704 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM( | |
| 705 GL_TEXTURE_2D, internalFormat, destType, level)) | |
| 706 return false; | 702 return false; |
| 707 | 703 |
| 708 // Contexts may be in a different share group. We must transfer the texture | 704 // Contexts may be in a different share group. We must transfer the texture |
| 709 // through a mailbox first. | 705 // through a mailbox first. |
| 710 GLenum target = 0; | 706 GLenum target = 0; |
| 711 gpu::Mailbox mailbox; | 707 gpu::Mailbox mailbox; |
| 712 gpu::SyncToken produceSyncToken; | 708 gpu::SyncToken produceSyncToken; |
| 713 if (sourceBuffer == FrontBuffer && m_frontColorBuffer) { | 709 if (sourceBuffer == FrontBuffer && m_frontColorBuffer) { |
| 714 target = m_frontColorBuffer->parameters.target; | 710 target = m_frontColorBuffer->parameters.target; |
| 715 mailbox = m_frontColorBuffer->mailbox; | 711 mailbox = m_frontColorBuffer->mailbox; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 734 gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name); | 730 gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name); |
| 735 | 731 |
| 736 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; | 732 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; |
| 737 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; | 733 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; |
| 738 if (m_wantAlphaChannel && m_premultipliedAlpha && !premultiplyAlpha) | 734 if (m_wantAlphaChannel && m_premultipliedAlpha && !premultiplyAlpha) |
| 739 unpackUnpremultiplyAlphaNeeded = GL_TRUE; | 735 unpackUnpremultiplyAlphaNeeded = GL_TRUE; |
| 740 else if (m_wantAlphaChannel && !m_premultipliedAlpha && premultiplyAlpha) | 736 else if (m_wantAlphaChannel && !m_premultipliedAlpha && premultiplyAlpha) |
| 741 unpackPremultiplyAlphaNeeded = GL_TRUE; | 737 unpackPremultiplyAlphaNeeded = GL_TRUE; |
| 742 | 738 |
| 743 gl->CopySubTextureCHROMIUM( | 739 gl->CopySubTextureCHROMIUM( |
| 744 sourceTexture, 0, GL_TEXTURE_2D, texture, 0, destTextureOffset.x(), | 740 sourceTexture, 0, textureTarget, texture, 0, destTextureOffset.x(), |
| 745 destTextureOffset.y(), sourceSubRectangle.x(), sourceSubRectangle.y(), | 741 destTextureOffset.y(), sourceSubRectangle.x(), sourceSubRectangle.y(), |
| 746 sourceSubRectangle.width(), sourceSubRectangle.height(), flipY, | 742 sourceSubRectangle.width(), sourceSubRectangle.height(), flipY, |
| 747 unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); | 743 unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); |
| 748 | 744 |
| 749 gl->DeleteTextures(1, &sourceTexture); | 745 gl->DeleteTextures(1, &sourceTexture); |
| 750 | 746 |
| 751 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); | 747 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); |
| 752 | 748 |
| 753 gl->Flush(); | 749 gl->Flush(); |
| 754 gpu::SyncToken syncToken; | 750 gpu::SyncToken syncToken; |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 if (m_pixelUnpackBufferBindingDirty) | 1288 if (m_pixelUnpackBufferBindingDirty) |
| 1293 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); | 1289 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); |
| 1294 } | 1290 } |
| 1295 | 1291 |
| 1296 bool DrawingBuffer::shouldUseChromiumImage() { | 1292 bool DrawingBuffer::shouldUseChromiumImage() { |
| 1297 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && | 1293 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && |
| 1298 m_chromiumImageUsage == AllowChromiumImage; | 1294 m_chromiumImageUsage == AllowChromiumImage; |
| 1299 } | 1295 } |
| 1300 | 1296 |
| 1301 } // namespace blink | 1297 } // namespace blink |
| OLD | NEW |