mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This CL teaches the Sky compositor to record an SkPicture instead of just drawing in immediate mode. Using an SkPicture will let us experiment with various optimizations in Skia that preprocess the SkPicture before translating the Skia commands to GL commands. This CL also refactors the "display delegate" system now that we can hand off an SkPicture to a rasterization backend. The new design requires fewer backpointers and removes the static display delegate factory. R=eseidel@google.com Review URL: https://codereview.chromium.org/854303002
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SKY_COMPOSITOR_LAYER_H_
|
|
#define SKY_COMPOSITOR_LAYER_H_
|
|
|
|
#include "base/memory/ref_counted.h"
|
|
#include "mojo/gpu/gl_texture.h"
|
|
#include "skia/ext/refptr.h"
|
|
#include "sky/compositor/layer_client.h"
|
|
#include "sky/compositor/rasterizer.h"
|
|
#include "third_party/skia/include/core/SkPicture.h"
|
|
#include "ui/gfx/geometry/rect.h"
|
|
|
|
namespace sky {
|
|
|
|
class LayerHost;
|
|
|
|
class Layer : public base::RefCounted<Layer> {
|
|
public:
|
|
explicit Layer(LayerClient* client);
|
|
|
|
void SetSize(const gfx::Size& size);
|
|
void Display();
|
|
|
|
scoped_ptr<mojo::GLTexture> GetTexture();
|
|
|
|
const gfx::Size& size() const { return size_; }
|
|
|
|
void set_rasterizer(scoped_ptr<Rasterizer> rasterizer) {
|
|
rasterizer_ = rasterizer.Pass();
|
|
}
|
|
|
|
private:
|
|
friend class base::RefCounted<Layer>;
|
|
~Layer();
|
|
|
|
skia::RefPtr<SkPicture> RecordPicture();
|
|
|
|
LayerClient* client_;
|
|
gfx::Size size_;
|
|
scoped_ptr<mojo::GLTexture> texture_;
|
|
scoped_ptr<Rasterizer> rasterizer_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(Layer);
|
|
};
|
|
|
|
} // namespace sky
|
|
|
|
#endif // SKY_COMPOSITOR_LAYER_H_
|