#include "flutter/flow/ohos_layers/opacity_layer.h"
#include "flutter/flow/ohos_layers/paint_context.h"
#include "flutter/flow/ohos_layers/transform_layer.h"
namespace flutter::OHOS {
void OpacityLayer::Prepare(const SkMatrix& matrix)
{
SkMatrix childMatrix = matrix;
childMatrix.postTranslate(offset_.fX, offset_.fY);
ContainerLayer::Prepare(childMatrix);
SetPaintBounds(GetPaintBounds().makeOffset(offset_.fX, offset_.fY));
}
void OpacityLayer::Paint(const PaintContext& paintContext) const
{
SkPaint paint;
paint.setAlpha(alpha_);
SkAutoCanvasRestore save(paintContext.skCanvas, true);
paintContext.skCanvas->translate(offset_.fX, offset_.fY);
SkRect saveLayerBounds;
GetPaintBounds().makeOffset(-offset_.fX, -offset_.fY).roundOut(&saveLayerBounds);
paintContext.skCanvas->saveLayer(saveLayerBounds, &paint);
PaintChildren(paintContext);
paintContext.skCanvas->restore();
}
}