Stub out picture recorders and operations.

This commit is contained in:
Chinmay Garde
2021-08-11 14:50:23 -07:00
committed by Dan Field
parent d666dd11fe
commit b77f2b8b66
9 changed files with 115 additions and 16 deletions

View File

@@ -14,6 +14,10 @@ impeller_component("aiks") {
"paint.h",
"picture.cc",
"picture.h",
"picture_operation.cc",
"picture_operation.h",
"picture_recorder.cc",
"picture_recorder.h",
]
public_deps = [

View File

@@ -5,6 +5,7 @@
#include "impeller/aiks/canvas.h"
#include "flutter/fml/logging.h"
#include "impeller/aiks/picture_operation.h"
namespace impeller {
@@ -52,24 +53,18 @@ size_t Canvas::GetSaveCount() const {
return xformation_stack_.size();
}
void Canvas::DrawPath(Path path, Paint paint) {
FML_LOG(ERROR) << "WIP";
}
void Canvas::DrawPath(Path path, Paint paint) {}
void Canvas::SaveLayer(const Paint& paint, std::optional<Rect> bounds) {
FML_LOG(ERROR) << "WIP";
}
void Canvas::SaveLayer(const Paint& paint, std::optional<Rect> bounds) {}
void Canvas::ClipPath(Path path) {
FML_LOG(ERROR) << "WIP";
}
void Canvas::ClipPath(Path path) {}
void Canvas::DrawShadow(Path path, Color color, Scalar elevation) {
FML_LOG(ERROR) << "WIP";
}
void Canvas::DrawShadow(Path path, Color color, Scalar elevation) {}
void Canvas::DrawPicture(std::shared_ptr<Picture> picture) {
FML_LOG(ERROR) << "WIP";
void Canvas::DrawPicture(std::shared_ptr<Picture> picture) {}
std::shared_ptr<Picture> Canvas::EndRecordingAsPicture() {
return std::make_shared<Picture>(std::move(ops_));
}
} // namespace impeller

View File

@@ -7,6 +7,7 @@
#include <memory>
#include <optional>
#include <stack>
#include <vector>
#include "flutter/fml/macros.h"
#include "impeller/aiks/paint.h"
@@ -17,6 +18,8 @@
namespace impeller {
class PictureOperation;
class Canvas {
public:
Canvas();
@@ -49,8 +52,11 @@ class Canvas {
void DrawPicture(std::shared_ptr<Picture> picture);
std::shared_ptr<Picture> EndRecordingAsPicture();
private:
std::stack<Matrix> xformation_stack_;
std::vector<std::unique_ptr<PictureOperation>> ops_;
FML_DISALLOW_COPY_AND_ASSIGN(Canvas);
};

View File

@@ -4,9 +4,12 @@
#include "impeller/aiks/picture.h"
#include "impeller/aiks/picture_operation.h"
namespace impeller {
Picture::Picture() = default;
Picture::Picture(std::vector<std::unique_ptr<PictureOperation>> operations)
: ops_(std::move(operations)) {}
Picture::~Picture() = default;

View File

@@ -4,17 +4,24 @@
#pragma once
#include <memory>
#include <vector>
#include "flutter/fml/macros.h"
namespace impeller {
class PictureOperation;
class Picture {
public:
Picture();
Picture(std::vector<std::unique_ptr<PictureOperation>> operations);
~Picture();
private:
std::vector<std::unique_ptr<PictureOperation>> ops_;
FML_DISALLOW_COPY_AND_ASSIGN(Picture);
};

View File

@@ -0,0 +1,13 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/impeller/aiks/picture_operation.h"
namespace impeller {
PictureOperation::PictureOperation() = default;
PictureOperation::~PictureOperation() = default;
} // namespace impeller

View File

@@ -0,0 +1,21 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "flutter/fml/macros.h"
namespace impeller {
class PictureOperation {
public:
PictureOperation();
~PictureOperation();
private:
FML_DISALLOW_COPY_AND_ASSIGN(PictureOperation);
};
} // namespace impeller

View File

@@ -0,0 +1,23 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/impeller/aiks/picture_recorder.h"
#include "flutter/impeller/aiks/canvas.h"
namespace impeller {
PictureRecorder::PictureRecorder() : canvas_(std::make_shared<Canvas>()) {}
PictureRecorder::~PictureRecorder() = default;
std::shared_ptr<Canvas> PictureRecorder::GetCanvas() const {
return canvas_;
}
std::shared_ptr<Picture> PictureRecorder::EndRecordingAsPicture() {
return canvas_->EndRecordingAsPicture();
}
} // namespace impeller

View File

@@ -0,0 +1,27 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "flutter/fml/macros.h"
#include "impeller/aiks/canvas.h"
#include "impeller/aiks/picture.h"
namespace impeller {
class PictureRecorder {
public:
PictureRecorder();
~PictureRecorder();
std::shared_ptr<Canvas> GetCanvas() const;
std::shared_ptr<Picture> EndRecordingAsPicture();
private:
std::shared_ptr<Canvas> canvas_;
};
} // namespace impeller