OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/surface/accelerated_surface_win.h" | 5 #include "ui/gfx/surface/accelerated_surface_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 void AcceleratedSurface::Destroy() { | 255 void AcceleratedSurface::Destroy() { |
256 g_present_thread_pool.Pointer()->AcknowledgeEarly( | 256 g_present_thread_pool.Pointer()->AcknowledgeEarly( |
257 FROM_HERE, | 257 FROM_HERE, |
258 device_, | 258 device_, |
259 base::Bind(&AcceleratedSurface::QueriesDestroyed, this)); | 259 base::Bind(&AcceleratedSurface::QueriesDestroyed, this)); |
260 } | 260 } |
261 | 261 |
262 void AcceleratedSurface::AsyncPresentAndAcknowledge( | 262 void AcceleratedSurface::AsyncPresentAndAcknowledge( |
263 const gfx::Size& size, | 263 const gfx::Size& size, |
264 int64 surface_id, | 264 int64 surface_id, |
265 base::Closure completion_task) { | 265 const base::Closure& completion_task) { |
266 const int kRound = 64; | 266 const int kRound = 64; |
267 gfx::Size quantized_size( | 267 gfx::Size quantized_size( |
268 std::max(1, (size.width() + kRound - 1) / kRound * kRound), | 268 std::max(1, (size.width() + kRound - 1) / kRound * kRound), |
269 std::max(1, (size.height() + kRound - 1) / kRound * kRound)); | 269 std::max(1, (size.height() + kRound - 1) / kRound * kRound)); |
270 | 270 |
271 if (pending_size_ != quantized_size) { | 271 if (pending_size_ != quantized_size) { |
272 pending_size_ = quantized_size; | 272 pending_size_ = quantized_size; |
273 base::AtomicRefCountInc(&num_pending_resizes_); | 273 base::AtomicRefCountInc(&num_pending_resizes_); |
274 | 274 |
275 g_present_thread_pool.Pointer()->PostTask( | 275 g_present_thread_pool.Pointer()->PostTask( |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 return; | 422 return; |
423 | 423 |
424 size_ = size; | 424 size_ = size; |
425 | 425 |
426 device_->Clear(0, NULL, D3DCLEAR_TARGET, 0xFFFFFFFF, 0, 0); | 426 device_->Clear(0, NULL, D3DCLEAR_TARGET, 0xFFFFFFFF, 0, 0); |
427 } | 427 } |
428 | 428 |
429 void AcceleratedSurface::DoPresentAndAcknowledge( | 429 void AcceleratedSurface::DoPresentAndAcknowledge( |
430 const gfx::Size& size, | 430 const gfx::Size& size, |
431 int64 surface_id, | 431 int64 surface_id, |
432 base::Closure completion_task) { | 432 const base::Closure& completion_task) { |
433 TRACE_EVENT1("surface", "DoPresentAndAcknowledge", "surface_id", surface_id); | 433 TRACE_EVENT1("surface", "DoPresentAndAcknowledge", "surface_id", surface_id); |
434 | 434 |
435 HRESULT hr; | 435 HRESULT hr; |
436 | 436 |
437 base::AutoLock locked(lock_); | 437 base::AutoLock locked(lock_); |
438 | 438 |
439 // Ensure the task is always run and while the lock is taken. | 439 // Ensure the task is always run and while the lock is taken. |
440 base::ScopedClosureRunner scoped_completion_runner(completion_task); | 440 base::ScopedClosureRunner scoped_completion_runner(completion_task); |
441 | 441 |
442 if (!window_) | 442 if (!window_) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 completion_task); | 511 completion_task); |
512 } | 512 } |
513 | 513 |
514 { | 514 { |
515 TRACE_EVENT0("surface", "Present"); | 515 TRACE_EVENT0("surface", "Present"); |
516 hr = device_->Present(&rect, &rect, NULL, NULL); | 516 hr = device_->Present(&rect, &rect, NULL, NULL); |
517 if (FAILED(hr)) | 517 if (FAILED(hr)) |
518 return; | 518 return; |
519 } | 519 } |
520 } | 520 } |
OLD | NEW |