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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 11081007: Remove implicit flooring Scale() method from Point and Size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/public/common/content_switches.h" 42 #include "content/public/common/content_switches.h"
43 #include "content/public/common/result_codes.h" 43 #include "content/public/common/result_codes.h"
44 #include "skia/ext/image_operations.h" 44 #include "skia/ext/image_operations.h"
45 #include "skia/ext/platform_canvas.h" 45 #include "skia/ext/platform_canvas.h"
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
47 #if defined(OS_WIN) 47 #if defined(OS_WIN)
48 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h" 48 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h"
49 #endif 49 #endif
50 #include "ui/base/events/event.h" 50 #include "ui/base/events/event.h"
51 #include "ui/base/keycodes/keyboard_codes.h" 51 #include "ui/base/keycodes/keyboard_codes.h"
52 #include "ui/gfx/size_conversions.h"
52 #include "ui/gfx/skbitmap_operations.h" 53 #include "ui/gfx/skbitmap_operations.h"
53 #include "webkit/glue/webcursor.h" 54 #include "webkit/glue/webcursor.h"
54 #include "webkit/glue/webpreferences.h" 55 #include "webkit/glue/webpreferences.h"
55 #include "webkit/plugins/npapi/webplugin.h" 56 #include "webkit/plugins/npapi/webplugin.h"
56 57
57 #if defined(TOOLKIT_GTK) 58 #if defined(TOOLKIT_GTK)
58 #include "content/browser/renderer_host/backing_store_gtk.h" 59 #include "content/browser/renderer_host/backing_store_gtk.h"
59 #elif defined(OS_MACOSX) 60 #elif defined(OS_MACOSX)
60 #include "content/browser/renderer_host/backing_store_mac.h" 61 #include "content/browser/renderer_host/backing_store_mac.h"
61 #endif 62 #endif
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1423
1423 bool was_async = false; 1424 bool was_async = false;
1424 1425
1425 // If this is a GPU UpdateRect, params.bitmap is invalid and dib will be NULL. 1426 // If this is a GPU UpdateRect, params.bitmap is invalid and dib will be NULL.
1426 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); 1427 TransportDIB* dib = process_->GetTransportDIB(params.bitmap);
1427 1428
1428 // If gpu process does painting, scroll_rect and copy_rects are always empty 1429 // If gpu process does painting, scroll_rect and copy_rects are always empty
1429 // and backing store is never used. 1430 // and backing store is never used.
1430 if (dib) { 1431 if (dib) {
1431 DCHECK(!params.bitmap_rect.IsEmpty()); 1432 DCHECK(!params.bitmap_rect.IsEmpty());
1432 gfx::Size pixel_size = params.bitmap_rect.size().Scale(params.scale_factor); 1433 gfx::Size pixel_size = gfx::ToFlooredSize(
1434 params.bitmap_rect.size().Scale(params.scale_factor));
1433 const size_t size = pixel_size.height() * pixel_size.width() * 4; 1435 const size_t size = pixel_size.height() * pixel_size.width() * 4;
1434 if (dib->size() < size) { 1436 if (dib->size() < size) {
1435 DLOG(WARNING) << "Transport DIB too small for given rectangle"; 1437 DLOG(WARNING) << "Transport DIB too small for given rectangle";
1436 RecordAction(UserMetricsAction("BadMessageTerminate_RWH1")); 1438 RecordAction(UserMetricsAction("BadMessageTerminate_RWH1"));
1437 GetProcess()->ReceivedBadMessage(); 1439 GetProcess()->ReceivedBadMessage();
1438 } else { 1440 } else {
1439 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect", 1441 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect",
1440 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(), 1442 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(),
1441 "color", 0xffffff & *static_cast<uint32*>(dib->memory())); 1443 "color", 0xffffff & *static_cast<uint32*>(dib->memory()));
1442 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth", 1444 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth",
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 return; 2077 return;
2076 2078
2077 OnRenderAutoResized(new_size); 2079 OnRenderAutoResized(new_size);
2078 } 2080 }
2079 2081
2080 void RenderWidgetHostImpl::DetachDelegate() { 2082 void RenderWidgetHostImpl::DetachDelegate() {
2081 delegate_ = NULL; 2083 delegate_ = NULL;
2082 } 2084 }
2083 2085
2084 } // namespace content 2086 } // 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