mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-22 22:51:05 +00:00
reverting rs_paint_filter_canvas
Signed-off-by: denispavlov <pavlov.denis@huawei.com>
This commit is contained in:
parent
b46c88a8d0
commit
7f753b226c
@ -110,6 +110,10 @@ if (graphic_2d_feature_ace_enable_gpu) {
|
||||
gpu_defines += [ "DDGR_ENABLE_FEATURE_OPINC" ]
|
||||
}
|
||||
|
||||
if (graphic_2d_feature_rs_enable_profiler) {
|
||||
gpu_defines += [ "SKP_RECORDING_ENABLED" ]
|
||||
}
|
||||
|
||||
ace_enable_gpu = true
|
||||
rs_enable_gpu = true
|
||||
surface_enable_gpu = true
|
||||
|
@ -30,6 +30,9 @@ using namespace Drawing;
|
||||
RSPaintFilterCanvasBase::RSPaintFilterCanvasBase(Drawing::Canvas* canvas)
|
||||
: Canvas(canvas ? canvas->GetWidth() : 0, canvas ? canvas->GetHeight() : 0), canvas_(canvas)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
this->AddCanvas(canvas);
|
||||
#endif
|
||||
}
|
||||
|
||||
Drawing::Matrix RSPaintFilterCanvasBase::GetTotalMatrix() const
|
||||
@ -66,140 +69,293 @@ std::shared_ptr<Drawing::GPUContext> RSPaintFilterCanvasBase::GetGPUContext()
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawPoint(const Point& point)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawPoint(point);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawPoint(point);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawSdf(const SDFShapeBase& shape)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawSdf(shape);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawSdf(shape);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawPoints(PointMode mode, size_t count, const Point pts[])
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawPoints(mode, count, pts);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawPoints(mode, count, pts);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawLine(const Point& startPt, const Point& endPt)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawLine(startPt, endPt);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawLine(startPt, endPt);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawRect(const Rect& rect)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawRect(rect);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawRect(rect);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawRoundRect(const RoundRect& roundRect)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawRoundRect(roundRect);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawRoundRect(roundRect);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawNestedRoundRect(const RoundRect& outer, const RoundRect& inner)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawNestedRoundRect(outer, inner);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawNestedRoundRect(outer, inner);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawArc(const Rect& oval, scalar startAngle, scalar sweepAngle)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawArc(oval, startAngle, sweepAngle);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawArc(oval, startAngle, sweepAngle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawPie(const Rect& oval, scalar startAngle, scalar sweepAngle)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawPie(oval, startAngle, sweepAngle);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawPie(oval, startAngle, sweepAngle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawOval(const Rect& oval)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawOval(oval);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawOval(oval);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawCircle(const Point& centerPt, scalar radius)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawCircle(centerPt, radius);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawCircle(centerPt, radius);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawPath(const Path& path)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawPath(path);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawPath(path);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawBackground(const Brush& brush)
|
||||
{
|
||||
Brush b(brush);
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilterWithBrush(b)) {
|
||||
(*iter)->DrawBackground(b);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilterWithBrush(b)) {
|
||||
canvas_->DrawBackground(b);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawShadow(const Path& path, const Point3& planeParams, const Point3& devLightPos,
|
||||
scalar lightRadius, Color ambientColor, Color spotColor, ShadowFlags flag)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawShadow(path, planeParams, devLightPos, lightRadius, ambientColor, spotColor, flag);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawShadow(path, planeParams, devLightPos, lightRadius, ambientColor, spotColor, flag);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawShadowStyle(const Path& path, const Point3& planeParams, const Point3& devLightPos,
|
||||
scalar lightRadius, Color ambientColor, Color spotColor, ShadowFlags flag, bool isLimitElevation)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawShadowStyle(
|
||||
path, planeParams, devLightPos, lightRadius, ambientColor, spotColor, flag, isLimitElevation);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawShadowStyle(
|
||||
path, planeParams, devLightPos, lightRadius, ambientColor, spotColor, flag, isLimitElevation);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawColor(Drawing::ColorQuad color, Drawing::BlendMode mode)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawColor(color, mode);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawColor(color, mode);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawRegion(const Drawing::Region& region)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawRegion(region);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawRegion(region);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawPatch(const Drawing::Point cubics[12], const Drawing::ColorQuad colors[4],
|
||||
const Drawing::Point texCoords[4], Drawing::BlendMode mode)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawPatch(cubics, colors, texCoords, mode);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawPatch(cubics, colors, texCoords, mode);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawVertices(const Drawing::Vertices& vertices, Drawing::BlendMode mode)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawVertices(vertices, mode);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawVertices(vertices, mode);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RSPaintFilterCanvasBase::OpCalculateBefore(const Matrix& matrix)
|
||||
@ -222,21 +378,50 @@ void RSPaintFilterCanvasBase::DrawAtlas(const Drawing::Image* atlas, const Drawi
|
||||
const Drawing::Rect tex[], const Drawing::ColorQuad colors[], int count, Drawing::BlendMode mode,
|
||||
const Drawing::SamplingOptions& sampling, const Drawing::Rect* cullRect)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawAtlas(atlas, xform, tex, colors, count, mode, sampling, cullRect);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawAtlas(atlas, xform, tex, colors, count, mode, sampling, cullRect);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawBitmap(const Bitmap& bitmap, const scalar px, const scalar py)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawBitmap(bitmap, px, py);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawBitmap(bitmap, px, py);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawImageNine(const Drawing::Image* image, const Drawing::RectI& center,
|
||||
const Drawing::Rect& dst, Drawing::FilterMode filter, const Drawing::Brush* brush)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
if (brush) {
|
||||
Drawing::Brush b(*brush);
|
||||
OnFilterWithBrush(b);
|
||||
(*iter)->DrawImageNine(image, center, dst, filter, &b);
|
||||
} else {
|
||||
(*iter)->DrawImageNine(image, center, dst, filter, GetFilteredBrush());
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
if (brush) {
|
||||
Drawing::Brush b(*brush);
|
||||
@ -246,166 +431,348 @@ void RSPaintFilterCanvasBase::DrawImageNine(const Drawing::Image* image, const D
|
||||
canvas_->DrawImageNine(image, center, dst, filter, GetFilteredBrush());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawImageLattice(const Drawing::Image* image, const Drawing::Lattice& lattice,
|
||||
const Drawing::Rect& dst, Drawing::FilterMode filter)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawImageLattice(image, lattice, dst, filter);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawImageLattice(image, lattice, dst, filter);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawImage(
|
||||
const Image& image, const scalar px, const scalar py, const SamplingOptions& sampling)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawImage(image, px, py, sampling);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawImage(image, px, py, sampling);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawImageRect(const Image& image, const Rect& src, const Rect& dst,
|
||||
const SamplingOptions& sampling, SrcRectConstraint constraint)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawImageRect(image, src, dst, sampling, constraint);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawImageRect(image, src, dst, sampling, constraint);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawImageRect(const Image& image, const Rect& dst, const SamplingOptions& sampling)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawImageRect(image, dst, sampling);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawImageRect(image, dst, sampling);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawPicture(const Picture& picture)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawPicture(picture);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawPicture(picture);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::DrawTextBlob(
|
||||
const Drawing::TextBlob* blob, const Drawing::scalar x, const Drawing::scalar y)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr && OnFilter()) {
|
||||
(*iter)->DrawTextBlob(blob, x, y);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr && OnFilter()) {
|
||||
canvas_->DrawTextBlob(blob, x, y);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ClipRect(const Drawing::Rect& rect, Drawing::ClipOp op, bool doAntiAlias)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ClipRect(rect, op, doAntiAlias);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ClipRect(rect, op, doAntiAlias);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ClipIRect(const Drawing::RectI& rect, Drawing::ClipOp op)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ClipIRect(rect, op);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ClipIRect(rect, op);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ClipRoundRect(const RoundRect& roundRect, ClipOp op, bool doAntiAlias)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ClipRoundRect(roundRect, op, doAntiAlias);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ClipRoundRect(roundRect, op, doAntiAlias);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ClipRoundRect(const Drawing::Rect& rect,
|
||||
std::vector<Drawing::Point>& pts, bool doAntiAlias)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ClipRoundRect(rect, pts, doAntiAlias);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ClipRoundRect(rect, pts, doAntiAlias);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ClipPath(const Path& path, ClipOp op, bool doAntiAlias)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ClipPath(path, op, doAntiAlias);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ClipPath(path, op, doAntiAlias);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ClipRegion(const Region& region, ClipOp op)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ClipRegion(region, op);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ClipRegion(region, op);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::SetMatrix(const Matrix& matrix)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->SetMatrix(matrix);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->SetMatrix(matrix);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ResetMatrix()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ResetMatrix();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ResetMatrix();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::ConcatMatrix(const Matrix& matrix)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->ConcatMatrix(matrix);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->ConcatMatrix(matrix);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Translate(scalar dx, scalar dy)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Translate(dx, dy);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Translate(dx, dy);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Scale(scalar sx, scalar sy)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Scale(sx, sy);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Scale(sx, sy);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Rotate(scalar deg, scalar sx, scalar sy)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Rotate(deg, sx, sy);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Rotate(deg, sx, sy);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Shear(scalar sx, scalar sy)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Shear(sx, sy);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Shear(sx, sy);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Flush()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Flush();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Flush();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Clear(ColorQuad color)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Clear(color);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Clear(color);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t RSPaintFilterCanvasBase::Save()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
uint32_t count = 0U;
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
auto c = (*iter)->Save();
|
||||
if ((*iter) == canvas_) {
|
||||
count = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
return canvas_->Save();
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::SaveLayer(const SaveLayerOps& saveLayerRec)
|
||||
@ -419,86 +786,174 @@ void RSPaintFilterCanvasBase::SaveLayer(const SaveLayerOps& saveLayerRec)
|
||||
OnFilterWithBrush(brush);
|
||||
}
|
||||
SaveLayerOps slo(saveLayerRec.GetBounds(), &brush, saveLayerRec.GetSaveLayerFlags());
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->SaveLayer(slo);
|
||||
}
|
||||
}
|
||||
#else
|
||||
canvas_->SaveLayer(slo);
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Restore()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Restore();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Restore();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RSPaintFilterCanvasBase::Discard()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->Discard();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->Discard();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
CoreCanvas& RSPaintFilterCanvasBase::AttachPen(const Pen& pen)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->AttachPen(pen);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->AttachPen(pen);
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
CoreCanvas& RSPaintFilterCanvasBase::AttachBrush(const Brush& brush)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->AttachBrush(brush);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->AttachBrush(brush);
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
CoreCanvas& RSPaintFilterCanvasBase::AttachPaint(const Drawing::Paint& paint)
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->AttachPaint(paint);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->AttachPaint(paint);
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
CoreCanvas& RSPaintFilterCanvasBase::DetachPen()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->DetachPen();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->DetachPen();
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
CoreCanvas& RSPaintFilterCanvasBase::DetachBrush()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->DetachBrush();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->DetachBrush();
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
CoreCanvas& RSPaintFilterCanvasBase::DetachPaint()
|
||||
{
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->DetachPaint();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
canvas_->DetachPaint();
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool RSPaintFilterCanvasBase::DrawBlurImage(const Drawing::Image& image, const Drawing::HpsBlurParameter& blurParams)
|
||||
{
|
||||
bool result = false;
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
result = ((*iter)->DrawBlurImage(image, blurParams) || result);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
result |= canvas_->DrawBlurImage(image, blurParams);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
std::array<int, 2> RSPaintFilterCanvasBase::CalcHpsBluredImageDimension(const Drawing::HpsBlurParameter& blurParams)
|
||||
{
|
||||
std::array<int, 2> result = {0, 0}; // There are 2 variables
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
result = (*iter)->CalcHpsBluredImageDimension(blurParams);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (canvas_ != nullptr) {
|
||||
result = canvas_->CalcHpsBluredImageDimension(blurParams);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -553,7 +1008,15 @@ CoreCanvas& RSPaintFilterCanvas::AttachPen(const Pen& pen)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->AttachPen(p);
|
||||
}
|
||||
}
|
||||
#else
|
||||
canvas_->AttachPen(p);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -580,7 +1043,15 @@ CoreCanvas& RSPaintFilterCanvas::AttachBrush(const Brush& brush)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->AttachBrush(b);
|
||||
}
|
||||
}
|
||||
#else
|
||||
canvas_->AttachBrush(b);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -607,7 +1078,15 @@ CoreCanvas& RSPaintFilterCanvas::AttachPaint(const Drawing::Paint& paint)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SKP_RECORDING_ENABLED
|
||||
for (auto iter = pCanvasList_.begin(); iter != pCanvasList_.end(); ++iter) {
|
||||
if ((*iter) != nullptr) {
|
||||
(*iter)->AttachPaint(p);
|
||||
}
|
||||
}
|
||||
#else
|
||||
canvas_->AttachPaint(p);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -621,7 +1100,6 @@ Drawing::Canvas* RSPaintFilterCanvas::GetRecordingCanvas() const
|
||||
return recordingState_ ? canvas_ : nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool RSPaintFilterCanvas::GetRecordingState() const
|
||||
{
|
||||
return recordingState_;
|
||||
|
Loading…
Reference in New Issue
Block a user