| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/renderer_host/render_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 6 | 6 |
| 7 #include "base/gfx/native_widget_types.h" | 7 #include "base/gfx/native_widget_types.h" |
| 8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 const size_t size = params.bitmap_rect.height() * | 443 const size_t size = params.bitmap_rect.height() * |
| 444 params.bitmap_rect.width() * 4; | 444 params.bitmap_rect.width() * 4; |
| 445 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); | 445 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); |
| 446 if (dib) { | 446 if (dib) { |
| 447 if (dib->size() < size) { | 447 if (dib->size() < size) { |
| 448 DLOG(WARNING) << "Transport DIB too small for given rectangle"; | 448 DLOG(WARNING) << "Transport DIB too small for given rectangle"; |
| 449 process()->ReceivedBadMessage(ViewHostMsg_PaintRect__ID); | 449 process()->ReceivedBadMessage(ViewHostMsg_PaintRect__ID); |
| 450 } else { | 450 } else { |
| 451 // Paint the backing store. This will update it with the renderer-supplied | 451 // Paint the backing store. This will update it with the renderer-supplied |
| 452 // bits. The view will read out of the backing store later to actually dra
w | 452 // bits. The view will read out of the backing store later to actually |
| 453 // to the screen. | 453 // draw to the screen. |
| 454 PaintBackingStoreRect(dib, params.bitmap_rect, params.view_size); | 454 PaintBackingStoreRect(dib, params.bitmap_rect, params.view_size); |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 | 457 |
| 458 // ACK early so we can prefetch the next PaintRect if there is a next one. | 458 // ACK early so we can prefetch the next PaintRect if there is a next one. |
| 459 // This must be done AFTER we're done painting with the bitmap supplied by the | 459 // This must be done AFTER we're done painting with the bitmap supplied by the |
| 460 // renderer. This ACK is a signal to the renderer that the backing store can | 460 // renderer. This ACK is a signal to the renderer that the backing store can |
| 461 // be re-used, so the bitmap may be invalid after this call. | 461 // be re-used, so the bitmap may be invalid after this call. |
| 462 Send(new ViewMsg_PaintRect_ACK(routing_id_)); | 462 Send(new ViewMsg_PaintRect_ACK(routing_id_)); |
| 463 | 463 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 654 |
| 655 // TODO(darin): do we need to do something else if our backing store is not | 655 // TODO(darin): do we need to do something else if our backing store is not |
| 656 // the same size as the advertised view? maybe we just assume there is a | 656 // the same size as the advertised view? maybe we just assume there is a |
| 657 // full paint on its way? | 657 // full paint on its way? |
| 658 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 658 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 659 if (!backing_store || (backing_store->size() != view_size)) | 659 if (!backing_store || (backing_store->size() != view_size)) |
| 660 return; | 660 return; |
| 661 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 661 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 662 dx, dy, clip_rect, view_size); | 662 dx, dy, clip_rect, view_size); |
| 663 } | 663 } |
| OLD | NEW |