浏览代码

add missing native bindings

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
6a6487f3
共有 6 个文件被更改,包括 211 次插入122 次删除
  1. 59
      com.unity.uiwidgets/Runtime/ui2/compositing.cs
  2. 39
      com.unity.uiwidgets/Runtime/ui2/painting.cs
  3. 2
      engine/Build.bee.cs
  4. 125
      engine/src/lib/ui/compositing/scene_builder.cc
  5. 76
      engine/src/lib/ui/painting/path_measure.cc
  6. 32
      engine/src/lib/ui/painting/path_measure.h

59
com.unity.uiwidgets/Runtime/ui2/compositing.cs


Clip clipBehavior = Clip.none,
PhysicalShapeEngineLayer oldLayer = null) {
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "PhysicalShapeEngineLayer"));
PhysicalShapeEngineLayer layer = new PhysicalShapeEngineLayer(SceneBuilder_pushPhysicalShape(_ptr, path._ptr, elevation, color.value, shadowColor?.value ?? 0xFF000000, (int)clipBehavior));
PhysicalShapeEngineLayer layer = new PhysicalShapeEngineLayer(SceneBuilder_pushPhysicalShape(_ptr, path._ptr, elevation, (int)color.value, (int)(shadowColor?.value ?? 0xFF000000), (int)clipBehavior));
D.assert(_debugPushLayer(layer));
return layer;
}

[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushOffset(IntPtr ptr, float dx, float dy);
/*
int clipBehavior);*/
static IntPtr SceneBuilder_pushClipRect(IntPtr ptr, float left, float right, float top, float bottom,
int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushClipRect is not implemented yet!");
return IntPtr.Zero;
}
int clipBehavior);
/*
static extern unsafe IntPtr SceneBuilder_pushClipRRect(IntPtr ptr, float* rrect, int clipBehavior);*/
static unsafe IntPtr SceneBuilder_pushClipRRect(IntPtr ptr, float* rrect, int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushClipRRect is not implemented yet!");
return IntPtr.Zero;
}
static extern unsafe IntPtr SceneBuilder_pushClipRRect(IntPtr ptr, float* rrect, int clipBehavior);
/*
static extern IntPtr SceneBuilder_pushClipPath(IntPtr ptr, IntPtr path, int clipBehavior);*/
static unsafe IntPtr SceneBuilder_pushClipPath(IntPtr ptr, IntPtr path, int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushClipPath is not implemented yet!");
return IntPtr.Zero;
}
static extern IntPtr SceneBuilder_pushClipPath(IntPtr ptr, IntPtr path, int clipBehavior);
/*
static extern IntPtr SceneBuilder_pushOpacity(IntPtr ptr, int alpha, float dx, float dy);*/
static IntPtr SceneBuilder_pushOpacity(IntPtr ptr, int alpha, float dx, float dy) {
D.assert(false, () => "SceneBuilder_pushOpacity is not implemented yet!");
return IntPtr.Zero;
}
static extern IntPtr SceneBuilder_pushOpacity(IntPtr ptr, int alpha, float dx, float dy);
/*
static extern IntPtr SceneBuilder_pushBackdropFilter(IntPtr ptr, IntPtr filter);*/
static extern IntPtr SceneBuilder_pushBackdropFilter(IntPtr ptr, IntPtr filter);
static IntPtr SceneBuilder_pushBackdropFilter(IntPtr ptr, IntPtr filter) {
D.assert(false, () => "SceneBuilder_pushBackdropFilter is not implemented yet!");
return IntPtr.Zero;
}
/*
float bottom);*/
static void SceneBuilder_addPerformanceOverlay(int enabledOptions, float left, float right, float top,
float bottom) {
D.assert(false, () => "SceneBuilder_addPerformanceOverlay is not implemented yet!");
}
float bottom);
/*
static extern IntPtr SceneBuilder_pushPhysicalShape(IntPtr ptr, IntPtr path, float evelation, uint color,
uint shadowColor, int clipBehavior);*/
static IntPtr SceneBuilder_pushPhysicalShape(IntPtr ptr, IntPtr path, float elevation, uint color,
uint shadowColor, int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushPhysicalShape is not implemented yet!");
return IntPtr.Zero;
}
static extern IntPtr SceneBuilder_pushPhysicalShape(IntPtr ptr, IntPtr path, float evelation, int color,
int shadowColor, int clipBehavior);
[DllImport(NativeBindings.dllName)]
static extern void SceneBuilder_pop(IntPtr ptr);

39
com.unity.uiwidgets/Runtime/ui2/painting.cs


return next;
}
/*
static extern IntPtr PathMeasure_constructor(IntPtr path, bool forcedClosed);*/
static IntPtr PathMeasure_constructor(IntPtr path, bool forcedClosed) {
D.assert(false, () => "PathMeasure_constructor is not implemented yet!");
return IntPtr.Zero;
}
static extern IntPtr PathMeasure_constructor(IntPtr path, bool forcedClosed);
/*
static extern void PathMeasure_dispose(IntPtr ptr);*/
static void PathMeasure_dispose(IntPtr ptr) {
D.assert(false, () => "PathMeasure_dispose is not implemented yet!");
}
static extern void PathMeasure_dispose(IntPtr ptr);
/*
static extern float PathMeasure_length(int contourIndex);*/
static extern float PathMeasure_length(int contourIndex);
static float PathMeasure_length(int contourIndex) {
D.assert(false, () => "PathMeasure_length is not implemented yet!");
return 0;
}
/*
static extern bool PathMeasure_isClosed(int contourIndex);*/
static bool PathMeasure_isClosed(int contourIndex) {
D.assert(false, () => "PathMeasure_isClosed is not implemented yet!");
return true;
}
static extern bool PathMeasure_isClosed(int contourIndex);
/*
static extern bool PathMeasure_nativeNextContour();*/
static bool PathMeasure_nativeNextContour() {
D.assert(false, () => "PathMeasure_nativeNextContour is not implemented yet!");
return false;
}
static extern bool PathMeasure_nativeNextContour();
}
public class ColorFilter : IEquatable<ColorFilter> {

2
engine/Build.bee.cs


"src/lib/ui/painting/multi_frame_codec.h",
"src/lib/ui/painting/path.cc",
"src/lib/ui/painting/path.h",
"src/lib/ui/painting/path_measure.cc",
"src/lib/ui/painting/path_measure.h",
"src/lib/ui/painting/paint.cc",
"src/lib/ui/painting/paint.h",
"src/lib/ui/painting/picture.cc",

125
engine/src/lib/ui/compositing/scene_builder.cc


}
void SceneBuilder::addTexture(float dx, float dy, float width, float height,
int64_t textureId, bool freeze) {
auto layer = std::make_unique<TextureLayer>(
SkPoint::Make(dx, dy), SkSize::Make(width, height), textureId, freeze);
AddLayer(std::move(layer));
int64_t textureId, bool freeze) {
auto layer = std::make_unique<TextureLayer>(
SkPoint::Make(dx, dy), SkSize::Make(width, height), textureId, freeze);
AddLayer(std::move(layer));
float height, int64_t viewId) {
auto layer = std::make_unique<PlatformViewLayer>(
SkPoint::Make(dx, dy), SkSize::Make(width, height), viewId);
AddLayer(std::move(layer));
float height, int64_t viewId) {
auto layer = std::make_unique<PlatformViewLayer>(
SkPoint::Make(dx, dy), SkSize::Make(width, height), viewId);
AddLayer(std::move(layer));
float right, float top, float bottom) {
SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
auto layer = std::make_unique<PerformanceOverlayLayer>(enabledOptions);
layer->set_paint_bounds(rect);
AddLayer(std::move(layer));
float right, float top, float bottom) {
SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
auto layer = std::make_unique<PerformanceOverlayLayer>(enabledOptions);
layer->set_paint_bounds(rect);
AddLayer(std::move(layer));
rasterizer_tracing_threshold_ = frameInterval;
rasterizer_tracing_threshold_ = frameInterval;
checkerboard_raster_cache_images_ = checkerboard;
checkerboard_raster_cache_images_ = checkerboard;
checkerboard_offscreen_layers_ = checkerboard;
checkerboard_offscreen_layers_ = checkerboard;
FML_DCHECK(layer_stack_.size() >= 1);
FML_DCHECK(layer_stack_.size() >= 1);
return Scene::create(layer_stack_[0], rasterizer_tracing_threshold_,
checkerboard_raster_cache_images_,
checkerboard_offscreen_layers_);
return Scene::create(layer_stack_[0], rasterizer_tracing_threshold_,
checkerboard_raster_cache_images_,
checkerboard_offscreen_layers_);
FML_DCHECK(layer);
FML_DCHECK(layer);
if (!layer_stack_.empty()) {
layer_stack_.back()->Add(std::move(layer));
}
if (!layer_stack_.empty()) {
layer_stack_.back()->Add(std::move(layer));
}
AddLayer(layer);
layer_stack_.push_back(std::move(layer));
AddLayer(layer);
layer_stack_.push_back(std::move(layer));
// We never pop the root layer, so that AddLayer operations are always valid.
if (layer_stack_.size() > 1) {
layer_stack_.pop_back();
}
// We never pop the root layer, so that AddLayer operations are always valid.
if (layer_stack_.size() > 1) {
layer_stack_.pop_back();
}
const auto builder = fml::MakeRefCounted<SceneBuilder>();
builder->AddRef();
return builder.get();
const auto builder = fml::MakeRefCounted<SceneBuilder>();
builder->AddRef();
return builder.get();
}
UIWIDGETS_API(void) SceneBuilder_dispose(SceneBuilder* ptr) { ptr->Release(); }

const auto layer = ptr->pushTransform(matrix4);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushTransform(matrix4);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushOffset(dx, dy);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushOffset(dx, dy);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushClipRect(SceneBuilder* ptr, float left, float right, float top, float bottom, int clipBehavior) {
const auto layer = ptr->pushClipRect(left, right, top, bottom, clipBehavior);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushClipRRect(SceneBuilder* ptr, float* rrect, int clipBehavior) {
const auto layer = ptr->pushClipRRect(RRect(rrect), clipBehavior);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushClipPath(SceneBuilder* ptr, CanvasPath* path, int clipBehavior) {
const auto layer = ptr->pushClipPath(path, clipBehavior);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushOpacity(SceneBuilder* ptr, int alpha, float dx, float dy) {
const auto layer = ptr->pushOpacity(alpha, dx, dy);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushBackdropFilter(SceneBuilder* ptr, ImageFilter* filter) {
const auto layer = ptr->pushBackdropFilter(filter);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushPhysicalShape(SceneBuilder* ptr, CanvasPath* path, float elevation, int color, int shadowColor, int clipBehavior) {
const auto layer = ptr->pushPhysicalShape(path, elevation, color, shadowColor, clipBehavior);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(void)
SceneBuilder_addPerformanceOverlay(SceneBuilder* ptr, int enabledOptions, float left, float right, float top, float bottom) {
ptr->addPerformanceOverlay(enabledOptions, left, right, top, bottom);
}
UIWIDGETS_API(void)

76
engine/src/lib/ui/painting/path_measure.cc


#include "path_measure.h"
#include "runtime/mono_state.h"
namespace uiwidgets {
typedef CanvasPathMeasure PathMeasure;
CanvasPathMeasure::CanvasPathMeasure() {}
CanvasPathMeasure::~CanvasPathMeasure() {}
fml::RefPtr<CanvasPathMeasure> CanvasPathMeasure::Create(const CanvasPath* path, bool forceClosed) {
fml::RefPtr<CanvasPathMeasure> pathMeasure = fml::MakeRefCounted<CanvasPathMeasure>();
if (path) {
const SkPath skPath = path->path();
SkScalar resScale = 1;
pathMeasure->path_measure_ = std::make_unique<SkContourMeasureIter>(skPath, forceClosed, resScale);
}
else {
pathMeasure->path_measure_ = std::make_unique<SkContourMeasureIter>();
}
return pathMeasure;
}
void CanvasPathMeasure::setPath(const CanvasPath* path, bool isClosed) {
const SkPath& skPath = path->path();
path_measure_->reset(skPath, isClosed);
}
float CanvasPathMeasure::getLength(int contour_index) {
if (static_cast<std::vector<sk_sp<SkContourMeasure>>::size_type>(
contour_index) < measures_.size()) {
return measures_[contour_index]->length();
}
return -1;
}
bool CanvasPathMeasure::isClosed(int contour_index) {
if (static_cast<std::vector<sk_sp<SkContourMeasure>>::size_type>(
contour_index) < measures_.size()) {
return measures_[contour_index]->isClosed();
}
return false;
}
bool CanvasPathMeasure::nextContour() {
auto measure = path_measure_->next();
if (measure) {
measures_.push_back(std::move(measure));
return true;
}
return false;
}
UIWIDGETS_API(PathMeasure*) PathMeasure_constructor(CanvasPath* path, bool forceClosed) {
const auto pathMeasure = PathMeasure::Create(path, forceClosed);
pathMeasure->AddRef();
return pathMeasure.get();
}
UIWIDGETS_API(void) PathMeasure_dispose(PathMeasure* ptr) { ptr->Release(); }
UIWIDGETS_API(float) PathMeasure_length(PathMeasure* ptr, int contourIndex) {
return ptr->getLength(contourIndex);
}
UIWIDGETS_API(bool) PathMeasure_isClosed(PathMeasure* ptr, int contourIndex) {
return ptr->isClosed(contourIndex);
}
UIWIDGETS_API(bool) PathMeasure_nativeNextContour(PathMeasure* ptr) {
return ptr->nextContour();
}
} // namespace uiwidgets

32
engine/src/lib/ui/painting/path_measure.h


#pragma once
#include <flutter/fml/memory/ref_counted.h>
#include <vector>
#include "include/core/SkContourMeasure.h"
#include "path.h"
namespace uiwidgets {
class CanvasPathMeasure : public fml::RefCountedThreadSafe<CanvasPathMeasure> {
FML_FRIEND_MAKE_REF_COUNTED(CanvasPathMeasure);
public:
~CanvasPathMeasure();
static fml::RefPtr<CanvasPathMeasure> Create(const CanvasPath* path, bool forcedClosed);
void setPath(const CanvasPath* path, bool isClosed);
float getLength(int contour_index);
bool isClosed(int contour_index);
bool nextContour();
private:
CanvasPathMeasure();
std::unique_ptr<SkContourMeasureIter> path_measure_;
std::vector<sk_sp<SkContourMeasure>> measures_;
};
} //namespace uiwidgets
正在加载...
取消
保存