Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: ui/gfx/ozone/dri/dri_surface_factory.cc

Issue 208553004: ozone: dri: Do initial cursor set (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/ozone/dri/dri_surface_factory.h ('k') | ui/gfx/ozone/dri/hardware_display_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ozone/dri/dri_surface_factory.cc
diff --git a/ui/gfx/ozone/dri/dri_surface_factory.cc b/ui/gfx/ozone/dri/dri_surface_factory.cc
index 5166679ad52b7fdb5e7bd1cdcb37c6a20d88d072..9eb5598c6eca14847d2914119fd6cfd9858925a6 100644
--- a/ui/gfx/ozone/dri/dri_surface_factory.cc
+++ b/ui/gfx/ozone/dri/dri_surface_factory.cc
@@ -211,6 +211,9 @@ gfx::AcceleratedWidget DriSurfaceFactory::RealizeAcceleratedWidget(
return gfx::kNullAcceleratedWidget;
}
+ // Initial cursor set.
+ ResetCursor();
+
return reinterpret_cast<gfx::AcceleratedWidget>(controller_->get_surface());
}
@@ -273,17 +276,19 @@ scoped_ptr<gfx::VSyncProvider> DriSurfaceFactory::CreateVSyncProvider(
void DriSurfaceFactory::SetHardwareCursor(gfx::AcceleratedWidget window,
const SkBitmap& image,
const gfx::Point& location) {
+ cursor_bitmap_ = image;
+ cursor_location_ = location;
+
if (state_ != INITIALIZED)
return;
- UpdateCursorImage(cursor_surface_.get(), image);
- controller_->MoveCursor(location);
- controller_->SetCursor(*cursor_surface_.get());
- cursor_surface_->SwapBuffers();
+ ResetCursor();
}
void DriSurfaceFactory::MoveHardwareCursor(gfx::AcceleratedWidget window,
const gfx::Point& location) {
+ cursor_location_ = location;
+
if (state_ != INITIALIZED)
return;
@@ -291,10 +296,12 @@ void DriSurfaceFactory::MoveHardwareCursor(gfx::AcceleratedWidget window,
}
void DriSurfaceFactory::UnsetHardwareCursor(gfx::AcceleratedWidget window) {
+ cursor_bitmap_.reset();
+
if (state_ != INITIALIZED)
return;
- controller_->UnsetCursor();
+ ResetCursor();
}
////////////////////////////////////////////////////////////////////////////////
@@ -367,4 +374,20 @@ void DriSurfaceFactory::WaitForPageFlipEvent(int fd) {
drmHandleEvent(fd, &drm_event);
}
+void DriSurfaceFactory::ResetCursor() {
+ if (!cursor_bitmap_.empty()) {
+ // Draw new cursor into backbuffer.
+ UpdateCursorImage(cursor_surface_.get(), cursor_bitmap_);
+ cursor_surface_->SwapBuffers();
dnicoara 2014/03/21 21:38:35 Could we move this inside HardwareDisplayControlle
spang 2014/03/26 22:26:35 Done.
+
+ // Reset location & buffer.
+ controller_->MoveCursor(cursor_location_);
+ controller_->SetCursor(*cursor_surface_.get());
+ } else {
+ // No cursor set.
+ controller_->UnsetCursor();
+ }
+}
+
+
} // namespace gfx
« no previous file with comments | « ui/gfx/ozone/dri/dri_surface_factory.h ('k') | ui/gfx/ozone/dri/hardware_display_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698