Files
engine/content_handler/software_rasterizer.h
T
freiling 2a4af6906e Back Vulkan Rasterizer with Mozart View (#3568)
This version does not recycle buffers. It is meant only as an initial solution,
and the proper buffer recycling logic has been broken out into a separate change
2017-04-07 17:22:53 -07:00

51 lines
1.4 KiB
C++

// Copyright 2017 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 FLUTTER_CONTENT_HANDLER_SOFTWARE_RASTERIZER_H_
#define FLUTTER_CONTENT_HANDLER_SOFTWARE_RASTERIZER_H_
#include <memory>
#include "apps/mozart/services/buffers/cpp/buffer_producer.h"
#include "flutter/content_handler/rasterizer.h"
#include "flutter/flow/compositor_context.h"
#include "lib/ftl/macros.h"
namespace flutter_runner {
class SoftwareRasterizer : public Rasterizer {
public:
SoftwareRasterizer();
~SoftwareRasterizer() override;
void SetScene(fidl::InterfaceHandle<mozart::Scene> scene) override;
void Draw(std::unique_ptr<flow::LayerTree> layer_tree,
ftl::Closure callback) override;
private:
class RasterSurfaceProducer
: public flow::SceneUpdateContext::SurfaceProducer {
public:
RasterSurfaceProducer();
sk_sp<SkSurface> ProduceSurface(SkISize size,
mozart::ImagePtr* out_image) override;
void Tick() { buffer_producer_->Tick(); }
private:
std::unique_ptr<mozart::BufferProducer> buffer_producer_;
};
mozart::ScenePtr scene_;
std::unique_ptr<RasterSurfaceProducer> surface_producer_;
flow::CompositorContext compositor_context_;
FTL_DISALLOW_COPY_AND_ASSIGN(SoftwareRasterizer);
};
} // namespace flutter_runner
#endif // FLUTTER_CONTENT_HANDLER_SOFTWARE_RASTERIZER_H_