| 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/renderer/render_widget_fullscreen_pepper.h" | 5 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "content/common/gpu/client/gpu_channel_host.h" | 12 #include "content/common/gpu/client/gpu_channel_host.h" |
| 13 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
| 14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h" | 15 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h" |
| 16 #include "content/renderer/render_thread_impl.h" | 16 #include "content/renderer/render_thread_impl.h" |
| 17 #include "gpu/command_buffer/client/gles2_implementation.h" | 17 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 18 #include "skia/ext/platform_canvas.h" | 18 #include "skia/ext/platform_canvas.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" |
| 24 #include "ui/gfx/size_conversions.h" |
| 24 #include "ui/gl/gpu_preference.h" | 25 #include "ui/gl/gpu_preference.h" |
| 25 #include "webkit/plugins/ppapi/plugin_delegate.h" | 26 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 26 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 27 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 27 | 28 |
| 28 using WebKit::WebCanvas; | 29 using WebKit::WebCanvas; |
| 29 using WebKit::WebCompositionUnderline; | 30 using WebKit::WebCompositionUnderline; |
| 30 using WebKit::WebCursorInfo; | 31 using WebKit::WebCursorInfo; |
| 31 using WebKit::WebGestureEvent; | 32 using WebKit::WebGestureEvent; |
| 32 using WebKit::WebInputEvent; | 33 using WebKit::WebInputEvent; |
| 33 using WebKit::WebMouseEvent; | 34 using WebKit::WebMouseEvent; |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 paint_bounds, dib, location, clip, scale_factor)) { | 503 paint_bounds, dib, location, clip, scale_factor)) { |
| 503 return plugin_; | 504 return plugin_; |
| 504 } | 505 } |
| 505 return NULL; | 506 return NULL; |
| 506 } | 507 } |
| 507 | 508 |
| 508 void RenderWidgetFullscreenPepper::OnResize(const gfx::Size& size, | 509 void RenderWidgetFullscreenPepper::OnResize(const gfx::Size& size, |
| 509 const gfx::Rect& resizer_rect, | 510 const gfx::Rect& resizer_rect, |
| 510 bool is_fullscreen) { | 511 bool is_fullscreen) { |
| 511 if (context_) { | 512 if (context_) { |
| 512 gfx::Size pixel_size = size.Scale(deviceScaleFactor()); | 513 gfx::Size pixel_size = gfx::ToFlooredSize(size.Scale(deviceScaleFactor())); |
| 513 context_->reshape(pixel_size.width(), pixel_size.height()); | 514 context_->reshape(pixel_size.width(), pixel_size.height()); |
| 514 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); | 515 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); |
| 515 } | 516 } |
| 516 RenderWidget::OnResize(size, resizer_rect, is_fullscreen); | 517 RenderWidget::OnResize(size, resizer_rect, is_fullscreen); |
| 517 } | 518 } |
| 518 | 519 |
| 519 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { | 520 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { |
| 520 return new PepperWidget(this); | 521 return new PepperWidget(this); |
| 521 } | 522 } |
| 522 | 523 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 595 |
| 595 const float kTexCoords[] = { | 596 const float kTexCoords[] = { |
| 596 0.f, 0.f, | 597 0.f, 0.f, |
| 597 0.f, 2.f, | 598 0.f, 2.f, |
| 598 2.f, 0.f, | 599 2.f, 0.f, |
| 599 }; | 600 }; |
| 600 | 601 |
| 601 } // anonymous namespace | 602 } // anonymous namespace |
| 602 | 603 |
| 603 bool RenderWidgetFullscreenPepper::InitContext() { | 604 bool RenderWidgetFullscreenPepper::InitContext() { |
| 604 gfx::Size pixel_size = size().Scale(deviceScaleFactor()); | 605 gfx::Size pixel_size = gfx::ToFlooredSize(size().Scale(deviceScaleFactor())); |
| 605 context_->reshape(pixel_size.width(), pixel_size.height()); | 606 context_->reshape(pixel_size.width(), pixel_size.height()); |
| 606 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); | 607 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); |
| 607 | 608 |
| 608 program_ = context_->createProgram(); | 609 program_ = context_->createProgram(); |
| 609 | 610 |
| 610 GLuint vertex_shader = | 611 GLuint vertex_shader = |
| 611 CreateShaderFromSource(context_, GL_VERTEX_SHADER, kVertexShader); | 612 CreateShaderFromSource(context_, GL_VERTEX_SHADER, kVertexShader); |
| 612 if (!vertex_shader) | 613 if (!vertex_shader) |
| 613 return false; | 614 return false; |
| 614 context_->attachShader(program_, vertex_shader); | 615 context_->attachShader(program_, vertex_shader); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 673 |
| 673 WebGraphicsContext3DCommandBufferImpl* | 674 WebGraphicsContext3DCommandBufferImpl* |
| 674 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { | 675 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { |
| 675 if (!context_) { | 676 if (!context_) { |
| 676 CreateContext(); | 677 CreateContext(); |
| 677 } | 678 } |
| 678 if (!context_) | 679 if (!context_) |
| 679 return NULL; | 680 return NULL; |
| 680 return context_; | 681 return context_; |
| 681 } | 682 } |
| OLD | NEW |