OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ozone/platform/drm/gpu/drm_surface.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_surface.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 DCHECK(base::MessageLoopForUI::IsCurrent()); | 66 DCHECK(base::MessageLoopForUI::IsCurrent()); |
67 | 67 |
68 HardwareDisplayController* controller = window_delegate_->GetController(); | 68 HardwareDisplayController* controller = window_delegate_->GetController(); |
69 if (!controller) | 69 if (!controller) |
70 return; | 70 return; |
71 | 71 |
72 DCHECK(buffers_[front_buffer_ ^ 1].get()); | 72 DCHECK(buffers_[front_buffer_ ^ 1].get()); |
73 controller->QueueOverlayPlane(OverlayPlane(buffers_[front_buffer_ ^ 1])); | 73 controller->QueueOverlayPlane(OverlayPlane(buffers_[front_buffer_ ^ 1])); |
74 | 74 |
75 UpdateNativeSurface(damage); | 75 UpdateNativeSurface(damage); |
76 controller->SchedulePageFlip(false /* is_sync */, | 76 controller->SchedulePageFlipWithoutCallback(false /* is_sync */); |
77 base::Bind(&base::DoNothing)); | |
78 | 77 |
79 // Update our front buffer pointer. | 78 // Update our front buffer pointer. |
80 front_buffer_ ^= 1; | 79 front_buffer_ ^= 1; |
81 } | 80 } |
82 | 81 |
83 scoped_ptr<gfx::VSyncProvider> DrmSurface::CreateVSyncProvider() { | 82 scoped_ptr<gfx::VSyncProvider> DrmSurface::CreateVSyncProvider() { |
84 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_)); | 83 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_)); |
85 } | 84 } |
86 | 85 |
87 void DrmSurface::UpdateNativeSurface(const gfx::Rect& damage) { | 86 void DrmSurface::UpdateNativeSurface(const gfx::Rect& damage) { |
88 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas(); | 87 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas(); |
89 | 88 |
90 // The DrmSurface is double buffered, so the current back buffer is | 89 // The DrmSurface is double buffered, so the current back buffer is |
91 // missing the previous update. Expand damage region. | 90 // missing the previous update. Expand damage region. |
92 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); | 91 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); |
93 | 92 |
94 // Copy damage region. | 93 // Copy damage region. |
95 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); | 94 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); |
96 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL); | 95 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL); |
97 | 96 |
98 last_damage_ = damage; | 97 last_damage_ = damage; |
99 } | 98 } |
100 | 99 |
101 } // namespace ui | 100 } // namespace ui |
OLD | NEW |