未验证 提交 3e753dbb 编写于 作者: O openharmony_ci 提交者: Gitee

!581 修复可穿戴设备编译告警问题

Merge pull request !581 from 郝烁/master
......@@ -64,9 +64,9 @@ int16_t EasingEquation::CircEaseIn(int16_t startPos, int16_t endPos, uint16_t cu
{
if (curTime < durationTime) {
int32_t t = (curTime << INTERPOLATION_RANGE_OFFSET) / durationTime;
uint32_t x = INTERPOLATION_RANGE - Sqrt(INTERPOLATION_RANGE_SQUARE - t * t);
uint32_t x = INTERPOLATION_RANGE - static_cast<int32_t>(Sqrt(INTERPOLATION_RANGE_SQUARE - t * t));
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -79,7 +79,7 @@ int16_t EasingEquation::CircEaseOut(int16_t startPos, int16_t endPos, uint16_t c
int32_t t = INTERPOLATION_RANGE - (curTime << INTERPOLATION_RANGE_OFFSET) / durationTime;
uint32_t x = static_cast<uint32_t>(Sqrt(INTERPOLATION_RANGE_SQUARE - t * t));
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -102,7 +102,7 @@ int16_t EasingEquation::CubicEaseIn(int16_t startPos, int16_t endPos, uint16_t c
int32_t t = (curTime << INTERPOLATION_RANGE_OFFSET) / durationTime;
int16_t x = (t * t * t) >> (INTERPOLATION_RANGE_OFFSET << 1);
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -116,7 +116,7 @@ int16_t EasingEquation::CubicEaseOut(int16_t startPos, int16_t endPos, uint16_t
t = INTERPOLATION_RANGE - t;
int16_t x = INTERPOLATION_RANGE - ((t * t * t) >> (INTERPOLATION_RANGE_OFFSET << 1));
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -137,7 +137,7 @@ int16_t EasingEquation::LinearEaseNone(int16_t startPos, int16_t endPos, uint16_
if (curTime < durationTime) {
int32_t t = (curTime << INTERPOLATION_RANGE_OFFSET) / durationTime;
return static_cast<int16_t>(((t * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -150,7 +150,7 @@ int16_t EasingEquation::QuadEaseIn(int16_t startPos, int16_t endPos, uint16_t cu
int32_t t = (curTime << INTERPOLATION_RANGE_OFFSET) / durationTime;
int16_t x = (t * t) >> INTERPOLATION_RANGE_OFFSET;
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -163,7 +163,7 @@ int16_t EasingEquation::QuadEaseOut(int16_t startPos, int16_t endPos, uint16_t c
int32_t t = INTERPOLATION_RANGE - (curTime << INTERPOLATION_RANGE_OFFSET) / durationTime;
int16_t x = INTERPOLATION_RANGE - ((t * t) >> INTERPOLATION_RANGE_OFFSET);
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -188,7 +188,7 @@ int16_t EasingEquation::QuintEaseIn(int16_t startPos, int16_t endPos, uint16_t c
/* 4: the fourth power of t */
int16_t x = (t * t * t * t * t) >> (INTERPOLATION_RANGE_OFFSET * 4);
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -204,7 +204,7 @@ int16_t EasingEquation::QuintEaseOut(int16_t startPos, int16_t endPos, uint16_t
/* 4: the fourth power of t */
int16_t x = INTERPOLATION_RANGE - ((t * t * t * t * t) >> (INTERPOLATION_RANGE_OFFSET * 4));
return static_cast<int16_t>(((x * (static_cast<int32_t>(endPos) - startPos)) >> INTERPOLATION_RANGE_OFFSET) +
startPos);
startPos);
}
return endPos;
......@@ -251,4 +251,4 @@ int16_t EasingEquation::SineEaseInOut(int16_t startPos, int16_t endPos, uint16_t
}
return SineEaseOut(halfStep, endPos, curTime - halfTime, halfTime);
}
}
\ No newline at end of file
} // namespace OHOS
\ No newline at end of file
......@@ -136,7 +136,7 @@ void UIArcLabel::DrawArcText(BufferInfo& gfxDstBuffer, const Rect& mask, Opacity
InitArcLabelText();
UIFont::GetInstance()->SetCurrentFontId(arcLabelText_->GetFontId(), arcLabelText_->GetFontSize());
DrawLabel::DrawArcText(gfxDstBuffer, mask, arcLabelText_->GetText(), center, arcLabelText_->GetFontId(),
arcTextInfo_, orientation_, *style_, opaScale);
arcTextInfo_, orientation_, *style_, opaScale);
}
void UIArcLabel::RefreshArcLabel()
......@@ -186,27 +186,28 @@ void UIArcLabel::MeasureArcTextInfo()
uint16_t arcAngle;
if (startAngle_ < endAngle_) {
arcAngle = endAngle_ - startAngle_;
arcTextInfo_.direct = TEXT_DIRECT_LTR; // Clockwise
arcTextInfo_.direct = TEXT_DIRECT_LTR; // Clockwise
arcLabelText_->SetDirect(TEXT_DIRECT_LTR);
} else {
arcAngle = startAngle_ - endAngle_;
arcTextInfo_.direct = TEXT_DIRECT_RTL; // Counterclockwise
arcTextInfo_.direct = TEXT_DIRECT_RTL; // Counterclockwise
arcLabelText_->SetDirect(TEXT_DIRECT_RTL);
}
// calculate max arc length
float maxLength = static_cast<float>((UI_PI * radius_ * arcAngle) / SEMICIRCLE_IN_DEGREE);
arcTextInfo_.lineStart = 0;
arcTextInfo_.lineEnd = TypedText::GetNextLine(&text[arcTextInfo_.lineStart], style_->letterSpace_, maxLength);
arcTextInfo_.lineEnd =
TypedText::GetNextLine(&text[arcTextInfo_.lineStart], style_->letterSpace_, static_cast<int16_t>(maxLength));
arcTextInfo_.startAngle = startAngle_ % CIRCLE_IN_DEGREE;
int16_t actLength = TypedText::GetTextWidth(&text[arcTextInfo_.lineStart],
arcTextInfo_.lineEnd - arcTextInfo_.lineStart, style_->letterSpace_);
arcTextInfo_.lineEnd - arcTextInfo_.lineStart, style_->letterSpace_);
if ((arcLabelText_->GetHorAlign() != TEXT_ALIGNMENT_LEFT) && (actLength < maxLength)) {
float gapLength = maxLength - actLength;
if (arcLabelText_->GetHorAlign() == TEXT_ALIGNMENT_CENTER) {
gapLength = gapLength / 2; // 2: half
}
arcTextInfo_.startAngle += TypedText::GetAngleForArcLen(gapLength, letterHeight, arcTextInfo_.radius,
arcTextInfo_.direct, orientation_);
arcTextInfo_.direct, orientation_);
}
}
} // namespace OHOS
\ No newline at end of file
......@@ -34,7 +34,9 @@ UIArcScrollBar::UIArcScrollBar()
startAngle_(RIGHT_SIDE_START_ANGLE_IN_DEGREE),
endAngle_(RIGHT_SIDE_END_ANGLE_IN_DEGREE),
center_({0, 0}),
side_(SCROLL_BAR_RIGHT_SIDE) {}
side_(SCROLL_BAR_RIGHT_SIDE)
{
}
void UIArcScrollBar::SetPosition(int16_t x, int16_t y, int16_t width, int16_t radius)
{
......@@ -49,10 +51,10 @@ void UIArcScrollBar::SetPosition(int16_t x, int16_t y, int16_t width, int16_t ra
void UIArcScrollBar::SetScrollBarSide(uint8_t side)
{
if (side == SCROLL_BAR_RIGHT_SIDE) {
startAngle_ = RIGHT_SIDE_START_ANGLE_IN_DEGREE;
startAngle_ = RIGHT_SIDE_START_ANGLE_IN_DEGREE;
endAngle_ = RIGHT_SIDE_END_ANGLE_IN_DEGREE;
} else {
startAngle_ = LEFT_SIDE_START_ANGLE_IN_DEGREE;
startAngle_ = LEFT_SIDE_START_ANGLE_IN_DEGREE;
endAngle_ = LEFT_SIDE_END_ANGLE_IN_DEGREE;
}
side_ = side;
......@@ -68,7 +70,7 @@ void UIArcScrollBar::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre
void UIArcScrollBar::DrawForeground(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea, uint8_t backgroundOpa)
{
uint16_t foregoundAngleRange = foregroundProportion_ * (endAngle_ - startAngle_);
uint16_t foregoundAngleRange = static_cast<uint16_t>(foregroundProportion_ * (endAngle_ - startAngle_));
if (foregoundAngleRange < SCROLL_BAR_MIN_ARC) {
foregoundAngleRange = SCROLL_BAR_MIN_ARC;
}
......@@ -79,12 +81,12 @@ void UIArcScrollBar::DrawForeground(BufferInfo& gfxDstBuffer, const Rect& invali
if (side_ == SCROLL_BAR_RIGHT_SIDE) {
minAngle = startAngle_;
maxAngle = endAngle_ - foregoundAngleRange;
startAngle = minAngle + scrollProgress_ * (maxAngle - minAngle);
startAngle = minAngle + static_cast<int16_t>(scrollProgress_ * (maxAngle - minAngle));
endAngle = startAngle + foregoundAngleRange;
} else {
maxAngle = endAngle_;
minAngle = startAngle_ + foregoundAngleRange;
endAngle = maxAngle - scrollProgress_ * (maxAngle - minAngle);
endAngle = maxAngle - static_cast<int16_t>(scrollProgress_ * (maxAngle - minAngle));
startAngle = endAngle - foregoundAngleRange;
}
if ((startAngle > endAngle_) || (endAngle < startAngle_)) {
......
......@@ -41,21 +41,21 @@ void UIBoxScrollBar::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre
/* Draw foreground */
if (backgroundRect_.GetWidth() < backgroundRect_.GetHeight()) {
int16_t forgroundHeight = foregroundProportion_ * backgroundRect_.GetHeight();
int16_t forgroundHeight = static_cast<int16_t>(foregroundProportion_ * backgroundRect_.GetHeight());
if (forgroundHeight < SCROLL_BAR_MIN_LEN) {
forgroundHeight = SCROLL_BAR_MIN_LEN;
}
int16_t forgroundTop =
backgroundRect_.GetTop() + scrollProgress_ * (backgroundRect_.GetHeight() - forgroundHeight);
int16_t forgroundTop = backgroundRect_.GetTop() +
static_cast<int16_t>(scrollProgress_ * (backgroundRect_.GetHeight() - forgroundHeight));
rect.SetRect(backgroundRect_.GetLeft(), forgroundTop, backgroundRect_.GetRight(),
forgroundTop + forgroundHeight - 1);
} else {
int16_t forgroundWidth = foregroundProportion_ * backgroundRect_.GetWidth();
int16_t forgroundWidth = static_cast<int16_t>(foregroundProportion_ * backgroundRect_.GetWidth());
if (forgroundWidth < SCROLL_BAR_MIN_LEN) {
forgroundWidth = SCROLL_BAR_MIN_LEN;
}
int16_t forgroundLeft =
backgroundRect_.GetLeft() + scrollProgress_ * (backgroundRect_.GetWidth() - forgroundWidth);
int16_t forgroundLeft = backgroundRect_.GetLeft() +
static_cast<int16_t>(scrollProgress_ * (backgroundRect_.GetWidth() - forgroundWidth));
rect.SetRect(forgroundLeft, backgroundRect_.GetTop(), forgroundLeft + forgroundWidth - 1,
backgroundRect_.GetBottom());
}
......
......@@ -137,12 +137,12 @@ void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer,
styleSelect.bgColor_ = selectedStateColor_;
styleSelect.bgOpa_ = backgroundOpacity_;
BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, rect, trunc, styleSelect, opaScale_);
int16_t dx = borderWidth_ * DEFAULT_COEFFICIENT_START_DX;
int16_t dy = borderWidth_ * DEFAULT_COEFFICIENT_START_DY;
int16_t dx = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_START_DX);
int16_t dy = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_START_DY);
Point start = {static_cast<int16_t>(rect.GetX() + dx), static_cast<int16_t>(rect.GetY() + dy)};
dx = borderWidth_ * DEFAULT_COEFFICIENT_MID_DX;
dx = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_MID_DX);
Point mid = {static_cast<int16_t>(start.x + dx), static_cast<int16_t>(start.y + dx)};
dx = borderWidth_ * DEFAULT_COEFFICIENT_MID_DY;
dx = static_cast<int16_t>(borderWidth_ * DEFAULT_COEFFICIENT_MID_DY);
Point end = {static_cast<int16_t>(mid.x + dx), static_cast<int16_t>(mid.y - dx)};
const int16_t half = 2; // 2 :half
ArcInfo arcInfoLeft = {start,
......
......@@ -356,23 +356,21 @@ bool UIList::MoveOffset(int16_t x, int16_t y)
if (!isLoopList_ && scrollListener_) {
if (direction_ == VERTICAL) {
if (childrenHead_ && (childrenHead_->GetViewIndex() == startIndex_) &&
childrenHead_->GetRelativeRect().GetTop() >= 0 &&
childrenHead_->GetRelativeRect().GetTop() - y < 0) {
if (childrenHead_ && (childrenHead_->GetViewIndex() == 0) &&
childrenHead_->GetRelativeRect().GetTop() >= 0 && childrenHead_->GetRelativeRect().GetTop() - y < 0) {
scrollListener_->OnScrollTop(childrenHead_->GetViewIndex(), childrenHead_);
}
if (childrenTail_ && (childrenTail_->GetViewIndex() == recycle_.GetAdapterItemCount()-1) &&
if (childrenTail_ && (childrenTail_->GetViewIndex() == recycle_.GetAdapterItemCount() - 1) &&
(childrenTail_->GetRelativeRect().GetBottom() <= GetContentRect().GetHeight() - 1) &&
(childrenTail_->GetRelativeRect().GetBottom() - y > GetContentRect().GetHeight() - 1)) {
scrollListener_->OnScrollBottom(childrenTail_->GetViewIndex(), childrenTail_);
scrollListener_->OnScrollBottom(childrenTail_->GetViewIndex(), childrenTail_);
}
} else {
if (childrenHead_ && (childrenHead_->GetViewIndex() == startIndex_) &&
childrenHead_->GetRelativeRect().GetLeft() >= 0 &&
childrenHead_->GetRelativeRect().GetLeft() - x < 0) {
if (childrenHead_ && (childrenHead_->GetViewIndex() == 0) &&
childrenHead_->GetRelativeRect().GetLeft() >= 0 && childrenHead_->GetRelativeRect().GetLeft() - x < 0) {
scrollListener_->OnScrollTop(childrenHead_->GetViewIndex(), childrenHead_);
}
if (childrenTail_ && (childrenTail_->GetViewIndex() == recycle_.GetAdapterItemCount()-1) &&
if (childrenTail_ && (childrenTail_->GetViewIndex() == recycle_.GetAdapterItemCount() - 1) &&
(childrenTail_->GetRelativeRect().GetRight() <= GetContentRect().GetWidth() - 1) &&
(childrenTail_->GetRelativeRect().GetRight() - x > GetContentRect().GetWidth() - 1)) {
scrollListener_->OnScrollBottom(childrenTail_->GetViewIndex(), childrenTail_);
......
......@@ -66,7 +66,7 @@ void UIToggleButton::CalculateSize()
Rect contentRect = GetContentRect();
int16_t dx = (width_ - rectWidth_) / 2; // 2: half
int16_t dy = (height_ / 2) - corner_; // 2: half
int16_t dy = (height_ / 2) - corner_; // 2: half
int16_t x = contentRect.GetX() + dx;
int16_t y = contentRect.GetY() + dy;
leftCenter_ = {static_cast<int16_t>(x + corner_), static_cast<int16_t>(y + corner_)};
......@@ -118,14 +118,17 @@ void UIToggleButton::Callback(UIView* view)
float coefficient = Interpolation::GetBezierY(x, BEZIER_CONTROL_POINT_X_1, 0, BEZIER_CONTROL_POINT_X_2, 1);
if (state_ == SELECTED) {
currentCenter_.y = rightCenter_.y;
currentCenter_.x = (rightCenter_.x - leftCenter_.x) * coefficient + leftCenter_.x;
backgroundOpacity_ = TOGGLE_BTN_UNSELECTED_OPA + (OPA_OPAQUE - TOGGLE_BTN_UNSELECTED_OPA) * coefficient;
bgColor_ = Color::GetMixColor(selectedStateColor_, Color::White(), OPA_OPAQUE * coefficient);
currentCenter_.x = static_cast<int16_t>((rightCenter_.x - leftCenter_.x) * coefficient) + leftCenter_.x;
backgroundOpacity_ =
static_cast<uint8_t>(TOGGLE_BTN_UNSELECTED_OPA + (OPA_OPAQUE - TOGGLE_BTN_UNSELECTED_OPA) * coefficient);
bgColor_ =
Color::GetMixColor(selectedStateColor_, Color::White(), static_cast<uint8_t>(OPA_OPAQUE * coefficient));
} else {
currentCenter_.y = leftCenter_.y;
currentCenter_.x = rightCenter_.x - (rightCenter_.x - leftCenter_.x) * coefficient;
backgroundOpacity_ = OPA_OPAQUE - (OPA_OPAQUE - TOGGLE_BTN_UNSELECTED_OPA) * coefficient;
bgColor_ = Color::GetMixColor(selectedStateColor_, Color::White(), OPA_OPAQUE * (1 - coefficient));
currentCenter_.x = rightCenter_.x - static_cast<uint16_t>((rightCenter_.x - leftCenter_.x) * coefficient);
backgroundOpacity_ = static_cast<uint8_t>(OPA_OPAQUE - (OPA_OPAQUE - TOGGLE_BTN_UNSELECTED_OPA) * coefficient);
bgColor_ = Color::GetMixColor(selectedStateColor_, Color::White(),
static_cast<uint8_t>(OPA_OPAQUE * (1 - coefficient)));
}
Invalidate();
}
......
......@@ -160,9 +160,9 @@ bool EventInjector::SetClickEvent(const Point& clickPoint)
dataArray[1].point = clickPoint;
dataArray[1].state = InputDevice::STATE_RELEASE;
if (!SetInjectEvent(dataArray, clickArrayLen, EventDataType::POINT_TYPE)) {
setResult = false;
setResult = false;
}
delete [] dataArray;
delete[] dataArray;
return setResult;
}
......@@ -184,9 +184,9 @@ bool EventInjector::SetLongPressEvent(const Point& longPressPoint)
}
dataArray[pointCount - 1].state = InputDevice::STATE_RELEASE;
if (!SetInjectEvent(dataArray, pointCount, EventDataType::POINT_TYPE)) {
setResult = false;
setResult = false;
}
delete [] dataArray;
delete[] dataArray;
return setResult;
}
......@@ -203,7 +203,7 @@ bool EventInjector::SetDragEvent(const Point& startPoint, const Point& endPoint,
return false;
}
bool setResult = true;
int16_t negativeFlag = 1; /* 1:represent the coordinate (x, y) of endPoint is larger than startPoint. */
int16_t negativeFlag = 1; /* 1:represent the coordinate (x, y) of endPoint is larger than startPoint. */
DeviceData* dataArray = new DeviceData[pointCount];
if (dataArray == nullptr) {
return false;
......@@ -211,32 +211,32 @@ bool EventInjector::SetDragEvent(const Point& startPoint, const Point& endPoint,
if (startPoint.x == endPoint.x) {
float pointStep = static_cast<float>(MATH_ABS(endPoint.y - startPoint.y)) / (pointCount - 1);
if (endPoint.y < startPoint.y) {
negativeFlag = -1; /* -1:represent the coordinate y of endPoint is smaller than startPoint. */
negativeFlag = -1; /* -1:represent the coordinate y of endPoint is smaller than startPoint. */
}
for (uint16_t i = 0; i < pointCount; i++) {
dataArray[i].point.x = startPoint.x;
dataArray[i].point.y = startPoint.y + (i * negativeFlag * pointStep);
dataArray[i].point.y = startPoint.y + static_cast<int16_t>(i * negativeFlag * pointStep);
dataArray[i].state = InputDevice::STATE_PRESS;
}
} else {
float slope = static_cast<float>(endPoint.y - startPoint.y) / (endPoint.x - startPoint.x);
int16_t constPara = startPoint.y - (slope * startPoint.x);
int16_t constPara = startPoint.y - static_cast<int16_t>(slope * startPoint.x);
float pointStep = static_cast<float>(MATH_ABS(endPoint.x - startPoint.x)) / (pointCount - 1);
if (endPoint.x < startPoint.x) {
negativeFlag = -1; /* -1:represent the coordinate x of endPoint is smaller than startPoint. */
negativeFlag = -1; /* -1:represent the coordinate x of endPoint is smaller than startPoint. */
}
for (uint16_t i = 0; i < pointCount; i++) {
dataArray[i].point.x = startPoint.x + (i * negativeFlag * pointStep);
dataArray[i].point.y = slope * (dataArray[i].point.x) + constPara;
dataArray[i].point.x = startPoint.x + static_cast<int16_t>(i * negativeFlag * pointStep);
dataArray[i].point.y = static_cast<int16_t>(slope * (dataArray[i].point.x)) + constPara;
dataArray[i].state = InputDevice::STATE_PRESS;
}
}
dataArray[pointCount - 1].point = endPoint;
dataArray[pointCount - 1].state = InputDevice::STATE_RELEASE;
if (!SetInjectEvent(dataArray, pointCount, EventDataType::POINT_TYPE)) {
setResult = false;
setResult = false;
}
delete [] dataArray;
delete[] dataArray;
return setResult;
}
......@@ -257,9 +257,9 @@ bool EventInjector::SetKeyEvent(uint16_t keyId, uint16_t state)
dataArray[i].state = state;
}
if (!SetInjectEvent(dataArray, kevArrayLen, EventDataType::KEY_TYPE)) {
setResult = false;
setResult = false;
}
delete [] dataArray;
delete[] dataArray;
return setResult;
}
......@@ -271,5 +271,5 @@ void EventInjector::SetWindowId(uint8_t windowId)
}
}
#endif
}
} // namespace OHOS
#endif // ENABLE_DEBUG
\ No newline at end of file
......@@ -85,14 +85,14 @@ namespace OHOS {
ASSERT(0); \
}
#define COLOR_BLEND_RGBA(r1, g1, b1, a1, r2, g2, b2, a2) \
const float Alpha1 = static_cast<float>(a1) / OPA_OPAQUE; \
const float Alpha2 = static_cast<float>(a2) / OPA_OPAQUE; \
const float Alpha3 = 1 - (1 - Alpha1) * (1 - Alpha2); \
(r1) = (Alpha2 * (r2) + (1 - Alpha2) * Alpha1 * (r1)) / Alpha3; \
(g1) = (Alpha2 * (g2) + (1 - Alpha2) * Alpha1 * (g1)) / Alpha3; \
(b1) = (Alpha2 * (b2) + (1 - Alpha2) * Alpha1 * (b1)) / Alpha3; \
(a1) = Alpha3 * OPA_OPAQUE;
#define COLOR_BLEND_RGBA(r1, g1, b1, a1, r2, g2, b2, a2) \
const float Alpha1 = static_cast<float>(a1) / OPA_OPAQUE; \
const float Alpha2 = static_cast<float>(a2) / OPA_OPAQUE; \
const float Alpha3 = 1 - (1 - Alpha1) * (1 - Alpha2); \
(r1) = static_cast<uint8_t>((Alpha2 * (r2) + (1 - Alpha2) * Alpha1 * (r1)) / Alpha3); \
(g1) = static_cast<uint8_t>((Alpha2 * (g2) + (1 - Alpha2) * Alpha1 * (g1)) / Alpha3); \
(b1) = static_cast<uint8_t>((Alpha2 * (b2) + (1 - Alpha2) * Alpha1 * (b1)) / Alpha3); \
(a1) = static_cast<uint8_t>(Alpha3 * OPA_OPAQUE);
#define COLOR_BLEND_RGB(r1, g1, b1, r2, g2, b2, a2) \
(r1) = (((r2) * (a2)) / OPA_OPAQUE) + (((r1) * (OPA_OPAQUE - (a2))) / OPA_OPAQUE); \
......@@ -336,27 +336,22 @@ void DrawUtils::DrawLetter(BufferInfo& gfxDstBuffer,
Color32 fillColor;
fillColor.full = Color::ColorTo32(color);
uint8_t opacityMask;
uint8_t colorMode = 0;
uint8_t opacityStep = 1;
switch (fontWeight) {
case FONT_WEIGHT_1:
opacityStep = OPACITY_STEP_A1;
opacityMask = 0x01;
colorMode = A1;
break;
case FONT_WEIGHT_2:
opacityStep = OPACITY_STEP_A2;
opacityMask = 0x03;
colorMode = A2;
break;
case FONT_WEIGHT_4:
opacityStep = OPACITY_STEP_A4;
opacityMask = 0x0F;
colorMode = A4;
break;
case FONT_WEIGHT_8:
opacityMask = 0xFF;
colorMode = A8;
break;
default:
return;
......@@ -1078,6 +1073,7 @@ static void DrawTriangleTrueColorBilinear8888Inner(const TriangleScanInfo& in,
}
#endif
#if ENABLE_FIXED_POINT
static void DrawFixedTriangleTrueColorBilinear8888Inner(const TriangleScanInfo& in,
uint8_t* screenBuffer,
int16_t len,
......@@ -1144,6 +1140,7 @@ static void DrawFixedTriangleTrueColorBilinear8888Inner(const TriangleScanInfo&
screenBuffer += in.bufferPxSize;
}
}
#endif
#ifdef ARM_NEON_OPT
static void DrawTriangleTrueColorBilinear8888InnerNeon(const TriangleScanInfo& in,
......
......@@ -58,7 +58,7 @@ uint16_t UILineBreakEngine::GetNextBreakPos(UILineBreakProxy& record)
reinterpret_cast<const RBBIStateTableRow*>(rbbStateTable->fTableData + rbbStateTable->fRowLen * state);
UTrie2* trie2 = reinterpret_cast<UTrie2*>(lineBreakTrie_);
for (uint16_t index = 0; index < record.GetStrLen(); ++index) {
uint16_t category = UTRIE2_GET16(trie2, str[index]);
uint16_t category = UTRIE2_GET16(trie2, static_cast<uint32_t>(str[index]));
// 0x4000: remove the dictionary flag bit
if ((category & 0x4000) != 0) {
// 0x4000: remove the dictionary flag bit
......@@ -107,7 +107,10 @@ void UILineBreakEngine::LoadRule()
initSuccess_ = true;
}
uint32_t UILineBreakEngine::GetNextLineAndWidth(const char* text, int16_t space, bool allBreak, int16_t& maxWidth,
uint32_t UILineBreakEngine::GetNextLineAndWidth(const char* text,
int16_t space,
bool allBreak,
int16_t& maxWidth,
uint16_t len)
{
if (text == nullptr) {
......@@ -166,7 +169,7 @@ bool UILineBreakEngine::IsBreakPos(uint32_t unicode, int32_t& state)
utf16 = (unicode & TypedText::MAX_UINT16_LOW_SCOPE);
} else if (unicode <= TypedText::MAX_UINT16_HIGH_SCOPE) {
utf16 = static_cast<uint16_t>(TypedText::UTF16_LOW_PARAM + (unicode & TypedText::UTF16_LOW_MASK)); // low
uint16_t category = UTRIE2_GET16(reinterpret_cast<UTrie2*>(lineBreakTrie_), utf16);
uint16_t category = UTRIE2_GET16(reinterpret_cast<UTrie2*>(lineBreakTrie_), static_cast<uint32_t>(utf16));
// 0x4000: remove the dictionary flag bit
if ((category & 0x4000) != 0) {
// 0x4000: remove the dictionary flag bit
......@@ -174,10 +177,10 @@ bool UILineBreakEngine::IsBreakPos(uint32_t unicode, int32_t& state)
}
state = row->fNextState[category];
row = reinterpret_cast<const RBBIStateTableRow*>(rbbStateTable->fTableData + rbbStateTable->fRowLen * state);
utf16 = static_cast<uint16_t>(TypedText::UTF16_HIGH_PARAM1 +
(unicode >> TypedText::UTF16_HIGH_SHIFT) - TypedText::UTF16_HIGH_PARAM2); // high
utf16 = static_cast<uint16_t>(TypedText::UTF16_HIGH_PARAM1 + (unicode >> TypedText::UTF16_HIGH_SHIFT) -
TypedText::UTF16_HIGH_PARAM2); // high
}
uint16_t category = UTRIE2_GET16(reinterpret_cast<UTrie2*>(lineBreakTrie_), utf16);
uint16_t category = UTRIE2_GET16(reinterpret_cast<UTrie2*>(lineBreakTrie_), static_cast<uint32_t>(utf16));
// 0x4000: remove the dictionary flag bit
if ((category & 0x4000) != 0) {
// 0x4000: remove the dictionary flag bit
......
......@@ -334,6 +334,17 @@ public:
*/
int64_t GetStyle(uint8_t key) const override;
/**
* @brief Sets the view style.
* @param style Indicates the view style.
* @since 1.0
* @version 1.0
*/
virtual void SetStyle(Style& style) override
{
UIView::SetStyle(style);
}
/**
* @brief Sets a style.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册