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" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 canvas->scale(canvas_scale, canvas_scale); | 132 canvas->scale(canvas_scale, canvas_scale); |
133 | 133 |
134 WebRect plugin_rect(0, 0, size_.width, size_.height); | 134 WebRect plugin_rect(0, 0, size_.width, size_.height); |
135 widget_->plugin()->Paint(canvas, plugin_rect, rect); | 135 widget_->plugin()->Paint(canvas, plugin_rect, rect); |
136 } | 136 } |
137 | 137 |
138 virtual void setCompositorSurfaceReady() { | 138 virtual void setCompositorSurfaceReady() { |
139 } | 139 } |
140 | 140 |
141 virtual void composite(bool finish) { | 141 virtual void composite(bool finish) { |
142 if (!widget_->plugin()) | |
143 return; | |
144 | |
145 WebGraphicsContext3DCommandBufferImpl* context = widget_->context(); | |
146 DCHECK(context); | |
147 unsigned int texture = widget_->plugin()->GetBackingTextureId(); | |
148 context->bindTexture(GL_TEXTURE_2D, texture); | |
149 context->drawArrays(GL_TRIANGLES, 0, 3); | |
150 widget_->SwapBuffers(); | |
151 } | 142 } |
152 | 143 |
153 virtual void themeChanged() { | 144 virtual void themeChanged() { |
154 NOTIMPLEMENTED(); | 145 NOTIMPLEMENTED(); |
155 } | 146 } |
156 | 147 |
157 virtual bool handleInputEvent(const WebInputEvent& event) { | 148 virtual bool handleInputEvent(const WebInputEvent& event) { |
158 if (!widget_->plugin()) | 149 if (!widget_->plugin()) |
159 return false; | 150 return false; |
160 | 151 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 bool is_fullscreen) { | 495 bool is_fullscreen) { |
505 if (context_) { | 496 if (context_) { |
506 gfx::Size pixel_size = gfx::ToFlooredSize( | 497 gfx::Size pixel_size = gfx::ToFlooredSize( |
507 gfx::ScaleSize(size, deviceScaleFactor())); | 498 gfx::ScaleSize(size, deviceScaleFactor())); |
508 context_->reshape(pixel_size.width(), pixel_size.height()); | 499 context_->reshape(pixel_size.width(), pixel_size.height()); |
509 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); | 500 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); |
510 } | 501 } |
511 RenderWidget::OnResize(size, resizer_rect, is_fullscreen); | 502 RenderWidget::OnResize(size, resizer_rect, is_fullscreen); |
512 } | 503 } |
513 | 504 |
505 void RenderWidgetFullscreenPepper::Composite() { | |
brettw
2013/01/04 22:22:25
Can you put a comment here "We need to override th
| |
506 if (!plugin_) | |
507 return; | |
508 | |
509 DCHECK(context_); | |
510 unsigned int texture = plugin_->GetBackingTextureId(); | |
511 context_->bindTexture(GL_TEXTURE_2D, texture); | |
512 context_->drawArrays(GL_TRIANGLES, 0, 3); | |
513 SwapBuffers(); | |
514 } | |
515 | |
514 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { | 516 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { |
515 return new PepperWidget(this); | 517 return new PepperWidget(this); |
516 } | 518 } |
517 | 519 |
518 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() { | 520 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() { |
519 return context_ != NULL; | 521 return context_ != NULL; |
520 } | 522 } |
521 | 523 |
522 void RenderWidgetFullscreenPepper::CreateContext() { | 524 void RenderWidgetFullscreenPepper::CreateContext() { |
523 DCHECK(!context_); | 525 DCHECK(!context_); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { | 673 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { |
672 if (!context_) { | 674 if (!context_) { |
673 CreateContext(); | 675 CreateContext(); |
674 } | 676 } |
675 if (!context_) | 677 if (!context_) |
676 return NULL; | 678 return NULL; |
677 return context_; | 679 return context_; |
678 } | 680 } |
679 | 681 |
680 } // namespace content | 682 } // namespace content |
OLD | NEW |