OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/client/gl_helper.h" | 5 #include "content/common/gpu/client/gl_helper.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 0); | 548 0); |
549 request->buffer = context_->createBuffer(); | 549 request->buffer = context_->createBuffer(); |
550 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, | 550 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, |
551 request->buffer); | 551 request->buffer); |
552 context_->bufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, | 552 context_->bufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, |
553 4 * size.GetArea(), | 553 4 * size.GetArea(), |
554 NULL, | 554 NULL, |
555 GL_STREAM_READ); | 555 GL_STREAM_READ); |
556 | 556 |
557 context_->readPixels(0, 0, size.width(), size.height(), | 557 context_->readPixels(0, 0, size.width(), size.height(), |
558 GL_RGBA, GL_UNSIGNED_BYTE, 0); | 558 GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
559 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); | 559 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); |
560 context_->GetCommandBufferProxy()->SignalSyncPoint( | 560 context_->GetCommandBufferProxy()->SignalSyncPoint( |
561 context_->insertSyncPoint(), | 561 context_->insertSyncPoint(), |
562 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request)); | 562 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request)); |
563 } | 563 } |
564 | 564 |
565 void GLHelper::CopyTextureToImpl::ReadbackTextureSync(WebGLId texture, | 565 void GLHelper::CopyTextureToImpl::ReadbackTextureSync(WebGLId texture, |
566 const gfx::Rect& src_rect, | 566 const gfx::Rect& src_rect, |
567 unsigned char* out) { | 567 unsigned char* out) { |
568 ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer()); | 568 ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer()); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 context_->copyTexSubImage2D(GL_TEXTURE_2D, 0, | 739 context_->copyTexSubImage2D(GL_TEXTURE_2D, 0, |
740 rect.x(), rect.y(), | 740 rect.x(), rect.y(), |
741 rect.x(), rect.y(), | 741 rect.x(), rect.y(), |
742 rect.width(), rect.height()); | 742 rect.width(), rect.height()); |
743 } | 743 } |
744 context_->flush(); | 744 context_->flush(); |
745 } | 745 } |
746 } | 746 } |
747 | 747 |
748 } // namespace content | 748 } // namespace content |
OLD | NEW |