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

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: rebase 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 | « content/browser/compositor/software_output_device_ozone.h ('k') | ui/aura/window_tree_host_ozone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ad7d031dc22a0a9f975804902f118c5c4c9d09e5..44b5e1b85ff48c354178278afe4da673bcb34d51 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() {
@@ -34,18 +35,16 @@ void SoftwareOutputDeviceOzone::Resize(const gfx::Size& viewport_size) {
return;
viewport_size_ = viewport_size;
- gfx::Rect bounds(viewport_size_);
- gfx::SurfaceFactoryOzone* factory = gfx::SurfaceFactoryOzone::GetInstance();
- factory->AttemptToResizeAcceleratedWidget(compositor_->widget(),
- bounds);
-
- canvas_ = skia::SharePtr(factory->GetCanvasForWidget(realized_widget_));
+ surface_ozone_->ResizeCanvas(viewport_size_);
}
SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) {
DCHECK(gfx::Rect(viewport_size_).Contains(damage_rect));
+ // Get canvas for next frame.
+ canvas_ = surface_ozone_->GetCanvas();
+
canvas_->clipRect(gfx::RectToSkRect(damage_rect), SkRegion::kReplace_Op);
// Save the current state so we can restore once we're done drawing. This is
// saved after the clip since we want to keep the clip information after we're
@@ -63,9 +62,8 @@ void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) {
if (damage_rect_.IsEmpty())
return;
- bool scheduled = gfx::SurfaceFactoryOzone::GetInstance()->SchedulePageFlip(
- compositor_->widget());
- DCHECK(scheduled) << "Failed to schedule pageflip";
+ bool scheduled = surface_ozone_->PresentCanvas();
+ DCHECK(scheduled) << "Failed to present canvas";
}
} // namespace content
« no previous file with comments | « content/browser/compositor/software_output_device_ozone.h ('k') | ui/aura/window_tree_host_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698