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

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

Issue 11787006: Avoid going through WebWidget::composite to composite a RenderWidget (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 7 years, 11 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();
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 503 }
513 504
514 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { 505 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() {
515 return new PepperWidget(this); 506 return new PepperWidget(this);
516 } 507 }
517 508
518 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() { 509 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() {
519 return context_ != NULL; 510 return context_ != NULL;
520 } 511 }
521 512
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
522 void RenderWidgetFullscreenPepper::CreateContext() { 528 void RenderWidgetFullscreenPepper::CreateContext() {
523 DCHECK(!context_); 529 DCHECK(!context_);
524 CommandLine* command_line = CommandLine::ForCurrentProcess(); 530 CommandLine* command_line = CommandLine::ForCurrentProcess();
525 if (command_line->HasSwitch(switches::kDisableFlashFullscreen3d)) 531 if (command_line->HasSwitch(switches::kDisableFlashFullscreen3d))
526 return; 532 return;
527 WebKit::WebGraphicsContext3D::Attributes attributes; 533 WebKit::WebGraphicsContext3D::Attributes attributes;
528 attributes.depth = false; 534 attributes.depth = false;
529 attributes.stencil = false; 535 attributes.stencil = false;
530 attributes.antialias = false; 536 attributes.antialias = false;
531 attributes.shareResources = false; 537 attributes.shareResources = false;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { 677 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() {
672 if (!context_) { 678 if (!context_) {
673 CreateContext(); 679 CreateContext();
674 } 680 }
675 if (!context_) 681 if (!context_)
676 return NULL; 682 return NULL;
677 return context_; 683 return context_;
678 } 684 }
679 685
680 } // namespace content 686 } // 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