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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.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 "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 bool was_async = false; 1492 bool was_async = false;
1493 1493
1494 // If this is a GPU UpdateRect, params.bitmap is invalid and dib will be NULL. 1494 // If this is a GPU UpdateRect, params.bitmap is invalid and dib will be NULL.
1495 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); 1495 TransportDIB* dib = process_->GetTransportDIB(params.bitmap);
1496 1496
1497 // If gpu process does painting, scroll_rect and copy_rects are always empty 1497 // If gpu process does painting, scroll_rect and copy_rects are always empty
1498 // and backing store is never used. 1498 // and backing store is never used.
1499 if (dib) { 1499 if (dib) {
1500 DCHECK(!params.bitmap_rect.IsEmpty()); 1500 DCHECK(!params.bitmap_rect.IsEmpty());
1501 gfx::Size pixel_size = gfx::ToFlooredSize( 1501 gfx::Size pixel_size = gfx::ToFlooredSize(
1502 params.bitmap_rect.size().Scale(params.scale_factor)); 1502 gfx::ScaleSize(params.bitmap_rect.size(), params.scale_factor));
1503 const size_t size = pixel_size.height() * pixel_size.width() * 4; 1503 const size_t size = pixel_size.height() * pixel_size.width() * 4;
1504 if (dib->size() < size) { 1504 if (dib->size() < size) {
1505 DLOG(WARNING) << "Transport DIB too small for given rectangle"; 1505 DLOG(WARNING) << "Transport DIB too small for given rectangle";
1506 RecordAction(UserMetricsAction("BadMessageTerminate_RWH1")); 1506 RecordAction(UserMetricsAction("BadMessageTerminate_RWH1"));
1507 GetProcess()->ReceivedBadMessage(); 1507 GetProcess()->ReceivedBadMessage();
1508 } else { 1508 } else {
1509 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect", 1509 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect",
1510 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(), 1510 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(),
1511 "color", 0xffffff & *static_cast<uint32*>(dib->memory())); 1511 "color", 0xffffff & *static_cast<uint32*>(dib->memory()));
1512 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth", 1512 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth",
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 return; 2261 return;
2262 2262
2263 OnRenderAutoResized(new_size); 2263 OnRenderAutoResized(new_size);
2264 } 2264 }
2265 2265
2266 void RenderWidgetHostImpl::DetachDelegate() { 2266 void RenderWidgetHostImpl::DetachDelegate() {
2267 delegate_ = NULL; 2267 delegate_ = NULL;
2268 } 2268 }
2269 2269
2270 } // namespace content 2270 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/dip_util.cc ('k') | content/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698