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