浏览代码

apply format

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
76c35802
共有 3 个文件被更改,包括 146 次插入136 次删除
  1. 131
      engine/src/lib/ui/compositing/scene_builder.cc
  2. 117
      engine/src/lib/ui/painting/path_measure.cc
  3. 34
      engine/src/lib/ui/painting/path_measure.h

131
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();
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();
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();
const auto layer = ptr->pushClipRRect(RRect(rrect), clipBehavior);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushClipRRect(RRect(rrect), clipBehavior);
layer->AddRef();
return layer.get();
SceneBuilder_pushClipPath(SceneBuilder* ptr, CanvasPath* path, int clipBehavior) {
const auto layer = ptr->pushClipPath(path, clipBehavior);
layer->AddRef();
return layer.get();
SceneBuilder_pushClipPath(SceneBuilder* ptr, CanvasPath* path,
int clipBehavior) {
const auto layer = ptr->pushClipPath(path, clipBehavior);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushOpacity(alpha, dx, dy);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushOpacity(alpha, dx, dy);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushBackdropFilter(filter);
layer->AddRef();
return layer.get();
const auto layer = ptr->pushBackdropFilter(filter);
layer->AddRef();
return layer.get();
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();
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();
SceneBuilder_addPerformanceOverlay(SceneBuilder* ptr, int enabledOptions, float left, float right, float top, float bottom) {
ptr->addPerformanceOverlay(enabledOptions, left, right, top, bottom);
SceneBuilder_addPerformanceOverlay(SceneBuilder* ptr, int enabledOptions,
float left, float right, float top,
float bottom) {
ptr->addPerformanceOverlay(enabledOptions, left, right, top, bottom);
}
UIWIDGETS_API(void)

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


#include "runtime/mono_state.h"
namespace uiwidgets {
typedef CanvasPathMeasure PathMeasure;
typedef CanvasPathMeasure PathMeasure;
CanvasPathMeasure::CanvasPathMeasure() {}
CanvasPathMeasure::CanvasPathMeasure() {}
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>();
}
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;
}
return pathMeasure;
}
void CanvasPathMeasure::setPath(const CanvasPath* path, bool isClosed) {
const SkPath& skPath = path->path();
path_measure_->reset(skPath, isClosed);
}
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;
}
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::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;
}
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(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(void) PathMeasure_dispose(PathMeasure* ptr) { ptr->Release(); }
UIWIDGETS_API(float) PathMeasure_length(PathMeasure* ptr, int contourIndex) {
return ptr->getLength(contourIndex);
}
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_isClosed(PathMeasure* ptr, int contourIndex) {
return ptr->isClosed(contourIndex);
}
UIWIDGETS_API(bool) PathMeasure_nativeNextContour(PathMeasure* ptr) {
return ptr->nextContour();
}
UIWIDGETS_API(bool) PathMeasure_nativeNextContour(PathMeasure* ptr) {
return ptr->nextContour();
}
} // namespace uiwidgets
} // namespace uiwidgets

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


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