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

Side by Side Diff: chrome/browser/thumbnails/render_widget_snapshot_taker.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
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 "chrome/browser/thumbnails/render_widget_snapshot_taker.h" 5 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/public/browser/notification_details.h" 9 #include "content/public/browser/notification_details.h"
10 #include "content/public/browser/notification_source.h" 10 #include "content/public/browser/notification_source.h"
(...skipping 30 matching lines...) Expand all
41 const SnapshotReadyCallback& callback, 41 const SnapshotReadyCallback& callback,
42 gfx::Size page_size, 42 gfx::Size page_size,
43 gfx::Size desired_size) { 43 gfx::Size desired_size) {
44 // We are going to render the thumbnail asynchronously now, so keep 44 // We are going to render the thumbnail asynchronously now, so keep
45 // this callback for later lookup when the rendering is done. 45 // this callback for later lookup when the rendering is done.
46 static int sequence_num = 0; 46 static int sequence_num = 0;
47 sequence_num++; 47 sequence_num++;
48 float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView( 48 float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView(
49 renderer->GetView()->GetNativeView())); 49 renderer->GetView()->GetNativeView()));
50 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize( 50 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize(
51 desired_size.Scale(scale_factor)); 51 gfx::ScaleSize(desired_size, scale_factor));
52 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create( 52 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create(
53 desired_size_in_pixel.GetArea() * 4, sequence_num)); 53 desired_size_in_pixel.GetArea() * 4, sequence_num));
54 54
55 #if defined(USE_X11) 55 #if defined(USE_X11)
56 // TODO: IPC a handle to the renderer like Windows. 56 // TODO: IPC a handle to the renderer like Windows.
57 // http://code.google.com/p/chromium/issues/detail?id=89777 57 // http://code.google.com/p/chromium/issues/detail?id=89777
58 NOTIMPLEMENTED(); 58 NOTIMPLEMENTED();
59 return; 59 return;
60 #else 60 #else
61 61
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 int new_count = --host_monitor_counts_[renderer]; 184 int new_count = --host_monitor_counts_[renderer];
185 if (new_count == 0) { 185 if (new_count == 0) {
186 host_monitor_counts_.erase(renderer); 186 host_monitor_counts_.erase(renderer);
187 registrar_.Remove( 187 registrar_.Remove(
188 this, 188 this,
189 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK , 189 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK ,
190 renderer_source); 190 renderer_source);
191 } 191 }
192 } 192 }
193 } 193 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_image.cc ('k') | chrome/browser/thumbnails/thumbnail_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698