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

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

Issue 249413003: ozone: dri: Composite to intermediate surface & copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor cleanup Created 6 years, 8 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: ui/ozone/platform/dri/dri_surface_factory.cc
diff --git a/ui/ozone/platform/dri/dri_surface_factory.cc b/ui/ozone/platform/dri/dri_surface_factory.cc
index 1a14d41f77a2b4eed284a9bcc4cf31042545cce8..d1c1aa3530f3543bef06a8c1ec41e043bd36e3c7 100644
--- a/ui/ozone/platform/dri/dri_surface_factory.cc
+++ b/ui/ozone/platform/dri/dri_surface_factory.cc
@@ -12,6 +12,7 @@
#include "base/message_loop/message_loop.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkDevice.h"
+#include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/ozone/surface_ozone_canvas.h"
#include "ui/ozone/platform/dri/dri_surface.h"
@@ -78,15 +79,25 @@ class DriSurfaceAdapter : public gfx::SurfaceOzoneCanvas {
: widget_(w), dri_(dri) {}
virtual ~DriSurfaceAdapter() {}
- // gfx::SurfaceOzoneCanvas overrides:
+ // SurfaceOzoneCanvas:
virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE {
- return skia::SharePtr(dri_->GetCanvasForWidget(widget_));
+ return skia::SharePtr(surface_->getCanvas());
}
virtual bool ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE {
- NOTIMPLEMENTED();
- return false;
+ SkImageInfo info = SkImageInfo::MakeN32(
danakj 2014/04/23 19:05:38 Is there any test to show this working now?
spang 2014/04/23 20:57:18 Resize at runtime isn't really supported. I'm usin
+ viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType);
+ surface_ = skia::AdoptRef(SkSurface::NewRaster(info));
+ return true;
}
- virtual bool PresentCanvas() OVERRIDE {
+ virtual bool PresentCanvas(const gfx::Rect& damage) OVERRIDE {
+ SkCanvas* canvas = dri_->GetCanvasForWidget(widget_);
+ SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_));
danakj 2014/04/23 19:05:38 Why do you always present a damage rect for two ca
spang 2014/04/23 20:57:18 The incoming buffer is missing the prior update du
+
+ // Copy damage region.
+ skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot());
+ image->draw(canvas, &real_damage, real_damage, NULL);
+
+ last_damage_ = damage;
return dri_->SchedulePageFlip(widget_);
}
virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE {
@@ -94,6 +105,9 @@ class DriSurfaceAdapter : public gfx::SurfaceOzoneCanvas {
}
private:
+ skia::RefPtr<SkSurface> surface_;
+ gfx::Rect last_damage_;
+
gfx::AcceleratedWidget widget_;
DriSurfaceFactory* dri_;
};

Powered by Google App Engine
This is Rietveld 408576698