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

Unified Diff: content/browser/compositor/software_output_device_ozone.cc

Issue 205433002: ozone: Add OzoneSurface object that is owned by compositor, GLSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing InitializeCanvas to FileSurface 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
Index: content/browser/compositor/software_output_device_ozone.cc
diff --git a/content/browser/compositor/software_output_device_ozone.cc b/content/browser/compositor/software_output_device_ozone.cc
index 340eee9947a499ec01ff142a031af8d70f2e7c96..3ecfc1a36cd4e8b10786f6db301faed8ced8cfc2 100644
--- a/content/browser/compositor/software_output_device_ozone.cc
+++ b/content/browser/compositor/software_output_device_ozone.cc
@@ -6,24 +6,25 @@
#include "third_party/skia/include/core/SkDevice.h"
#include "ui/compositor/compositor.h"
#include "ui/gfx/ozone/surface_factory_ozone.h"
+#include "ui/gfx/ozone/surface_ozone.h"
#include "ui/gfx/skia_util.h"
#include "ui/gfx/vsync_provider.h"
namespace content {
SoftwareOutputDeviceOzone::SoftwareOutputDeviceOzone(ui::Compositor* compositor)
- : compositor_(compositor), realized_widget_(gfx::kNullAcceleratedWidget) {
+ : compositor_(compositor) {
gfx::SurfaceFactoryOzone* factory = gfx::SurfaceFactoryOzone::GetInstance();
if (factory->InitializeHardware() != gfx::SurfaceFactoryOzone::INITIALIZED)
LOG(FATAL) << "Failed to initialize hardware in OZONE";
- realized_widget_ = factory->RealizeAcceleratedWidget(compositor_->widget());
+ surface_ozone_ = factory->CreateSurfaceForWidget(compositor_->widget());
- if (realized_widget_ == gfx::kNullAcceleratedWidget)
- LOG(FATAL) << "Failed to get a realized AcceleratedWidget";
+ if (!surface_ozone_->InitializeCanvas())
+ LOG(FATAL) << "Failed to initialize canvas";
- vsync_provider_ = factory->CreateVSyncProvider(realized_widget_);
+ vsync_provider_ = surface_ozone_->CreateVSyncProvider();
}
SoftwareOutputDeviceOzone::~SoftwareOutputDeviceOzone() {
@@ -36,11 +37,9 @@ void SoftwareOutputDeviceOzone::Resize(const gfx::Size& viewport_size) {
viewport_size_ = viewport_size;
gfx::Rect bounds(viewport_size_);
- gfx::SurfaceFactoryOzone* factory = gfx::SurfaceFactoryOzone::GetInstance();
- factory->AttemptToResizeAcceleratedWidget(compositor_->widget(),
- bounds);
+ surface_ozone_->ResizeCanvas(bounds);
- canvas_ = skia::SharePtr(factory->GetCanvasForWidget(realized_widget_));
+ canvas_ = skia::SharePtr(surface_ozone_->GetCanvas());
device_ = skia::SharePtr(canvas_->getDevice());
}
@@ -64,8 +63,7 @@ void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) {
if (damage_rect_.IsEmpty())
return;
- bool scheduled = gfx::SurfaceFactoryOzone::GetInstance()->SchedulePageFlip(
- compositor_->widget());
+ bool scheduled = surface_ozone_->SwapCanvas();
DCHECK(scheduled) << "Failed to schedule pageflip";
}

Powered by Google App Engine
This is Rietveld 408576698