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/dri/dri_surface_factory.h" | 5 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
6 | 6 |
7 #include <drm.h> | 7 #include <drm.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <xf86drm.h> | 9 #include <xf86drm.h> |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 // The DriSurface is double buffered, so the current back buffer is | 109 // The DriSurface is double buffered, so the current back buffer is |
110 // missing the previous update. Expand damage region. | 110 // missing the previous update. Expand damage region. |
111 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); | 111 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); |
112 | 112 |
113 // Copy damage region. | 113 // Copy damage region. |
114 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); | 114 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); |
115 image->draw(canvas, &real_damage, real_damage, NULL); | 115 image->draw(canvas, &real_damage, real_damage, NULL); |
116 | 116 |
117 last_damage_ = damage; | 117 last_damage_ = damage; |
118 CHECK(dri_->SchedulePageFlip(widget_)); | 118 dri_->SchedulePageFlip(widget_); |
119 } | 119 } |
120 | 120 |
121 scoped_ptr<gfx::VSyncProvider> DriSurfaceAdapter::CreateVSyncProvider() { | 121 scoped_ptr<gfx::VSyncProvider> DriSurfaceAdapter::CreateVSyncProvider() { |
122 return dri_->CreateVSyncProvider(widget_); | 122 return dri_->CreateVSyncProvider(widget_); |
123 } | 123 } |
124 | 124 |
125 } // namespace | 125 } // namespace |
126 | 126 |
127 // static | 127 // static |
128 const gfx::AcceleratedWidget DriSurfaceFactory::kDefaultWidgetHandle = 1; | 128 const gfx::AcceleratedWidget DriSurfaceFactory::kDefaultWidgetHandle = 1; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 HardwareDisplayController* DriSurfaceFactory::GetControllerForWidget( | 373 HardwareDisplayController* DriSurfaceFactory::GetControllerForWidget( |
374 gfx::AcceleratedWidget w) { | 374 gfx::AcceleratedWidget w) { |
375 CHECK_GE(w, 1); | 375 CHECK_GE(w, 1); |
376 CHECK_LE(static_cast<size_t>(w), controllers_.size()); | 376 CHECK_LE(static_cast<size_t>(w), controllers_.size()); |
377 | 377 |
378 return controllers_[w - 1]; | 378 return controllers_[w - 1]; |
379 } | 379 } |
380 | 380 |
381 } // namespace ui | 381 } // namespace ui |
OLD | NEW |