flutter_flutter/sky/shell/gpu/mojo/rasterizer_mojo.h
Adam Barth 411c6bfa4b Port flutter.mojo to Mozart
Everything should work except the keyboard.
2016-01-28 16:04:19 -08:00

61 lines
1.7 KiB
C++

// Copyright 2016 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_SHELL_GPU_MOJO_RASTERIZER_MOJO_H_
#define SKY_SHELL_GPU_MOJO_RASTERIZER_MOJO_H_
#include "base/memory/weak_ptr.h"
#include "flow/paint_context.h"
#include "mojo/gpu/gl_context_owner.h"
#include "mojo/public/interfaces/application/application_connector.mojom.h"
#include "mojo/services/gfx/composition/interfaces/scenes.mojom.h"
#include "mojo/skia/ganesh_context.h"
#include "sky/shell/gpu/mojo/gl_texture_recycler.h"
#include "sky/shell/rasterizer.h"
namespace sky {
namespace shell {
class RasterizerMojo : public Rasterizer {
public:
explicit RasterizerMojo();
~RasterizerMojo() override;
base::WeakPtr<RasterizerMojo> GetWeakPtr();
base::WeakPtr<Rasterizer> GetWeakRasterizerPtr() override;
void ConnectToRasterizer(
mojo::InterfaceRequest<rasterizer::Rasterizer> request) override;
void Init(mojo::ApplicationConnectorPtr connector,
mojo::gfx::composition::ScenePtr scene);
private:
void Draw(uint64_t layer_tree_ptr, const DrawCallback& callback) override;
struct GLState {
explicit GLState(mojo::ApplicationConnector* connector);
~GLState();
mojo::GLContextOwner gl_context_owner;
GLTextureRecycler gl_texture_recycler;
mojo::skia::GaneshContext ganesh_context;
};
mojo::Binding<rasterizer::Rasterizer> binding_;
mojo::gfx::composition::ScenePtr scene_;
std::unique_ptr<GLState> gl_state_;
flow::PaintContext paint_context_;
base::WeakPtrFactory<RasterizerMojo> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(RasterizerMojo);
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_GPU_MOJO_RASTERIZER_MOJO_H_