summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-26 00:49:57 +0000
committerpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-26 00:49:57 +0000
commita87078352ef50bf6ea9ebc3598a7d23c17e69817 (patch)
tree75a46c66893610bd84e7c4dd387069dc8ac3df0c /chrome
parent5999c5a8d124d48c346cdaae12ef8a7128f6cab6 (diff)
downloadchromium_src-a87078352ef50bf6ea9ebc3598a7d23c17e69817.zip
chromium_src-a87078352ef50bf6ea9ebc3598a7d23c17e69817.tar.gz
chromium_src-a87078352ef50bf6ea9ebc3598a7d23c17e69817.tar.bz2
Make Pepper resize the buffer through the command buffer.
This adds support for glResizeCHROMIUM for off-screen contexts. BUG=none TEST=Pepper flash. Review URL: http://codereview.chromium.org/6241015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.cc37
-rw-r--r--chrome/renderer/pepper_platform_context_3d_impl.cc5
-rw-r--r--chrome/renderer/pepper_platform_context_3d_impl.h4
3 files changed, 21 insertions, 25 deletions
diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc
index 930f6f5..43a1be5 100644
--- a/chrome/gpu/gpu_command_buffer_stub.cc
+++ b/chrome/gpu/gpu_command_buffer_stub.cc
@@ -257,15 +257,12 @@ void GpuCommandBufferStub::OnInitialize(
NewCallback(this,
&GpuCommandBufferStub::SwapBuffersCallback));
}
-#elif defined(OS_LINUX) || defined(OS_WIN)
- if (handle_) {
- // Set up a pathway for resizing the output window at the right time
- // relative to other GL commands.
- processor_->SetResizeCallback(
- NewCallback(this,
- &GpuCommandBufferStub::ResizeCallback));
- }
#endif // defined(OS_MACOSX)
+
+ // Set up a pathway for resizing the output window or framebuffer at the
+ // right time relative to other GL commands.
+ processor_->SetResizeCallback(
+ NewCallback(this, &GpuCommandBufferStub::ResizeCallback));
} else {
processor_.reset();
command_buffer_.reset();
@@ -375,20 +372,22 @@ void GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped(
#endif // defined(OS_MACOSX)
void GpuCommandBufferStub::ResizeCallback(gfx::Size size) {
- if (handle_ == gfx::kNullPluginWindow)
- return;
-
+ if (handle_ == gfx::kNullPluginWindow) {
+ processor_->decoder()->ResizeOffscreenFrameBuffer(size);
+ processor_->decoder()->UpdateOffscreenFrameBufferSize();
+ } else {
#if defined(OS_LINUX)
- GpuThread* gpu_thread = channel_->gpu_thread();
- bool result = false;
- gpu_thread->Send(
- new GpuHostMsg_ResizeXID(handle_, size, &result));
+ GpuThread* gpu_thread = channel_->gpu_thread();
+ bool result = false;
+ gpu_thread->Send(
+ new GpuHostMsg_ResizeXID(handle_, size, &result));
#elif defined(OS_WIN)
- HWND hwnd = static_cast<HWND>(compositor_window_);
- UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS |
- SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE;
- SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags);
+ HWND hwnd = static_cast<HWND>(compositor_window_);
+ UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS |
+ SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE;
+ SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags);
#endif // defined(OS_LINUX)
+ }
}
#endif // defined(ENABLE_GPU)
diff --git a/chrome/renderer/pepper_platform_context_3d_impl.cc b/chrome/renderer/pepper_platform_context_3d_impl.cc
index e1e5dc5..57b849a 100644
--- a/chrome/renderer/pepper_platform_context_3d_impl.cc
+++ b/chrome/renderer/pepper_platform_context_3d_impl.cc
@@ -69,11 +69,6 @@ unsigned PlatformContext3DImpl::GetError() {
return ggl::GetError(context_);
}
-void PlatformContext3DImpl::ResizeBackingTexture(const gfx::Size& size) {
- DCHECK(context_);
- ggl::ResizeOffscreenContext(context_, size);
-}
-
void PlatformContext3DImpl::SetSwapBuffersCallback(Callback0::Type* callback) {
DCHECK(context_);
ggl::SetSwapBuffersCallback(context_, callback);
diff --git a/chrome/renderer/pepper_platform_context_3d_impl.h b/chrome/renderer/pepper_platform_context_3d_impl.h
index 6d049c0..1a34f98 100644
--- a/chrome/renderer/pepper_platform_context_3d_impl.h
+++ b/chrome/renderer/pepper_platform_context_3d_impl.h
@@ -1,6 +1,8 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifndef CHROME_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_
+#define CHROME_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_
#include "webkit/plugins/ppapi/plugin_delegate.h"
@@ -22,7 +24,6 @@ class PlatformContext3DImpl
virtual bool SwapBuffers();
virtual unsigned GetError();
virtual void SetSwapBuffersCallback(Callback0::Type* callback);
- void ResizeBackingTexture(const gfx::Size& size);
virtual unsigned GetBackingTextureId();
virtual gpu::gles2::GLES2Implementation* GetGLES2Implementation();
@@ -33,3 +34,4 @@ class PlatformContext3DImpl
#endif // ENABLE_GPU
+#endif // CHROME_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_