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

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

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO Created 8 years, 1 month 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.cc ('k') | ui/compositor/dip_util.cc » ('j') | 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 paint_bounds, dib, location, clip, scale_factor)) { 501 paint_bounds, dib, location, clip, scale_factor)) {
502 return plugin_; 502 return plugin_;
503 } 503 }
504 return NULL; 504 return NULL;
505 } 505 }
506 506
507 void RenderWidgetFullscreenPepper::OnResize(const gfx::Size& size, 507 void RenderWidgetFullscreenPepper::OnResize(const gfx::Size& size,
508 const gfx::Rect& resizer_rect, 508 const gfx::Rect& resizer_rect,
509 bool is_fullscreen) { 509 bool is_fullscreen) {
510 if (context_) { 510 if (context_) {
511 gfx::Size pixel_size = gfx::ToFlooredSize(size.Scale(deviceScaleFactor())); 511 gfx::Size pixel_size = gfx::ToFlooredSize(
512 gfx::ScaleSize(size, deviceScaleFactor()));
512 context_->reshape(pixel_size.width(), pixel_size.height()); 513 context_->reshape(pixel_size.width(), pixel_size.height());
513 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); 514 context_->viewport(0, 0, pixel_size.width(), pixel_size.height());
514 } 515 }
515 RenderWidget::OnResize(size, resizer_rect, is_fullscreen); 516 RenderWidget::OnResize(size, resizer_rect, is_fullscreen);
516 } 517 }
517 518
518 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { 519 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() {
519 return new PepperWidget(this); 520 return new PepperWidget(this);
520 } 521 }
521 522
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = gfx::ToFlooredSize(size().Scale(deviceScaleFactor())); 605 gfx::Size pixel_size = gfx::ToFlooredSize(
606 gfx::ScaleSize(size(), deviceScaleFactor()));
605 context_->reshape(pixel_size.width(), pixel_size.height()); 607 context_->reshape(pixel_size.width(), pixel_size.height());
606 context_->viewport(0, 0, pixel_size.width(), pixel_size.height()); 608 context_->viewport(0, 0, pixel_size.width(), pixel_size.height());
607 609
608 program_ = context_->createProgram(); 610 program_ = context_->createProgram();
609 611
610 GLuint vertex_shader = 612 GLuint vertex_shader =
611 CreateShaderFromSource(context_, GL_VERTEX_SHADER, kVertexShader); 613 CreateShaderFromSource(context_, GL_VERTEX_SHADER, kVertexShader);
612 if (!vertex_shader) 614 if (!vertex_shader)
613 return false; 615 return false;
614 context_->attachShader(program_, vertex_shader); 616 context_->attachShader(program_, vertex_shader);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { 676 RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() {
675 if (!context_) { 677 if (!context_) {
676 CreateContext(); 678 CreateContext();
677 } 679 }
678 if (!context_) 680 if (!context_)
679 return NULL; 681 return NULL;
680 return context_; 682 return context_;
681 } 683 }
682 684
683 } // namespace content 685 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.cc ('k') | ui/compositor/dip_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698