mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 07:02:25 +00:00
黄蓝代码同步
Signed-off-by: zhangchao <zhangchao345@huawei.com>
This commit is contained in:
parent
afe8d4fd9f
commit
0c48a5fb25
@ -109,10 +109,10 @@ void ColorMatrix::SetScale(scalar sr, scalar sg, scalar sb, scalar sa)
|
||||
LOGD("Drawing: ColorMatrix memset_s failed");
|
||||
return;
|
||||
}
|
||||
array_[0] = sr; // red vector scale
|
||||
array_[6] = sg; // green vector scale
|
||||
array_[12] = sb; // blue vector scale
|
||||
array_[18] = sa; // alpha vetor scale
|
||||
array_[0] = sr; // 0 means red vector scale
|
||||
array_[6] = sg; // 6 means green vector scale
|
||||
array_[12] = sb; // 12 means blue vector scale
|
||||
array_[18] = sa; // 18 means alpha vetor scale
|
||||
}
|
||||
|
||||
void ColorMatrix::SetSaturation(scalar sat)
|
||||
|
@ -103,19 +103,21 @@ std::shared_ptr<ShaderEffect> SkiaRuntimeEffect::MakeShader(std::shared_ptr<Data
|
||||
std::shared_ptr<ShaderEffect> children[], size_t childCount, const Matrix* localMatrix,
|
||||
bool isOpaque)
|
||||
{
|
||||
auto data = uniforms ? uniforms->GetImpl<SkiaData>()->GetSkData() : SkData::MakeEmpty();
|
||||
sk_sp<SkShader> skChildren[childCount];
|
||||
for (size_t i = 0; i < childCount; ++i) {
|
||||
auto skShaderImpl = children[i]->GetImpl<SkiaShaderEffect>();
|
||||
if (skShaderImpl) {
|
||||
skChildren[i] = sk_sp<SkShader>(skShaderImpl->GetShader());
|
||||
}
|
||||
}
|
||||
sk_sp<SkShader> skShader = skRuntimeEffect_->makeShader(data, skChildren,
|
||||
childCount, localMatrix ? &localMatrix->GetImpl<SkiaMatrix>()->ExportSkiaMatrix() : nullptr,
|
||||
isOpaque);
|
||||
std::shared_ptr<ShaderEffect> shader = std::make_shared<ShaderEffect>();
|
||||
shader->GetImpl<SkiaShaderEffect>()->SetSkShader(skShader);
|
||||
if (skRuntimeEffect_ != nullptr) {
|
||||
auto data = uniforms ? uniforms->GetImpl<SkiaData>()->GetSkData() : SkData::MakeEmpty();
|
||||
sk_sp<SkShader> skChildren[childCount];
|
||||
for (size_t i = 0; i < childCount; ++i) {
|
||||
auto skShaderImpl = children[i]->GetImpl<SkiaShaderEffect>();
|
||||
if (skShaderImpl) {
|
||||
skChildren[i] = sk_sp<SkShader>(skShaderImpl->GetShader());
|
||||
}
|
||||
}
|
||||
sk_sp<SkShader> skShader = skRuntimeEffect_->makeShader(data, skChildren,
|
||||
childCount, localMatrix ? &localMatrix->GetImpl<SkiaMatrix>()->ExportSkiaMatrix() : nullptr,
|
||||
isOpaque);
|
||||
shader->GetImpl<SkiaShaderEffect>()->SetSkShader(skShader);
|
||||
}
|
||||
return shader;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -116,7 +117,7 @@ ColorSpace::ColorSpace(const ColorSpacePrimaries &primaries, const TransferFunc
|
||||
toXYZ(ComputeXYZD50(primaries)),
|
||||
transferFunc(transferFunc)
|
||||
{
|
||||
std::array<float, 2> whiteP = {primaries.wX, primaries.wY}; // 2 means two dimension x, y
|
||||
std::array<float, 2> whiteP = {primaries.wX, primaries.wY}; // 2 means two dimension x, y
|
||||
whitePoint = whiteP;
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ ColorSpace::ColorSpace(const ColorSpacePrimaries &primaries, float gamma)
|
||||
: colorSpaceName(ColorSpaceName::CUSTOM),
|
||||
toXYZ(ComputeXYZD50(primaries))
|
||||
{
|
||||
std::array<float, 2> whiteP = {primaries.wX, primaries.wY}; // 2 means two dimension x, y
|
||||
std::array<float, 2> whiteP = {primaries.wX, primaries.wY}; // 2 means two dimension x, y
|
||||
whitePoint = whiteP;
|
||||
transferFunc = {};
|
||||
transferFunc.g = gamma;
|
||||
|
Loading…
Reference in New Issue
Block a user