| 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 <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 UpdateNativeSurface(damage); | 89 UpdateNativeSurface(damage); |
| 90 controller_->SchedulePageFlip(); | 90 controller_->SchedulePageFlip(); |
| 91 controller_->WaitForPageFlipEvent(); | 91 controller_->WaitForPageFlipEvent(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 scoped_ptr<gfx::VSyncProvider> DriSurfaceAdapter::CreateVSyncProvider() { | 94 scoped_ptr<gfx::VSyncProvider> DriSurfaceAdapter::CreateVSyncProvider() { |
| 95 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); | 95 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void DriSurfaceAdapter::UpdateNativeSurface(const gfx::Rect& damage) { | 98 void DriSurfaceAdapter::UpdateNativeSurface(const gfx::Rect& damage) { |
| 99 SkCanvas* canvas = controller_->surface()->GetDrawableForWidget(); | 99 SkCanvas* canvas = static_cast<DriSurface*>(controller_->surface()) |
| 100 ->GetDrawableForWidget(); |
| 100 | 101 |
| 101 // The DriSurface is double buffered, so the current back buffer is | 102 // The DriSurface is double buffered, so the current back buffer is |
| 102 // missing the previous update. Expand damage region. | 103 // missing the previous update. Expand damage region. |
| 103 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); | 104 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); |
| 104 | 105 |
| 105 // Copy damage region. | 106 // Copy damage region. |
| 106 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); | 107 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); |
| 107 image->draw(canvas, &real_damage, real_damage, NULL); | 108 image->draw(canvas, &real_damage, real_damage, NULL); |
| 108 | 109 |
| 109 last_damage_ = damage; | 110 last_damage_ = damage; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 controller->SetCursor(cursor_surface_.get()); | 244 controller->SetCursor(cursor_surface_.get()); |
| 244 } | 245 } |
| 245 } else { | 246 } else { |
| 246 // No cursor set. | 247 // No cursor set. |
| 247 if (controller) | 248 if (controller) |
| 248 controller->UnsetCursor(); | 249 controller->UnsetCursor(); |
| 249 } | 250 } |
| 250 } | 251 } |
| 251 | 252 |
| 252 } // namespace ui | 253 } // namespace ui |
| OLD | NEW |