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

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

Issue 10807039: HiDPI: Scale viewport for pepper flash fullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "content/common/gpu/client/gpu_channel_host.h" 9 #include "content/common/gpu/client/gpu_channel_host.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (buffer) 248 if (buffer)
249 context->deleteBuffer(buffer); 249 context->deleteBuffer(buffer);
250 delete context; 250 delete context;
251 } 251 }
252 252
253 } // anonymous namespace 253 } // anonymous namespace
254 254
255 // static 255 // static
256 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( 256 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create(
257 int32 opener_id, webkit::ppapi::PluginInstance* plugin, 257 int32 opener_id, webkit::ppapi::PluginInstance* plugin,
258 const GURL& active_url) { 258 const GURL& active_url,
259 const WebKit::WebScreenInfo& screen_info) {
259 DCHECK_NE(MSG_ROUTING_NONE, opener_id); 260 DCHECK_NE(MSG_ROUTING_NONE, opener_id);
260 scoped_refptr<RenderWidgetFullscreenPepper> widget( 261 scoped_refptr<RenderWidgetFullscreenPepper> widget(
261 new RenderWidgetFullscreenPepper(plugin, active_url)); 262 new RenderWidgetFullscreenPepper(plugin, active_url, screen_info));
262 widget->Init(opener_id); 263 widget->Init(opener_id);
263 return widget.release(); 264 return widget.release();
264 } 265 }
265 266
266 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( 267 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper(
267 webkit::ppapi::PluginInstance* plugin, 268 webkit::ppapi::PluginInstance* plugin,
268 const GURL& active_url) 269 const GURL& active_url,
269 : RenderWidgetFullscreen(), 270 const WebKit::WebScreenInfo& screen_info)
271 : RenderWidgetFullscreen(screen_info),
270 active_url_(active_url), 272 active_url_(active_url),
271 plugin_(plugin), 273 plugin_(plugin),
272 context_(NULL), 274 context_(NULL),
273 buffer_(0), 275 buffer_(0),
274 program_(0), 276 program_(0),
275 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 277 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
276 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher( 278 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher(
277 ALLOW_THIS_IN_INITIALIZER_LIST(this))) { 279 ALLOW_THIS_IN_INITIALIZER_LIST(this))) {
278 } 280 }
279 281
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 plugin_->GetBitmapForOptimizedPluginPaint(paint_bounds, dib, 408 plugin_->GetBitmapForOptimizedPluginPaint(paint_bounds, dib,
407 location, clip)) 409 location, clip))
408 return plugin_; 410 return plugin_;
409 return NULL; 411 return NULL;
410 } 412 }
411 413
412 void RenderWidgetFullscreenPepper::OnResize(const gfx::Size& size, 414 void RenderWidgetFullscreenPepper::OnResize(const gfx::Size& size,
413 const gfx::Rect& resizer_rect, 415 const gfx::Rect& resizer_rect,
414 bool is_fullscreen) { 416 bool is_fullscreen) {
415 if (context_) { 417 if (context_) {
416 context_->reshape(size.width(), size.height()); 418 gfx::Size pixel_size = size.Scale(deviceScaleFactor());
417 context_->viewport(0, 0, size.width(), size.height()); 419 context_->reshape(pixel_size.width(), pixel_size.height());
420 context_->viewport(0, 0, pixel_size.width(), pixel_size.height());
418 } 421 }
419 RenderWidget::OnResize(size, resizer_rect, is_fullscreen); 422 RenderWidget::OnResize(size, resizer_rect, is_fullscreen);
420 } 423 }
421 424
422 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { 425 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() {
423 return new PepperWidget(this); 426 return new PepperWidget(this);
424 } 427 }
425 428
426 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() { 429 bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() {
427 return context_ != NULL; 430 return context_ != NULL;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 497
495 const float kTexCoords[] = { 498 const float kTexCoords[] = {
496 0.f, 0.f, 499 0.f, 0.f,
497 0.f, 2.f, 500 0.f, 2.f,
498 2.f, 0.f, 501 2.f, 0.f,
499 }; 502 };
500 503
501 } // anonymous namespace 504 } // anonymous namespace
502 505
503 bool RenderWidgetFullscreenPepper::InitContext() { 506 bool RenderWidgetFullscreenPepper::InitContext() {
504 context_->reshape(size().width(), size().height()); 507 gfx::Size pixel_size = size().Scale(deviceScaleFactor());
505 context_->viewport(0, 0, size().width(), size().height()); 508 context_->reshape(pixel_size.width(), pixel_size.height());
509 context_->viewport(0, 0, pixel_size.width(), pixel_size.height());
506 510
507 program_ = context_->createProgram(); 511 program_ = context_->createProgram();
508 512
509 GLuint vertex_shader = 513 GLuint vertex_shader =
510 CreateShaderFromSource(context_, GL_VERTEX_SHADER, kVertexShader); 514 CreateShaderFromSource(context_, GL_VERTEX_SHADER, kVertexShader);
511 if (!vertex_shader) 515 if (!vertex_shader)
512 return false; 516 return false;
513 context_->attachShader(program_, vertex_shader); 517 context_->attachShader(program_, vertex_shader);
514 context_->deleteShader(vertex_shader); 518 context_->deleteShader(vertex_shader);
515 519
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 575
572 WebGraphicsContext3DCommandBufferImpl* 576 WebGraphicsContext3DCommandBufferImpl*
573 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { 577 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() {
574 if (!context_) { 578 if (!context_) {
575 CreateContext(); 579 CreateContext();
576 } 580 }
577 if (!context_) 581 if (!context_)
578 return NULL; 582 return NULL;
579 return context_; 583 return context_;
580 } 584 }
OLDNEW
« content/renderer/render_view_impl.cc ('K') | « 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