| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType); | 80 viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType); |
| 81 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); | 81 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DriSurfaceAdapter::PresentCanvas(const gfx::Rect& damage) { | 84 void DriSurfaceAdapter::PresentCanvas(const gfx::Rect& damage) { |
| 85 CHECK(base::MessageLoopForUI::IsCurrent()); | 85 CHECK(base::MessageLoopForUI::IsCurrent()); |
| 86 if (!controller_) | 86 if (!controller_) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 UpdateNativeSurface(damage); | 89 UpdateNativeSurface(damage); |
| 90 controller_->SchedulePageFlip(); | 90 controller_->SchedulePageFlip(NULL); |
| 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 = static_cast<DriSurface*>(controller_->surface()) | 99 SkCanvas* canvas = static_cast<DriSurface*>(controller_->surface()) |
| 100 ->GetDrawableForWidget(); | 100 ->GetDrawableForWidget(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 controller->SetCursor(cursor_surface_.get()); | 234 controller->SetCursor(cursor_surface_.get()); |
| 235 } | 235 } |
| 236 } else { | 236 } else { |
| 237 // No cursor set. | 237 // No cursor set. |
| 238 if (controller) | 238 if (controller) |
| 239 controller->UnsetCursor(); | 239 controller->UnsetCursor(); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace ui | 243 } // namespace ui |
| OLD | NEW |