Chromium Code Reviews| Index: ui/ozone/platform/dri/gbm_surfaceless.cc |
| diff --git a/ui/ozone/platform/dri/gbm_surfaceless.cc b/ui/ozone/platform/dri/gbm_surfaceless.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..456436a79a90e2d98c98001ada0e4f33d9195093 |
| --- /dev/null |
| +++ b/ui/ozone/platform/dri/gbm_surfaceless.cc |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/ozone/platform/dri/gbm_surfaceless.h" |
| + |
| +#include "ui/ozone/platform/dri/dri_vsync_provider.h" |
| +#include "ui/ozone/platform/dri/gbm_buffer.h" |
| + |
| +namespace ui { |
| + |
| +GbmSurfaceless::GbmSurfaceless( |
| + const base::WeakPtr<HardwareDisplayController>& controller) |
| + : controller_(controller) {} |
| + |
| +GbmSurfaceless::~GbmSurfaceless() {} |
| + |
| +intptr_t GbmSurfaceless::GetNativeWindow() { |
| + NOTREACHED(); |
| + return 0; |
| +} |
| + |
| +bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { |
| + NOTIMPLEMENTED(); |
| + return false; |
| +} |
| + |
| +bool GbmSurfaceless::OnSwapBuffers() { |
| + if (!controller_) |
| + return false; |
| + |
| + bool success = controller_->SchedulePageFlip(queued_planes_); |
| + queued_planes_.clear(); |
| + if (success) |
| + controller_->WaitForPageFlipEvent(); |
| + |
| + return success; |
| +} |
| + |
| +scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { |
| + return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); |
| +} |
| + |
| +bool GbmSurfaceless::ScheduleOverlayPlane( |
| + int plane_z_order, |
| + gfx::OverlayTransform plane_transform, |
| + scoped_refptr<ui::NativePixmap> buffer, |
| + const gfx::Rect& display_bounds, |
| + const gfx::RectF& crop_rect) { |
| + scoped_refptr<GbmPixmap> pixmap = |
| + static_cast<GbmPixmap*>(buffer.get()); |
| + if (!pixmap) { |
| + LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer"; |
|
alexst (slow to review)
2014/07/22 12:45:09
period at the end.
dnicoara
2014/07/22 14:05:46
Done.
|
| + return false; |
| + } |
| + |
| + queued_planes_.push_back(OverlayPlane(pixmap->buffer(), |
| + plane_z_order, |
| + plane_transform, |
| + display_bounds, |
| + crop_rect)); |
| + return true; |
| +} |
| + |
| +} // namespace ui |