Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: content/renderer/render_widget_fullscreen_pepper.cc

Issue 12090051: Revert 178746 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1397/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
142 } 151 }
143 152
144 virtual void themeChanged() { 153 virtual void themeChanged() {
145 NOTIMPLEMENTED(); 154 NOTIMPLEMENTED();
146 } 155 }
147 156
148 virtual bool handleInputEvent(const WebInputEvent& event) { 157 virtual bool handleInputEvent(const WebInputEvent& event) {
149 if (!widget_->plugin()) 158 if (!widget_->plugin())
150 return false; 159 return false;
151 160
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 } 512 }
504 513
505 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { 514 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() {
506 return new PepperWidget(this); 515 return new PepperWidget(this);
507 } 516 }
508 517
509 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() { 518 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() {
510 return context_ != NULL; 519 return context_ != NULL;
511 } 520 }
512 521
513 // Fullscreen pepper widgets composite themselves into the plugin's backing
514 // texture (as opposed to using the cc library to composite as normal
515 // content::RenderWidgets do), so to produce a composited frame we just have to
516 // draw this texture and swap.
517 void RenderWidgetFullscreenPepper::Composite() {
518 if (!plugin_)
519 return;
520
521 DCHECK(context_);
522 unsigned int texture = plugin_->GetBackingTextureId();
523 context_->bindTexture(GL_TEXTURE_2D, texture);
524 context_->drawArrays(GL_TRIANGLES, 0, 3);
525 SwapBuffers();
526 }
527
528 void RenderWidgetFullscreenPepper::CreateContext() { 522 void RenderWidgetFullscreenPepper::CreateContext() {
529 DCHECK(!context_); 523 DCHECK(!context_);
530 CommandLine* command_line = CommandLine::ForCurrentProcess(); 524 CommandLine* command_line = CommandLine::ForCurrentProcess();
531 if (command_line->HasSwitch(switches::kDisableFlashFullscreen3d)) 525 if (command_line->HasSwitch(switches::kDisableFlashFullscreen3d))
532 return; 526 return;
533 WebKit::WebGraphicsContext3D::Attributes attributes; 527 WebKit::WebGraphicsContext3D::Attributes attributes;
534 attributes.depth = false; 528 attributes.depth = false;
535 attributes.stencil = false; 529 attributes.stencil = false;
536 attributes.antialias = false; 530 attributes.antialias = false;
537 attributes.shareResources = false; 531 attributes.shareResources = false;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { 671 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() {
678 if (!context_) { 672 if (!context_) {
679 CreateContext(); 673 CreateContext();
680 } 674 }
681 if (!context_) 675 if (!context_)
682 return NULL; 676 return NULL;
683 return context_; 677 return context_;
684 } 678 }
685 679
686 } // namespace content 680 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698