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

Unified Diff: sky/compositor/layer.cc

Issue 797063002: Make reftests work for sky. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address review comments Created 6 years 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 | « sky/compositor/layer.h ('k') | sky/compositor/layer_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/compositor/layer.cc
diff --git a/sky/compositor/layer.cc b/sky/compositor/layer.cc
index 8d2ec8bc811276c8cc19093c7707a95ef7718221..1142093f0c121281a832cad327c1bcc7ac639f37 100644
--- a/sky/compositor/layer.cc
+++ b/sky/compositor/layer.cc
@@ -6,25 +6,29 @@
#include "base/debug/trace_event.h"
#include "mojo/skia/ganesh_surface.h"
+#include "sky/compositor/display_delegate.h"
#include "sky/compositor/layer_host.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace sky {
-Layer::Layer(LayerClient* client) : client_(client), host_(nullptr) {
+Layer::Layer(LayerClient* client)
+ : client_(client),
+ host_(nullptr) {
+ delegate_.reset(DisplayDelegate::create(client));
}
Layer::~Layer() {
}
-void Layer::ClearClient() {
- client_ = nullptr;
-}
-
void Layer::SetSize(const gfx::Size& size) {
size_ = size;
}
+void Layer::GetPixelsForTesting(std::vector<unsigned char>* pixels) {
+ delegate_->GetPixelsForTesting(pixels);
+}
+
void Layer::Display() {
TRACE_EVENT0("sky", "Layer::Display");
@@ -33,11 +37,8 @@ void Layer::Display() {
mojo::GaneshSurface surface(host_->ganesh_context(),
host_->resource_manager()->CreateTexture(size_));
- SkCanvas* canvas = surface.canvas();
-
gfx::Rect rect(size_);
- client_->PaintContents(canvas, rect);
- canvas->flush();
+ delegate_->Paint(surface, rect);
texture_ = surface.TakeTexture();
}
« no previous file with comments | « sky/compositor/layer.h ('k') | sky/compositor/layer_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698