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

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

Issue 10540144: Tag TransportDIBs with the device scale factor they expect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 6 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 <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 } 1293 }
1294 1294
1295 // Paint the backing store. This will update it with the 1295 // Paint the backing store. This will update it with the
1296 // renderer-supplied bits. The view will read out of the backing store 1296 // renderer-supplied bits. The view will read out of the backing store
1297 // later to actually draw to the screen. 1297 // later to actually draw to the screen.
1298 was_async = PaintBackingStoreRect( 1298 was_async = PaintBackingStoreRect(
1299 params.bitmap, 1299 params.bitmap,
1300 params.bitmap_rect, 1300 params.bitmap_rect,
1301 params.copy_rects, 1301 params.copy_rects,
1302 params.view_size, 1302 params.view_size,
1303 params.scale_factor,
1303 base::Bind(&RenderWidgetHostImpl::DidUpdateBackingStore, 1304 base::Bind(&RenderWidgetHostImpl::DidUpdateBackingStore,
1304 weak_factory_.GetWeakPtr(), params, paint_start)); 1305 weak_factory_.GetWeakPtr(), params, paint_start));
1305 } 1306 }
1306 } 1307 }
1307 1308
1308 if (!was_async) { 1309 if (!was_async) {
1309 DidUpdateBackingStore(params, paint_start); 1310 DidUpdateBackingStore(params, paint_start);
1310 } 1311 }
1311 1312
1312 if (should_auto_resize_) { 1313 if (should_auto_resize_) {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 if (view_) 1570 if (view_)
1570 *results = view_->GetRootWindowBounds(); 1571 *results = view_->GetRootWindowBounds();
1571 } 1572 }
1572 #endif 1573 #endif
1573 1574
1574 bool RenderWidgetHostImpl::PaintBackingStoreRect( 1575 bool RenderWidgetHostImpl::PaintBackingStoreRect(
1575 TransportDIB::Id bitmap, 1576 TransportDIB::Id bitmap,
1576 const gfx::Rect& bitmap_rect, 1577 const gfx::Rect& bitmap_rect,
1577 const std::vector<gfx::Rect>& copy_rects, 1578 const std::vector<gfx::Rect>& copy_rects,
1578 const gfx::Size& view_size, 1579 const gfx::Size& view_size,
1580 float scale_factor,
1579 const base::Closure& completion_callback) { 1581 const base::Closure& completion_callback) {
1580 // The view may be destroyed already. 1582 // The view may be destroyed already.
1581 if (!view_) 1583 if (!view_)
1582 return false; 1584 return false;
1583 1585
1584 if (is_hidden_) { 1586 if (is_hidden_) {
1585 // Don't bother updating the backing store when we're hidden. Just mark it 1587 // Don't bother updating the backing store when we're hidden. Just mark it
1586 // as being totally invalid. This will cause a complete repaint when the 1588 // as being totally invalid. This will cause a complete repaint when the
1587 // view is restored. 1589 // view is restored.
1588 needs_repainting_on_restore_ = true; 1590 needs_repainting_on_restore_ = true;
1589 return false; 1591 return false;
1590 } 1592 }
1591 1593
1592 bool needs_full_paint = false; 1594 bool needs_full_paint = false;
1593 bool scheduled_completion_callback = false; 1595 bool scheduled_completion_callback = false;
1594 BackingStoreManager::PrepareBackingStore(this, view_size, bitmap, bitmap_rect, 1596 BackingStoreManager::PrepareBackingStore(this, view_size, bitmap, bitmap_rect,
1595 copy_rects, completion_callback, 1597 copy_rects, scale_factor,
1598 completion_callback,
1596 &needs_full_paint, 1599 &needs_full_paint,
1597 &scheduled_completion_callback); 1600 &scheduled_completion_callback);
1598 if (needs_full_paint) { 1601 if (needs_full_paint) {
1599 repaint_start_time_ = TimeTicks::Now(); 1602 repaint_start_time_ = TimeTicks::Now();
1600 repaint_ack_pending_ = true; 1603 repaint_ack_pending_ = true;
1601 Send(new ViewMsg_Repaint(routing_id_, view_size)); 1604 Send(new ViewMsg_Repaint(routing_id_, view_size));
1602 } 1605 }
1603 1606
1604 return scheduled_completion_callback; 1607 return scheduled_completion_callback;
1605 } 1608 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 // indicate that no callback is in progress (i.e. without this line 1842 // indicate that no callback is in progress (i.e. without this line
1840 // DelayedAutoResized will not get called again). 1843 // DelayedAutoResized will not get called again).
1841 new_auto_size_.SetSize(0, 0); 1844 new_auto_size_.SetSize(0, 0);
1842 if (!should_auto_resize_) 1845 if (!should_auto_resize_)
1843 return; 1846 return;
1844 1847
1845 OnRenderAutoResized(new_size); 1848 OnRenderAutoResized(new_size);
1846 } 1849 }
1847 1850
1848 } // namespace content 1851 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698