| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gpu/gpu_backing_store_win.h" | 5 #include "chrome/gpu/gpu_backing_store_win.h" |
| 6 | 6 |
| 7 #include "app/win_util.h" | 7 #include "app/win_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/common/gpu_messages.h" | 9 #include "chrome/common/gpu_messages.h" |
| 10 #include "chrome/gpu/gpu_view_win.h" | 10 #include "chrome/gpu/gpu_view_win.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 HANDLE source_process_handle = OpenProcess(PROCESS_ALL_ACCESS, | 123 HANDLE source_process_handle = OpenProcess(PROCESS_ALL_ACCESS, |
| 124 FALSE, source_process_id); | 124 FALSE, source_process_id); |
| 125 CHECK(source_process_handle); | 125 CHECK(source_process_handle); |
| 126 | 126 |
| 127 // On Windows we need to duplicate the handle from the remote process. | 127 // On Windows we need to duplicate the handle from the remote process. |
| 128 // See BrowserRenderProcessHost::MapTransportDIB for how to do this on other | 128 // See BrowserRenderProcessHost::MapTransportDIB for how to do this on other |
| 129 // platforms. | 129 // platforms. |
| 130 HANDLE section = win_util::GetSectionFromProcess( | 130 HANDLE section = win_util::GetSectionFromProcess( |
| 131 id.handle, source_process_handle, false /* read write */); | 131 id.handle, source_process_handle, false /* read write */); |
| 132 CHECK(section); | 132 CHECK(section); |
| 133 TransportDIB* dib = TransportDIB::Map(section); | 133 scoped_ptr<TransportDIB> dib(TransportDIB::Map(section)); |
| 134 CHECK(dib); | 134 CHECK(dib.get()); |
| 135 | 135 |
| 136 if (!backing_store_dib_) { | 136 if (!backing_store_dib_) { |
| 137 backing_store_dib_ = CreateDIB(hdc_, size_.width(), | 137 backing_store_dib_ = CreateDIB(hdc_, size_.width(), |
| 138 size_.height(), color_depth_); | 138 size_.height(), color_depth_); |
| 139 if (!backing_store_dib_) { | 139 if (!backing_store_dib_) { |
| 140 NOTREACHED(); | 140 NOTREACHED(); |
| 141 | 141 |
| 142 // TODO(brettw): do this in such a way that we can't forget to | 142 // TODO(brettw): do this in such a way that we can't forget to |
| 143 // send the ACK. | 143 // send the ACK. |
| 144 gpu_thread_->Send(new GpuHostMsg_PaintToBackingStore_ACK(routing_id_)); | 144 gpu_thread_->Send(new GpuHostMsg_PaintToBackingStore_ACK(routing_id_)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const gfx::Rect& clip_rect, | 176 const gfx::Rect& clip_rect, |
| 177 const gfx::Size& view_size) { | 177 const gfx::Size& view_size) { |
| 178 RECT damaged_rect, r = clip_rect.ToRECT(); | 178 RECT damaged_rect, r = clip_rect.ToRECT(); |
| 179 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect); | 179 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect); |
| 180 | 180 |
| 181 // TODO(darin): this doesn't work if dx and dy are both non-zero! | 181 // TODO(darin): this doesn't work if dx and dy are both non-zero! |
| 182 DCHECK(dx == 0 || dy == 0); | 182 DCHECK(dx == 0 || dy == 0); |
| 183 | 183 |
| 184 view_->DidScrollBackingStoreRect(dx, dy, clip_rect); | 184 view_->DidScrollBackingStoreRect(dx, dy, clip_rect); |
| 185 } | 185 } |
| OLD | NEW |