提交 6b19319f 编写于 作者: N niulihua

fix codex and review

上级 18fbe1dd
......@@ -224,7 +224,11 @@ bool Image::SetSrc(const ImageInfo* src)
return true;
}
void Image::DrawImage(BufferInfo& gfxDstBuffer, const Rect& coords, const Rect& mask, const Style& style, uint8_t opaScale) const
void Image::DrawImage(BufferInfo& gfxDstBuffer,
const Rect& coords,
const Rect& mask,
const Style& style,
uint8_t opaScale) const
{
if (srcType_ == IMG_SRC_VARIABLE) {
DrawImage::DrawCommon(gfxDstBuffer, coords, mask, imageInfo_, style, opaScale);
......
......@@ -15,8 +15,8 @@
#include "common/screen.h"
#include "core/render_manager.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "draw/draw_utils.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/mem_api.h"
#include "securec.h"
......@@ -34,9 +34,12 @@ uint16_t Screen::GetHeight()
bool Screen::GetCurrentScreenBitmap(ImageInfo& info)
{
BufferInfo* bufferInfo = BaseGfxEngine::GetInstance()->GetBufferInfo();
if (bufferInfo == nullptr) {
return false;
}
uint16_t screenWidth = BaseGfxEngine::GetInstance()->GetScreenWidth();
uint16_t screenHeight = BaseGfxEngine::GetInstance()->GetScreenHeight();
info.header.colorMode = bufferInfo->mode;;
info.header.colorMode = bufferInfo->mode;
info.dataSize = screenWidth * screenHeight * DrawUtils::GetByteSizeByColorMode(info.header.colorMode);
info.data = reinterpret_cast<uint8_t*>(ImageCacheMalloc(info));
info.header.width = screenWidth;
......@@ -44,12 +47,11 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info)
info.header.reserved = 0;
info.header.compressMode = 0;
if (memcpy_s(screenBitmapBuffer, info.dataSize, bufferInfo->virAddr, info.dataSize) != EOK) {
if (memcpy_s(static_cast<void *>(const_cast<uint8_t *>(info.data)), info.dataSize,
bufferInfo->virAddr, info.dataSize) != EOK) {
ImageCacheFree(info);
return false;
}
info.data = screenBitmapBuffer;
return true;
}
} // namespace OHOS
......@@ -17,8 +17,8 @@
#include "common/screen.h"
#include "core/render_manager.h"
#include "gfx_utils/graphic_log.h"
#include "draw/draw_utils.h"
#include "gfx_utils/graphic_log.h"
#if ENABLE_WINDOW
#include "window/window_impl.h"
#endif
......@@ -510,8 +510,8 @@ void RootView::BlitMapBuffer(Rect& curViewRect, TransformMap& transMap, const Re
imageInfo.data = reinterpret_cast<uint8_t*>(dc_.mapBufferInfo->virAddr);
TransformDataInfo imageTranDataInfo = {imageInfo.header, imageInfo.data, pxSize, LEVEL0,
BILINEAR};
dc_.gfxEngine->DrawTransform(*dc_.bufferInfo, invalidRect, {0, 0}, Color::Black(),
OPA_OPAQUE, transMap, imageTranDataInfo);
BaseGfxEngine::GetInstance()->DrawTransform(*dc_.bufferInfo, invalidRect, {0, 0}, Color::Black(),
OPA_OPAQUE, transMap, imageTranDataInfo);
}
}
......@@ -690,44 +690,35 @@ bool RootView::FindSubView(const UIView& parentView, const UIView* subView)
void RootView::InitMapBufferInfo(BufferInfo* bufferInfo)
{
uint32_t bufferSize = bufferInfo->width * bufferInfo->height *
(DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3);
(DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3); // 3: Shift right 3 bits
dc_.mapBufferInfo = new BufferInfo();
(void)memcpy_s(dc_.mapBufferInfo, sizeof(BufferInfo), bufferInfo, sizeof(BufferInfo));
dc_.mapBufferInfo->virAddr = dc_.mapBufferInfo->phyAddr =
dc_.gfxEngine->AllocBuffer(bufferSize, BUFFER_MAP_SURFACE);
if (dc_.mapBufferInfo == nullptr) {
return;
}
dc_.snapShotBufferInfo = new BufferInfo();
(void)memcpy_s(dc_.snapShotBufferInfo, sizeof(BufferInfo), bufferInfo, sizeof(BufferInfo));
dc_.snapShotBufferInfo->virAddr = dc_.snapShotBufferInfo->phyAddr =
dc_.gfxEngine->AllocBuffer(bufferSize, BUFFER_SNAPSHOT_SURFACE);
if (memcpy_s(dc_.mapBufferInfo, sizeof(BufferInfo), bufferInfo, sizeof(BufferInfo)) != EOK) {
delete dc_.mapBufferInfo;
dc_.mapBufferInfo = nullptr;
return;
}
dc_.mapBufferInfo->virAddr = dc_.mapBufferInfo->phyAddr =
BaseGfxEngine::GetInstance()->AllocBuffer(bufferSize, BUFFER_MAP_SURFACE);
}
void RootView::DestroyMapBufferInfo()
{
if (dc_.gfxEngine == nullptr) {
return;
}
if (dc_.mapBufferInfo != nullptr) {
dc_.gfxEngine->FreeBuffer(static_cast<uint8_t *>(dc_.mapBufferInfo->virAddr));
BaseGfxEngine::GetInstance()->FreeBuffer(static_cast<uint8_t *>(dc_.mapBufferInfo->virAddr));
dc_.mapBufferInfo->virAddr = dc_.mapBufferInfo->phyAddr = nullptr;
delete dc_.mapBufferInfo;
dc_.mapBufferInfo = nullptr;
}
if (dc_.snapShotBufferInfo != nullptr) {
dc_.gfxEngine->FreeBuffer(static_cast<uint8_t *>(dc_.snapShotBufferInfo->virAddr));
dc_.snapShotBufferInfo->virAddr = dc_.snapShotBufferInfo->phyAddr = nullptr;
delete dc_.snapShotBufferInfo;
dc_.snapShotBufferInfo = nullptr;
}
}
void RootView::InitDrawContext()
{
dc_.gfxEngine = BaseGfxEngine::GetInstance();
dc_.bufferInfo = dc_.gfxEngine->GetBufferInfo();
dc_.bufferInfo = BaseGfxEngine::GetInstance()->GetBufferInfo();
if (dc_.bufferInfo != nullptr) {
InitMapBufferInfo(dc_.bufferInfo);
......@@ -739,19 +730,19 @@ void RootView::DestroyDrawContext()
DestroyMapBufferInfo();
}
void RootView::UpdateBufferInfo(BufferInfo* bufferInfo)
void RootView::UpdateBufferInfo(BufferInfo* fbBufferInfo)
{
if (dc_.bufferInfo == nullptr) {
dc_.bufferInfo = bufferInfo;
InitMapBufferInfo(bufferInfo);
dc_.bufferInfo = fbBufferInfo;
InitMapBufferInfo(fbBufferInfo);
} else {
if (dc_.bufferInfo->width != bufferInfo->width ||
dc_.bufferInfo->height != bufferInfo->height ||
dc_.bufferInfo->mode != bufferInfo->mode) {
if (dc_.bufferInfo->width != fbBufferInfo->width ||
dc_.bufferInfo->height != fbBufferInfo->height ||
dc_.bufferInfo->mode != fbBufferInfo->mode) {
DestroyMapBufferInfo();
InitMapBufferInfo(bufferInfo);
InitMapBufferInfo(fbBufferInfo);
}
dc_.bufferInfo = bufferInfo;
dc_.bufferInfo = fbBufferInfo;
}
}
......@@ -762,9 +753,6 @@ void RootView::SaveDrawContext()
bakDc_.mapBufferInfo = dc_.mapBufferInfo;
dc_.mapBufferInfo = nullptr;
bakDc_.snapShotBufferInfo = dc_.snapShotBufferInfo;
dc_.snapShotBufferInfo = nullptr;
}
void RootView::RestoreDrawContext()
......@@ -776,8 +764,5 @@ void RootView::RestoreDrawContext()
dc_.mapBufferInfo = bakDc_.mapBufferInfo;
bakDc_.mapBufferInfo = nullptr;
dc_.snapShotBufferInfo = bakDc_.snapShotBufferInfo;
bakDc_.snapShotBufferInfo = nullptr;
}
} // namespace OHOS
......@@ -16,11 +16,11 @@
#include "components/ui_analog_clock.h"
#include "components/ui_image_view.h"
#include "draw/draw_image.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/style.h"
#include "imgdecode/cache_manager.h"
#include "themes/theme.h"
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
UIAnalogClock::UIAnalogClock()
......@@ -273,7 +273,10 @@ void UIAnalogClock::DrawHand(BufferInfo& gfxDstBuffer, const Rect& current, cons
}
}
void UIAnalogClock::DrawHandImage(BufferInfo& gfxDstBuffer, const Rect& current, const Rect& invalidatedArea, Hand& hand)
void UIAnalogClock::DrawHandImage(BufferInfo& gfxDstBuffer,
const Rect& current,
const Rect& invalidatedArea,
Hand& hand)
{
uint8_t pxSize = DrawUtils::GetPxSizeByColorMode(hand.imageInfo_.header.colorMode);
TransformDataInfo imageTranDataInfo = {
......@@ -315,7 +318,8 @@ void UIAnalogClock::DrawHandLine(BufferInfo& gfxDstBuffer, const Rect& invalidat
end.x = xlength + curCenter.x;
end.y = ylength + curCenter.y;
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, hand.width_, hand.color_, hand.opacity_);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea,
hand.width_, hand.color_, hand.opacity_);
}
void UIAnalogClock::SetWorkMode(WorkMode newMode)
......
......@@ -16,9 +16,9 @@
#include "components/ui_arc_label.h"
#include "common/typed_text.h"
#include "draw/draw_label.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "font/ui_font.h"
#include "themes/theme_manager.h"
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
UIArcLabel::UIArcLabel()
......
......@@ -93,7 +93,8 @@ void UIXAxis::TranslateToPixel(int16_t& value)
void UIAxis::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
{
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start_, end_, invalidatedArea, style_->lineWidth_, style_->lineColor_, style_->lineOpa_);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start_, end_, invalidatedArea, style_->lineWidth_,
style_->lineColor_, style_->lineOpa_);
DrawAxisMark(gfxDstBuffer, invalidatedArea);
}
......@@ -108,7 +109,8 @@ void UIXAxis::DrawAxisMark(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea
end.y = enableReverse_ ? (start.y + AXIS_DEFAULT_MARK_LENGTH) : (start.y - AXIS_DEFAULT_MARK_LENGTH);
end.x = start.x;
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, style_->lineWidth_, style_->lineColor_, style_->lineOpa_);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea,
style_->lineWidth_, style_->lineColor_, style_->lineOpa_);
index++;
}
}
......@@ -190,7 +192,8 @@ void UIYAxis::DrawAxisMark(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea
end.x = start.x + AXIS_DEFAULT_MARK_LENGTH;
end.y = start.y;
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, style_->lineWidth_, style_->lineColor_, style_->lineOpa_);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea,
style_->lineWidth_, style_->lineColor_, style_->lineOpa_);
index++;
}
}
......
......@@ -15,8 +15,8 @@
#include "components/ui_box_progress.h"
#include "draw/draw_utils.h"
#include "gfx_utils/graphic_log.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_log.h"
namespace OHOS {
UIBoxProgress::UIBoxProgress()
......@@ -131,22 +131,26 @@ void UIBoxProgress::DrawRoundCap(BufferInfo& gfxDstBuffer,
arcInfo.center = leftTop;
arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
arcInfo.endAngle = 0;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
arcInfo.center = leftBottom;
arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
arcInfo.center = rightTop;
arcInfo.startAngle = 0;
arcInfo.endAngle = QUARTER_IN_DEGREE;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
arcInfo.center = rightBottom;
arcInfo.startAngle = QUARTER_IN_DEGREE;
arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
} else {
switch (direction_) {
case Direction::DIR_LEFT_TO_RIGHT:
......@@ -154,12 +158,14 @@ void UIBoxProgress::DrawRoundCap(BufferInfo& gfxDstBuffer,
arcInfo.center = leftTop;
arcInfo.startAngle = SEMICIRCLE_IN_DEGREE;
arcInfo.endAngle = 0;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
arcInfo.center = leftBottom;
arcInfo.startAngle = 0;
arcInfo.endAngle = SEMICIRCLE_IN_DEGREE;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
break;
}
......@@ -168,12 +174,14 @@ void UIBoxProgress::DrawRoundCap(BufferInfo& gfxDstBuffer,
arcInfo.center = leftTop;
arcInfo.startAngle = THREE_QUARTER_IN_DEGREE;
arcInfo.endAngle = QUARTER_IN_DEGREE;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
arcInfo.center = leftBottom;
arcInfo.startAngle = QUARTER_IN_DEGREE;
arcInfo.endAngle = THREE_QUARTER_IN_DEGREE;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_,
CapType::CAP_NONE);
break;
}
default:
......
......@@ -14,15 +14,14 @@
*/
#include "components/ui_button.h"
#include "animator/interpolation.h"
#include "common/image.h"
#include "draw/draw_image.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/style.h"
#include "imgdecode/cache_manager.h"
#include "themes/theme_manager.h"
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
UIButton::UIButton()
......
......@@ -17,8 +17,8 @@
#include "common/image.h"
#include "draw/draw_arc.h"
#include "draw/draw_image.h"
#include "gfx_utils/graphic_log.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_log.h"
namespace OHOS {
UICanvas::UICanvasPath::~UICanvasPath()
......@@ -487,7 +487,8 @@ void UICanvas::DoDrawLine(BufferInfo& gfxDstBuffer,
GetAbsolutePosition(lineParam->start, rect, style, start);
GetAbsolutePosition(lineParam->end, rect, style, end);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(), paint.GetStrokeColor(), paint.GetOpacity());
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(),
paint.GetStrokeColor(), paint.GetOpacity());
}
void UICanvas::DoDrawCurve(BufferInfo& gfxDstBuffer,
......@@ -510,8 +511,8 @@ void UICanvas::DoDrawCurve(BufferInfo& gfxDstBuffer,
GetAbsolutePosition(curveParam->control1, rect, style, control1);
GetAbsolutePosition(curveParam->control2, rect, style, control2);
BaseGfxEngine::GetInstance()->DrawCubicBezier(gfxDstBuffer, start, control1, control2, end, invalidatedArea, paint.GetStrokeWidth(),
paint.GetStrokeColor(), paint.GetOpacity());
BaseGfxEngine::GetInstance()->DrawCubicBezier(gfxDstBuffer, start, control1, control2, end, invalidatedArea,
paint.GetStrokeWidth(), paint.GetStrokeColor(), paint.GetOpacity());
}
void UICanvas::DoDrawRect(BufferInfo& gfxDstBuffer,
......@@ -623,14 +624,16 @@ void UICanvas::DoDrawCircle(BufferInfo& gfxDstBuffer,
arcInfo.radius = circleParam->radius - halfLineWidth;
drawStyle.lineWidth_ = arcInfo.radius;
drawStyle.lineColor_ = paint.GetFillColor();
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE,
CapType::CAP_NONE);
}
if (enableStroke) {
arcInfo.radius = circleParam->radius + halfLineWidth - 1;
drawStyle.lineWidth_ = static_cast<int16_t>(paint.GetStrokeWidth());
drawStyle.lineColor_ = paint.GetStrokeColor();
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE,
CapType::CAP_NONE);
}
}
......@@ -657,7 +660,8 @@ void UICanvas::DoDrawArc(BufferInfo& gfxDstBuffer,
arcInfo.radius = arcParam->radius + ((paint.GetStrokeWidth() + 1) >> 1);
GetAbsolutePosition(arcParam->center, rect, style, arcInfo.center);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE,
CapType::CAP_NONE);
}
void UICanvas::DoDrawImage(BufferInfo& gfxDstBuffer,
......@@ -706,7 +710,10 @@ void UICanvas::DoDrawLabel(BufferInfo& gfxDstBuffer,
label->SetPosition(startPos.x, startPos.y);
}
void UICanvas::DoDrawLineJoin(BufferInfo& gfxDstBuffer, const Point& center, const Rect& invalidatedArea, const Paint& paint)
void UICanvas::DoDrawLineJoin(BufferInfo& gfxDstBuffer,
const Point& center,
const Rect& invalidatedArea,
const Paint& paint)
{
ArcInfo arcinfo = {{0}};
arcinfo.center = center;
......@@ -719,7 +726,8 @@ void UICanvas::DoDrawLineJoin(BufferInfo& gfxDstBuffer, const Point& center, con
style.lineColor_ = paint.GetStrokeColor();
style.lineWidth_ = static_cast<int16_t>(paint.GetStrokeWidth());
style.lineOpa_ = OPA_OPAQUE;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, style, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, style, OPA_OPAQUE,
CapType::CAP_NONE);
}
void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer,
......@@ -758,7 +766,8 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer,
GetAbsolutePosition(start, rect, style, start);
GetAbsolutePosition(end, rect, style, end);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(), paint.GetStrokeColor(), OPA_OPAQUE);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea,
paint.GetStrokeWidth(), paint.GetStrokeColor(), OPA_OPAQUE);
if ((pathEnd.x == start.x) && (pathEnd.y == start.y)) {
DoDrawLineJoin(gfxDstBuffer, start, invalidatedArea, paint);
}
......@@ -777,7 +786,8 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer,
arcInfo.radius = arcIter->data_.radius + ((paint.GetStrokeWidth() + 1) >> 1);
GetAbsolutePosition(arcIter->data_.center, rect, style, arcInfo.center);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE,
CapType::CAP_NONE);
if (pointIter != path->points_.Begin()) {
DoDrawLineJoin(gfxDstBuffer, pathEnd, invalidatedArea, paint);
}
......@@ -793,8 +803,8 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer,
GetAbsolutePosition(start, rect, style, start);
GetAbsolutePosition(end, rect, style, end);
if ((start.x != end.x) || (start.y != end.y)) {
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(), paint.GetStrokeColor(),
OPA_OPAQUE);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea,
paint.GetStrokeWidth(), paint.GetStrokeColor(), OPA_OPAQUE);
if ((pathEnd.x == start.x) && (pathEnd.y == start.y)) {
DoDrawLineJoin(gfxDstBuffer, start, invalidatedArea, paint);
}
......
......@@ -453,7 +453,8 @@ void UIChartPillar::DrawDataSerials(BufferInfo& gfxDstBuffer, const Rect& invali
}
current.x += x;
xStart.x = current.x;
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, current, xStart, invalidatedArea, barWidth, data->GetFillColor(), style_->lineOpa_);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, current, xStart, invalidatedArea, barWidth,
data->GetFillColor(), style_->lineOpa_);
}
dataSerialIndex++;
}
......@@ -832,7 +833,8 @@ void UIChartPolyline::GradientColor(BufferInfo& gfxDstBuffer, const Rect& invali
}
Point start = {limitPoints.start.x, y};
Point end = {limitPoints.end.x, y};
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, 1, data->GetFillColor(), mixData_[mixScale]);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, 1,
data->GetFillColor(), mixData_[mixScale]);
}
y--;
}
......
......@@ -16,8 +16,8 @@
#include "components/ui_checkbox.h"
#include "default_resource/check_box_res.h"
#include "draw/draw_image.h"
#include "imgdecode/cache_manager.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "imgdecode/cache_manager.h"
namespace OHOS {
namespace {
......@@ -118,7 +118,11 @@ void UICheckBox::CalculateSize()
borderWidth_ = DEFAULT_BORDER_WIDTH * minValue / DEFAULT_HOT_WIDTH;
}
void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rect, Rect trunc, int16_t borderRadius, int16_t rectLineWidth)
void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer,
Rect rect,
Rect trunc,
int16_t borderRadius,
int16_t rectLineWidth)
{
if (backgroundOpacity_ == 0) {
return;
......@@ -152,9 +156,11 @@ void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rec
styleSelect.lineOpa_ = backgroundOpacity_;
uint8_t opa = DrawUtils::GetMixOpacity(opaScale_, backgroundOpacity_);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoLeft, trunc, styleSelect, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, mid, trunc, rectLineWidth * 2, Color::White(), opa); // 2 : double
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, mid, trunc, rectLineWidth * 2, Color::White(),
opa); // 2 : double
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoMid, trunc, styleSelect, opaScale_, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, mid, end, trunc, rectLineWidth * 2, Color::White(), opa); // 2 : double
BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, mid, end, trunc, rectLineWidth * 2, Color::White(),
opa); // 2 : double
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoRight, trunc, styleSelect, opaScale_, CapType::CAP_NONE);
}
......
......@@ -104,7 +104,7 @@ void UICircleProgress::DrawCommonCircle(BufferInfo& gfxDstBuffer, const Rect& in
arcinfo.endAngle = end;
arcinfo.imgSrc = backgroundImage_;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, *backgroundStyle_, opaScale_,
backgroundStyle_->lineCap_);
backgroundStyle_->lineCap_);
}
if ((startAngle != endAngle) || (foregroundStyle_->lineCap_ == CapType::CAP_ROUND)) {
......@@ -114,7 +114,7 @@ void UICircleProgress::DrawCommonCircle(BufferInfo& gfxDstBuffer, const Rect& in
arcinfo.endAngle = endAngle;
arcinfo.imgSrc = foregroundImage_;
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, *foregroundStyle_, opaScale_,
foregroundStyle_->lineCap_);
foregroundStyle_->lineCap_);
}
}
......
......@@ -309,8 +309,8 @@ void UIImageView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
Rect origRect = GetOrigRect();
transMap_->SetTransMapRect(origRect);
OpacityType opaScale = DrawUtils::GetMixOpacity(opa, style_->imageOpa_);
BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, invalidatedArea, {0, 0}, Color::Black(), opaScale, *transMap_,
imageTranDataInfo);
BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, invalidatedArea, {0, 0}, Color::Black(),
opaScale, *transMap_, imageTranDataInfo);
}
}
}
......
......@@ -376,6 +376,7 @@ void UILabel::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea)
Style style = GetStyleConst();
style.textColor_ = GetTextColor();
OpacityType opa = GetMixOpaScale();
labelText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(), GetContentRect(), offsetX_, style, ellipsisIndex_, opa);
labelText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(),
GetContentRect(), offsetX_, style, ellipsisIndex_, opa);
}
} // namespace OHOS
\ No newline at end of file
......@@ -35,7 +35,8 @@ void UILabelButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea
labelButtonText_->ReMeasureTextSize(textRect, labelStyle_);
OpacityType opa = GetMixOpaScale();
uint16_t ellipsisIndex = labelButtonText_->GetEllipsisIndex(textRect, labelStyle_);
labelButtonText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(), textRect, 0, labelStyle_, ellipsisIndex, opa);
labelButtonText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(), textRect, 0,
labelStyle_, ellipsisIndex, opa);
}
UILabelButton::~UILabelButton()
......
......@@ -92,12 +92,14 @@ void UIRadioButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea
styleSelect.lineWidth_ = arcInfoBig.radius;
styleSelect.lineColor_ = Color::GetColorFromRGB(0x1F, 0x71, 0xFF);
if (isIntersect) {
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleSelect, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleSelect,
OPA_OPAQUE, CapType::CAP_NONE);
}
styleSelect.lineWidth_ = arcInfoSmall.radius;
styleSelect.lineColor_ = Color::White();
if (isIntersect) {
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoSmall, trunc, styleSelect, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoSmall, trunc, styleSelect,
OPA_OPAQUE, CapType::CAP_NONE);
}
break;
}
......@@ -107,7 +109,8 @@ void UIRadioButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea
styleUnSelect.lineWidth_ = lineWidth_;
if (isIntersect) {
// 0xa8 : opacity of drawing unselected button arc edge.
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleUnSelect, 0xa8, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleUnSelect,
0xa8, CapType::CAP_NONE);
}
break;
}
......
......@@ -15,8 +15,8 @@
#include "components/ui_toggle_button.h"
#include "common/image.h"
#include "imgdecode/cache_manager.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "imgdecode/cache_manager.h"
namespace OHOS {
UIToggleButton::UIToggleButton() : corner_(DEFAULT_CORNER_RADIUS), radius_(DEFAULT_CORNER_RADIUS - DEAFULT_RADIUS_DIFF),
......@@ -86,7 +86,8 @@ void UIToggleButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre
styleSelect.lineWidth_ = radius_;
styleSelect.lineColor_ = Color::White();
if (isIntersect) {
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoRight, trunc, styleSelect, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoRight, trunc,
styleSelect, OPA_OPAQUE, CapType::CAP_NONE);
}
break;
}
......@@ -105,7 +106,8 @@ void UIToggleButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre
styleUnSelect.lineColor_ = Color::White();
styleUnSelect.lineWidth_ = radius_;
if (isIntersect) {
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoLeft, trunc, styleUnSelect, OPA_OPAQUE, CapType::CAP_NONE);
BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoLeft, trunc,
styleUnSelect, OPA_OPAQUE, CapType::CAP_NONE);
}
break;
}
......
......@@ -820,8 +820,11 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
parent_ = nullptr;
BufferInfo* bufferInfo = BaseGfxEngine::GetInstance()->GetBufferInfo();
int16_t screenWidth = bufferInfo->rect.GetWidth();
int16_t screenHeight = bufferInfo->rect.GetHeight();
if (bufferInfo == nullptr) {
return false;
}
int16_t screenWidth = bufferInfo->width;
int16_t screenHeight = bufferInfo->height;
Rect screenRect(0, 0, screenWidth, screenHeight);
rect_.SetPosition(0, 0);
Rect mask = GetRect();
......
......@@ -16,7 +16,6 @@
#include "core/render_manager.h"
#include "components/root_view.h"
//#include "dock/screen_device_proxy.h"
#include "gfx_utils/graphic_log.h"
#include "hal_tick.h"
#include "securec.h"
......
......@@ -23,7 +23,6 @@
#if ENABLE_WINDOW
#include "gfx_utils/pixel_format_utils.h"
#endif
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
#if ENABLE_WINDOW
......@@ -37,6 +36,13 @@ struct AllocationInfo {
};
#endif
#ifndef TRANSFORMOPTION
#define TRANSFORMOPTION
struct TransformOption {
TransformAlgorithm algorithm;
};
#endif
/** @brief A semaphore for display buffer flushing. */
class FlushSem : public HeapBase {
public:
......
......@@ -43,8 +43,10 @@ void ScreenDeviceProxy::DrawAnimatorBuffer(const Rect& invalidatedArea)
uint8_t pxSize = DrawUtils::GetPxSizeByColorMode(animatorImageInfo_.header.colorMode);
TransformDataInfo imageTranDataInfo = {animatorImageInfo_.header, animatorImageInfo_.data, pxSize, LEVEL0,
BILINEAR};
//DrawUtils::GetInstance()->DrawTransform(invalidRect, {0, 0}, Color::Black(), OPA_OPAQUE, transMap_,
// imageTranDataInfo);
#if 0 // to do delete
DrawUtils::GetInstance()->DrawTransform(invalidRect, {0, 0}, Color::Black(), OPA_OPAQUE, transMap_,
imageTranDataInfo);
#endif
}
}
......
......@@ -120,7 +120,12 @@ uint16_t DrawArc::CalculateTanDegree(uint16_t x, uint16_t y)
return degree;
}
void DrawArc::DrawCircleNoEndpoint(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, uint8_t opa, bool anti)
void DrawArc::DrawCircleNoEndpoint(BufferInfo& gfxDstBuffer,
ArcInfo& arcInfo,
const Rect& mask,
const Style& style,
uint8_t opa,
bool anti)
{
DrawAxisLine(gfxDstBuffer, arcInfo, mask, style, opa);
......@@ -230,8 +235,9 @@ void DrawArc::DrawLineWithDegree(BufferInfo& gfxDstBuffer,
uint8_t quadrant)
{
if (isCircle_) {
DrawHorLine(gfxDstBuffer, Point{static_cast<int16_t>(arcInfo.center.x + start), static_cast<int16_t>(arcInfo.center.y + y)},
arcInfo.imgPos, mask, end - start, style, opaScale, arcInfo.imgSrc);
DrawHorLine(gfxDstBuffer, Point{static_cast<int16_t>(arcInfo.center.x + start),
static_cast<int16_t>(arcInfo.center.y + y)}, arcInfo.imgPos,
mask, end - start, style, opaScale, arcInfo.imgSrc);
return;
}
uint16_t degreeStart = GetDegreeInQuadrant(CalculateTanDegree(MATH_ABS(start), MATH_ABS(y)), quadrant);
......
......@@ -142,7 +142,12 @@ private:
uint8_t quadrant);
#if ENABLE_ANTIALIAS
void DrawLineAnti(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, uint8_t opa);
void DrawPointAnti(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, int16_t x, const Rect& mask, const Style& style, uint8_t antiOpa);
void DrawPointAnti(BufferInfo& gfxDstBuffer,
ArcInfo& arcInfo,
int16_t x,
const Rect& mask,
const Style& style,
uint8_t antiOpa);
#endif
uint16_t GetDegreeInQuadrant(uint16_t degree, uint8_t quadrant);
void SetArcInfo(ArcInfo& arcInfo, const Style& style);
......
......@@ -18,7 +18,7 @@
#include "gfx_utils/color.h"
#include "gfx_utils/geometry2d.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_buffer.h"
namespace OHOS {
class DrawCurve : public HeapBase {
......
......@@ -165,6 +165,7 @@ void DrawLabel::DrawLetterWithRotate(BufferInfo& gfxDstBuffer,
transMap.Rotate(rotateAngle, Vector2<float>(-node.left, node.top - head.ascender));
TransformDataInfo letterTranDataInfo = {ImageHeader{colorMode, 0, 0, 0, node.cols, node.rows}, fontMap, fontWeight,
BlurLevel::LEVEL0};
BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, mask, Point{0, 0}, color, opaScale, transMap, letterTranDataInfo);
BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, mask, Point{0, 0}, color, opaScale, transMap,
letterTranDataInfo);
}
} // namespace OHOS
......@@ -31,8 +31,14 @@ public:
const Point& arcCenter, uint8_t fontId, const UIArcLabel::ArcTextInfo arcTextInfo,
UIArcLabel::TextOrientation orientation, const Style& style, uint8_t opaScale);
static void DrawLetterWithRotate(BufferInfo& gfxDstBuffer, const Rect& mask, uint8_t fontId, uint32_t letter, const Point& pos,
int16_t rotateAngle, const ColorType& color, OpacityType opaScale);
static void DrawLetterWithRotate(BufferInfo& gfxDstBuffer,
const Rect& mask,
uint8_t fontId,
uint32_t letter,
const Point& pos,
int16_t rotateAngle,
const ColorType& color,
OpacityType opaScale);
};
} // namespace OHOS
#endif // GRAPHIC_LITE_DRAW_LABEL_H
......@@ -281,7 +281,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po
sy--;
}
sx += dir;
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity, (acc1 >> SHIFT_8) ^ OPA_OPAQUE);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity,
(acc1 >> SHIFT_8) ^ OPA_OPAQUE);
}
if (temp1 < MAX_LINE_WIDTH) {
endPoints1[temp1++] = sx + dir;
......@@ -304,7 +305,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po
while (--dy) {
if (sy <= y1Int) {
INCREASE_ACC(acc0, accTemp0, adj0, sx, dir);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask, color, opacity, acc0 >> SHIFT_8);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask,
color, opacity, acc0 >> SHIFT_8);
if (temp0 < MAX_LINE_WIDTH) {
edge0 = endPoints0[temp0++];
}
......@@ -312,15 +314,16 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po
} else if (sy < y2Int) {
INCREASE_ACC(acc0, accTemp0, adj0, sx, dir);
INCREASE_ACC(acc2, accTemp2, adj0, sxTemp, dir);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask, color, opacity, acc0 >> SHIFT_8);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask,
color, opacity, acc0 >> SHIFT_8);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sxTemp, sy, mask, color, opacity,
(acc2 >> SHIFT_8) ^ OPA_OPAQUE);
(acc2 >> SHIFT_8) ^ OPA_OPAQUE);
edge0 = sxTemp + dir;
edge1 = sx;
} else if (sy < y3Int) {
INCREASE_ACC(acc2, accTemp2, adj0, sxTemp, dir);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sxTemp, sy, mask, color, opacity,
(acc2 >> SHIFT_8) ^ OPA_OPAQUE);
(acc2 >> SHIFT_8) ^ OPA_OPAQUE);
edge0 = sxTemp + dir;
if (temp1 > 0) {
edge1 = endPoints1[--temp1];
......@@ -354,7 +357,7 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po
}
sy -= dir;
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity,
(acc1 >> SHIFT_8) ^ OPA_OPAQUE);
(acc1 >> SHIFT_8) ^ OPA_OPAQUE);
}
if (x0Int - sx < MAX_LINE_WIDTH) {
endPoints0[x0Int - sx] = sy - dir;
......@@ -375,7 +378,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po
sx++;
}
sy += dir;
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity, (acc1 >> SHIFT_8) ^ OPA_OPAQUE);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity,
(acc1 >> SHIFT_8) ^ OPA_OPAQUE);
}
DrawUtils::GetInstance()->DrawPixel(gfxDstBuffer, x3Int, y3Int, mask, color, opacity);
if (temp1 < MAX_LINE_WIDTH) {
......@@ -399,7 +403,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po
while (--dx) {
if (sx >= x1Int) {
INCREASE_ACC(acc0, accTemp0, adj0, sy, dir);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask, color, opacity, acc0 >> SHIFT_8);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask,
color, opacity, acc0 >> SHIFT_8);
if (temp0 < MAX_LINE_WIDTH) {
edge0 = endPoints0[temp0++];
}
......@@ -407,15 +412,16 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po
} else if (sx > x2Int) {
INCREASE_ACC(acc0, accTemp0, adj0, sy, dir);
INCREASE_ACC(acc2, accTemp2, adj0, syTemp, dir);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask, color, opacity, acc0 >> SHIFT_8);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, syTemp, mask, color, opacity,
(acc2 >> SHIFT_8) ^ OPA_OPAQUE);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask,
color, opacity, acc0 >> SHIFT_8);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, syTemp, mask, color,
opacity, (acc2 >> SHIFT_8) ^ OPA_OPAQUE);
edge0 = syTemp + dir;
edge1 = sy;
} else if (sx > x3Int) {
INCREASE_ACC(acc2, accTemp2, adj0, syTemp, dir);
DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, syTemp, mask, color, opacity,
(acc2 >> SHIFT_8) ^ OPA_OPAQUE);
(acc2 >> SHIFT_8) ^ OPA_OPAQUE);
edge0 = syTemp + dir;
if (temp1 > 0) {
edge1 = endPoints1[--temp1];
......@@ -451,10 +457,11 @@ void DrawLine::DrawThinWuLine(BufferInfo& gfxDstBuffer, const Point& start, cons
INCREASE_ACC(acc, accTemp, adj, sx, dir);
sy++;
if (width == 1) {
DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx + dir, sy, mask, color, opacity,
acc >> SHIFT_8);
DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx + dir, sy, mask,
color, opacity, acc >> SHIFT_8);
} else {
DrawUtils::GetInstance()->DrawVerPixelInLine(gfxDstBuffer, sx, sy, dir, mask, color, opacity, acc >> SHIFT_8);
DrawUtils::GetInstance()->DrawVerPixelInLine(gfxDstBuffer, sx, sy, dir, mask,
color, opacity, acc >> SHIFT_8);
}
}
} else {
......@@ -463,10 +470,11 @@ void DrawLine::DrawThinWuLine(BufferInfo& gfxDstBuffer, const Point& start, cons
INCREASE_ACC(acc, accTemp, adj, sy, dir);
sx--;
if (width == 1) {
DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx, sy + dir, mask, color, opacity,
acc >> SHIFT_8);
DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx, sy + dir, mask,
color, opacity, acc >> SHIFT_8);
} else {
DrawUtils::GetInstance()->DrawHorPixelInLine(gfxDstBuffer, sx, sy, dir, mask, color, opacity, acc >> SHIFT_8);
DrawUtils::GetInstance()->DrawHorPixelInLine(gfxDstBuffer, sx, sy, dir, mask,
color, opacity, acc >> SHIFT_8);
}
}
}
......
......@@ -18,7 +18,7 @@
#include "gfx_utils/color.h"
#include "gfx_utils/geometry2d.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_buffer.h"
namespace OHOS {
class DrawLine : public HeapBase {
......
......@@ -15,10 +15,10 @@
#include "draw/draw_rect.h"
#include "draw/draw_utils.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/graphic_math.h"
#include "gfx_utils/style.h"
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
void DrawRect::Draw(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect,
......
......@@ -20,7 +20,7 @@
#include "gfx_utils/rect.h"
#include "gfx_utils/style.h"
#include "gfx_utils/color.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_buffer.h"
namespace OHOS {
/** @brief Class for drawing rectangle. */
......
......@@ -17,7 +17,12 @@
#include "draw/draw_utils.h"
namespace OHOS {
void DrawTriangle::Draw(BufferInfo& gfxDstBuffer, const Point* points, uint8_t count, const Rect& mask, const ColorType& color, OpacityType opa)
void DrawTriangle::Draw(BufferInfo& gfxDstBuffer,
const Point* points,
uint8_t count,
const Rect& mask,
const ColorType& color,
OpacityType opa)
{
if ((points == nullptr) || (count != VERTEX_NUM)) {
return;
......
......@@ -18,7 +18,7 @@
#include "gfx_utils/color.h"
#include "gfx_utils/geometry2d.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "gfx_utils/graphic_buffer.h"
namespace OHOS {
class DrawTriangle : public HeapBase {
......
......@@ -15,13 +15,13 @@
#include "draw/draw_utils.h"
#include "draw/draw_triangle.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "font/ui_font.h"
#include "font/ui_font_header.h"
#include "gfx_utils/color.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/graphic_math.h"
#include "graphic_performance.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "securec.h"
#ifdef ARM_NEON_OPT
......@@ -45,8 +45,7 @@ namespace OHOS {
} \
ColorMode bufferMode = gfxBufferInfo.mode; \
uint8_t bufferPxSize = GetByteSizeByColorMode(bufferMode); \
uint16_t screenBufferWidth = /*gfxBufferInfo->rect.GetWidth()*/gfxBufferInfo.width; \
Rect bufferRect = gfxBufferInfo.rect;
uint16_t screenBufferWidth = gfxBufferInfo.width;
/* cover mode, src alpha is 255 */
#define COLOR_FILL_COVER(d, dm, r2, g2, b2, sm) \
......@@ -176,7 +175,11 @@ void DrawUtils::DrawColorAreaBySides(BufferInfo& gfxDstBuffer,
DrawUtils::GetInstance()->DrawColorArea(gfxDstBuffer, area, mask, color, opa);
}
void DrawUtils::DrawColorArea(BufferInfo& gfxDstBuffer, const Rect& area, const Rect& mask, const ColorType& color, OpacityType opa) const
void DrawUtils::DrawColorArea(BufferInfo& gfxDstBuffer,
const Rect& area,
const Rect& mask,
const ColorType& color,
OpacityType opa) const
{
DRAW_UTILS_PREPROCESS(gfxDstBuffer, opa);
Rect maskedArea;
......@@ -246,7 +249,12 @@ LutColorMode DrawUtils::GetLutColorModeBySize(uint8_t size)
}
}
void DrawUtils::DrawPixel(BufferInfo& gfxDstBuffer, int16_t x, int16_t y, const Rect& mask, const ColorType& color, OpacityType opa) const
void DrawUtils::DrawPixel(BufferInfo& gfxDstBuffer,
int16_t x,
int16_t y,
const Rect& mask,
const ColorType& color,
OpacityType opa) const
{
if ((x < mask.GetLeft()) || (x > mask.GetRight()) || (y < mask.GetTop()) || (y > mask.GetBottom())) {
return;
......@@ -447,7 +455,7 @@ void DrawUtils::FillAreaWithSoftWare(BufferInfo& gfxDstBuffer,
const OpacityType& opa) const
{
ColorMode mode = gfxDstBuffer.mode;
uint8_t destByteSize = DrawUtils::GetByteSizeByColorMode(mode);
uint8_t destByteSize = GetByteSizeByColorMode(mode);
int16_t destWidth = gfxDstBuffer.width;
int32_t halBufferDeltaByteLen = static_cast<int32_t>(destWidth) * destByteSize;
int16_t width = fillArea.GetWidth();
......@@ -1405,7 +1413,11 @@ void DrawUtils::DrawWithBuffer(BufferInfo& gfxDstBuffer, const Rect& rect,
FillArea(gfxDstBuffer, rect, mask, false, colorBuf);
}
void DrawUtils::FillArea(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& mask, bool isTransparent, const ColorType* colorBuf)
void DrawUtils::FillArea(BufferInfo& gfxDstBuffer,
const Rect& rect,
const Rect& mask,
bool isTransparent,
const ColorType* colorBuf)
{
Rect maskedArea;
if (!maskedArea.Intersect(rect, mask)) {
......
......@@ -19,10 +19,10 @@
#include "gfx_utils/color.h"
#include "common/text.h"
#include "gfx_utils/geometry2d.h"
#include "gfx_utils/graphic_buffer.h"
#include "gfx_utils/graphic_types.h"
#include "gfx_utils/style.h"
#include "gfx_utils/transform.h"
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
#define SWAP_INT16(x, y) \
......
......@@ -15,14 +15,18 @@
#include "engines/gfx/gfx_engine_manager.h"
#include "draw/draw_arc.h"
#include "draw/draw_line.h"
#include "draw/draw_curve.h"
#include "draw/draw_line.h"
#include "draw/draw_rect.h"
namespace OHOS {
BaseGfxEngine* BaseGfxEngine::baseEngine_ = nullptr;
void BaseGfxEngine::DrawArc(BufferInfo& dst, ArcInfo& arcInfo, const Rect& mask,
const Style& style, OpacityType opacity, uint8_t cap)
void BaseGfxEngine::DrawArc(BufferInfo& dst,
ArcInfo& arcInfo,
const Rect& mask,
const Style& style,
OpacityType opacity,
uint8_t cap)
{
DrawArc::GetInstance()->Draw(dst, arcInfo, mask, style, opacity, cap);
}
......@@ -38,14 +42,24 @@ void BaseGfxEngine::DrawLine(BufferInfo& dst,
DrawLine::Draw(dst, start, end, mask, width, color, opacity);
}
void BaseGfxEngine::DrawCubicBezier(BufferInfo& dst, const Point& start, const Point& control1,
const Point& control2, const Point& end, const Rect& mask, int16_t width, ColorType color, OpacityType opacity)
void BaseGfxEngine::DrawCubicBezier(BufferInfo& dst,
const Point& start,
const Point& control1,
const Point& control2,
const Point& end,
const Rect& mask,
int16_t width,
ColorType color,
OpacityType opacity)
{
DrawCurve::DrawCubicBezier(dst, start, control1, control2, end, mask, width, color, opacity);
}
void BaseGfxEngine::DrawRect(BufferInfo& dst, const Rect& rect, const Rect& dirtyRect,
const Style& style, OpacityType opacity)
void BaseGfxEngine::DrawRect(BufferInfo& dst,
const Rect& rect,
const Rect& dirtyRect,
const Style& style,
OpacityType opacity)
{
DrawRect::Draw(dst, rect, dirtyRect, style, opacity);
}
......@@ -62,20 +76,20 @@ void BaseGfxEngine::DrawTransform(BufferInfo& dst,
opacity, transMap, dataInfo);
}
void BaseGfxEngine::Blit(BufferInfo& dst, const Point& dstPos, const BufferInfo& src,
const Rect& subRect, const BlendOption& blendOption)
void BaseGfxEngine::Blit(BufferInfo& dst,
const Point& dstPos,
const BufferInfo& src,
const Rect& subRect,
const BlendOption& blendOption)
{
DrawUtils::GetInstance()->BlendWithSoftWare(static_cast<uint8_t*>(src.virAddr), src.rect, src.stride,
src.rect.GetHeight(), src.mode, src.color, blendOption.opacity, static_cast<uint8_t*>(dst.virAddr),
dst.stride, dst.mode, subRect.GetX(), subRect.GetY());
}
void BaseGfxEngine::Fill(BufferInfo& dst, const Rect& fillArea, const ColorType color,
const OpacityType opacity)
void BaseGfxEngine::Fill(BufferInfo& dst, const Rect& fillArea, const ColorType color, const OpacityType opacity)
{
uint8_t bufferPxSize = DrawUtils::GetByteSizeByColorMode(dst.mode);
//DrawUtils::GetInstance()->FillAreaWithSoftWare(fillArea, static_cast<uint8_t*>(dst.virAddr),
// dst.mode, bufferPxSize, dst.rect.GetWidth(), color, opacity);
DrawUtils::GetInstance()->FillAreaWithSoftWare(dst, fillArea, color, opacity);
}
......
......@@ -15,8 +15,8 @@
#include "engines/gfx/hi3516/hi3516_engine.h"
#include "draw/draw_utils.h"
#include "lite_wm_type.h"
#include "hals/gfx_engines.h"
#include "lite_wm_type.h"
namespace OHOS {
const int16_t HARDWARE_ACC_SIZE_LIMIT = 50 * 50;
......@@ -27,9 +27,9 @@ __attribute__((constructor)) void RegisterHi3516GfxEngine()
}
void Hi3516GfxEngine::Fill(BufferInfo& dst,
const Rect& fillArea,
const ColorType color,
const OpacityType opacity)
const Rect& fillArea,
const ColorType color,
const OpacityType opacity)
{
#if ENABLE_GFX_ENGINES
if ((opacity != OPA_OPAQUE) && (fillArea.GetSize() >= HARDWARE_ACC_SIZE_LIMIT)) {
......
......@@ -18,7 +18,6 @@
#include "gfx_utils/graphic_log.h"
#include "iwindows_manager.h"
namespace OHOS {
WindowImpl::WindowImpl() : rootView_(nullptr), iWindow_(nullptr), isShow_(false), gfxAlloc_({}) {}
......
......@@ -16,11 +16,10 @@
#ifndef GRAPHIC_LITE_WINDOW_IMPL_H
#define GRAPHIC_LITE_WINDOW_IMPL_H
#include "iwindow.h"
#include "components/root_view.h"
#include "window/window.h"
#include "dock/screen_device.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "iwindow.h"
#include "window/window.h"
namespace OHOS {
class WindowImpl : public Window {
......@@ -54,6 +53,14 @@ public:
private:
void UpdateHalDisplayBuffer();
struct AllocationInfo {
uint8_t* virAddr;
uint8_t* phyAddr;
uint16_t width;
uint16_t height;
uint32_t stride;
ImagePixelFormat pixelFormat;
};
RootView* rootView_;
IWindow* iWindow_;
WindowConfig config_;
......
......@@ -16,26 +16,16 @@
#ifndef GRAPHIC_LITE_GFX_ENGINE_MANAGER_H
#define GRAPHIC_LITE_GFX_ENGINE_MANAGER_H
#include "gfx_utils/heap_base.h"
#include "gfx_utils/geometry2d.h"
#include "gfx_utils/graphic_buffer.h"
#include "gfx_utils/graphic_math.h"
#include "gfx_utils/graphic_types.h"
#include "gfx_utils/heap_base.h"
#include "gfx_utils/style.h"
#include "gfx_utils/geometry2d.h"
#include "gfx_utils/transform.h"
namespace OHOS {
class BaseGfxEngine;
struct BufferInfo {
Rect rect;
int32_t stride;
void *phyAddr;
void *virAddr;
uint16_t width;
uint16_t height;
ColorMode mode;
uint32_t color;
};
enum BlendMode {
BLEND_MODE, /* no blending */
BLEND_SRC, /* S */
......@@ -52,9 +42,12 @@ enum BlendMode {
BLEND_SUBTRACT, /* D * (1 - S) */
};
#ifndef TRANSFORMOPTION
#define TRANSFORMOPTION
struct TransformOption {
TransformAlgorithm algorithm;
};
#endif
struct BlendOption {
TransformMap transMap;
......@@ -81,13 +74,6 @@ struct TransformDataInfo {
TransformAlgorithm algorithm;
};
struct DrawContext {
BaseGfxEngine* gfxEngine;
BufferInfo* bufferInfo;
BufferInfo* mapBufferInfo;
BufferInfo* snapShotBufferInfo;
};
enum BufferInfoUsage {
BUFFER_FB_SURFACE,
BUFFER_MAP_SURFACE,
......
......@@ -36,10 +36,10 @@
#define GRAPHIC_LITE_IMAGE_H
#include "gfx_utils/geometry2d.h"
#include "gfx_utils/graphic_buffer.h"
#include "gfx_utils/heap_base.h"
#include "gfx_utils/image_info.h"
#include "gfx_utils/style.h"
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
/**
......@@ -133,7 +133,11 @@ public:
*/
bool SetSrc(const ImageInfo* src);
void DrawImage(BufferInfo& gfxDstBuffer, const Rect& coords, const Rect& mask, const Style& style, uint8_t opaScale) const;
void DrawImage(BufferInfo& gfxDstBuffer,
const Rect& coords,
const Rect& mask,
const Style& style,
uint8_t opaScale) const;
protected:
const ImageInfo* imageInfo_;
......
......@@ -264,8 +264,29 @@ public:
void DrawTop(UIView* view, const Rect& rect);
void UpdateBufferInfo(BufferInfo* bufferInfo);
/**
* @brief 根据FBBuffer信息更新内存信息.
*
* @param bufferInfo FBBuffer信息
* @since 1.0
* @version 1.0
*/
void UpdateBufferInfo(BufferInfo* fbBufferInfo);
/**
* @brief 保存绘制上下文.
*
* @since 1.0
* @version 1.0
*/
void SaveDrawContext();
/**
* @brief 恢复绘制上下文.
*
* @since 1.0
* @version 1.0
*/
void RestoreDrawContext();
private:
friend class RenderManager;
......@@ -312,6 +333,17 @@ private:
#if ENABLE_WINDOW
WindowImpl* boundWindow_ {nullptr};
#endif
/**
* @brief 绘制上下文结构信息.
* @param bufferInfo FB Buffer信息.
* @param mapBufferInfo 动效变换Buffer信息.
* @since 5.0
* @version 3.0
*/
struct DrawContext {
BufferInfo* bufferInfo;
BufferInfo* mapBufferInfo;
};
DrawContext dc_;
DrawContext bakDc_;
};
......
......@@ -225,10 +225,19 @@ protected:
void GetBackgroundParam(Point& startPoint, int16_t& width, int16_t& height, uint16_t& radius, const Style& style);
void DrawBackground(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea);
void DrawForeground(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea, Rect& coords);
void DrawRoundCap(BufferInfo& gfxDstBuffer, const Image* image, const Point& imgPos, const Rect& rect, const Rect& invalidatedArea,
uint16_t radius, const Style& style);
void DrawValidRect(BufferInfo& gfxDstBuffer, const Image* image, const Rect& rect, const Rect& invalidatedArea, const Style& style,
uint16_t radius);
void DrawRoundCap(BufferInfo& gfxDstBuffer,
const Image* image,
const Point& imgPos,
const Rect& rect,
const Rect& invalidatedArea,
uint16_t radius,
const Style& style);
void DrawValidRect(BufferInfo& gfxDstBuffer,
const Image* image,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style,
uint16_t radius);
uint16_t progressWidth_;
uint16_t progressHeight_;
......
......@@ -656,26 +656,65 @@ protected:
delete pathParam;
}
static void DoDrawLine(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawCurve(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawRect(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoFillRect(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawCircle(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawArc(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawImage(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawLabel(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawPath(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea,
const Style& style);
static void DoDrawLine(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoDrawCurve(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoDrawRect(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoFillRect(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoDrawCircle(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoDrawArc(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoDrawImage(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoDrawLabel(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void DoDrawPath(BufferInfo& gfxDstBuffer,
void* param,
const Paint& paint,
const Rect& rect,
const Rect& invalidatedArea,
const Style& style);
static void GetAbsolutePosition(const Point& prePoint, const Rect& rect, const Style& style, Point& point);
static void DoDrawLineJoin(BufferInfo& gfxDstBuffer, const Point& center, const Rect& invalidatedArea, const Paint& paint);
static void DoDrawLineJoin(BufferInfo& gfxDstBuffer,
const Point& center,
const Rect& invalidatedArea,
const Paint& paint);
};
} // namespace OHOS
#endif // GRAPHIC_LITE_UI_CANVAS_H
......@@ -224,8 +224,16 @@ public:
protected:
virtual void ReverseState();
virtual void CalculateSize();
void SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rect, Rect trunc, int16_t borderRadius, int16_t rectLineWidth);
void UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rect, Rect trunc, int16_t borderRadius, int16_t rectLineWidth);
void SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer,
Rect rect,
Rect trunc,
int16_t borderRadius,
int16_t rectLineWidth);
void UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer,
Rect rect,
Rect trunc,
int16_t borderRadius,
int16_t rectLineWidth);
#if DEFAULT_ANIMATION
virtual void ResetCallback();
void Callback(UIView* view) override;
......
......@@ -48,14 +48,13 @@
#endif
#include "gfx_utils/color.h"
#include "gfx_utils/geometry2d.h"
#include "gfx_utils/graphic_buffer.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/heap_base.h"
#include "gfx_utils/image_info.h"
#include "gfx_utils/style.h"
#include "gfx_utils/transform.h"
#include "engines/gfx/gfx_engine_manager.h"
namespace OHOS {
/* Enumerates view types. */
enum UIViewType : uint8_t {
......
......@@ -34,7 +34,6 @@ void UITestViewScaleRotate::SetUp()
list_->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, 0, width, height + 1);
container_->Add(list_);
}
RenderManager::GetInstance().RegisterFPSChangedListener(this);
}
void UITestViewScaleRotate::TearDown()
......
......@@ -30,10 +30,10 @@
#include "layout/list_layout.h"
#include "gfx_utils/sys_info.h"
#include "ui_test.h"
#include "stdio.h"
#include <stdio.h>
namespace OHOS {
class UITestViewScaleRotate : public UITest, public AnimatorCallback, public SysInfo::OnFPSChangedListener {
class UITestViewScaleRotate : public UITest, public AnimatorCallback {
public:
UITestViewScaleRotate() : animator_(this, nullptr, 1000, true) // 1000: the animator duration time is 1000ms
{
......@@ -51,13 +51,6 @@ public:
void UIKit_View_Scale_Rotate_Test_UICircleProgress_005();
void UIKit_View_Scale_Rotate_Test_UIDigitalClock_006();
void UIKit_View_Scale_Rotate_Test_Group_007();
virtual void OnFPSChanged(float newFPS) override
{
//printf("view scale rotate: %f\n", newFPS);
GRAPHIC_LOGE("view scale rotate: %f\n", newFPS);
}
private:
const int GROUP_WIDHT = 454;
const int GROUP_HEIGHT = 300;
......
/*
/*
* Copyright (c) 2020-2021 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.
......@@ -18,16 +18,17 @@
#include "common/graphic_startup.h"
#include "common/image_decode_ability.h"
#include "common/input_device_manager.h"
#include "draw/draw_utils.h"
#include "font/ui_font.h"
#include "font/ui_font_header.h"
#include "font/ui_font_vector.h"
#include "key_input.h"
#include "mouse_input.h"
#include "draw/draw_utils.h"
#include "mousewheel_input.h"
#include "windows.h"
namespace OHOS {
bool Monitor::bRegister_ = false;
bool Monitor::isRegister_ = false;
void Monitor::InitHal()
{
......@@ -56,7 +57,7 @@ BufferInfo* Monitor::GetBufferInfo()
bufferInfo->mode = ARGB8888;
bufferInfo->color = 0x44;
bufferInfo->phyAddr = bufferInfo->virAddr = tftFb_;
bufferInfo->stride = HORIZONTAL_RESOLUTION * DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3;
bufferInfo->stride = HORIZONTAL_RESOLUTION * (DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3); // 3: Shift right 3 bits
bufferInfo->width = HORIZONTAL_RESOLUTION;
bufferInfo->height = VERTICAL_RESOLUTION;
}
......
......@@ -16,10 +16,9 @@
#ifndef GRAPHIC_LITE_MONITOR_H
#define GRAPHIC_LITE_MONITOR_H
#include <QtCore/qobject.h>
#include "dock/screen_device.h"
#include "font/ui_font_header.h"
#include "engines/gfx/gfx_engine_manager.h"
#include "font/ui_font_header.h"
#include <QtCore/qobject.h>
namespace OHOS {
class Monitor : public QObject, public BaseGfxEngine {
......@@ -30,9 +29,9 @@ public:
static Monitor* GetInstance()
{
static Monitor instance;
if (!bRegister_) {
if (!isRegister_) {
BaseGfxEngine::InitGfxEngine(&instance);
bRegister_ = true;
isRegister_ = true;
}
return &instance;
}
......@@ -61,7 +60,7 @@ private:
uint32_t tftFb_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION];
uint32_t animaterBuffer_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION];
uint32_t defaultColor_;
static bool bRegister_;
static bool isRegister_;
};
} // namespace OHOS
......
......@@ -133,8 +133,6 @@ HEADERS += \
../../../../frameworks/dfx/point_event_injector.h \
../../../../frameworks/dock/input_device.h \
../../../../frameworks/dock/pointer_input_device.h \
../../../../frameworks/dock/screen_device.h \
../../../../frameworks/dock/screen_device_proxy.h \
../../../../frameworks/dock/virtual_input_device.h \
../../../../frameworks/draw/draw_arc.h \
../../../../frameworks/draw/draw_curve.h \
......
......@@ -88,8 +88,8 @@ SOURCES += \
../../../../frameworks/dock/key_input_device.cpp \
../../../../frameworks/dock/pointer_input_device.cpp \
../../../../frameworks/dock/rotate_input_device.cpp \
../../../../frameworks/dock/screen_device_proxy.cpp \
../../../../frameworks/dock/virtual_input_device.cpp \
../../../../frameworks/engines/gfx/gfx_engine_manager.cpp \
../../../../frameworks/draw/draw_arc.cpp \
../../../../frameworks/draw/draw_curve.cpp \
../../../../frameworks/draw/draw_image.cpp \
......@@ -202,8 +202,6 @@ HEADERS += \
../../../../frameworks/dfx/point_event_injector.h \
../../../../frameworks/dock/input_device.h \
../../../../frameworks/dock/pointer_input_device.h \
../../../../frameworks/dock/screen_device.h \
../../../../frameworks/dock/screen_device_proxy.h \
../../../../frameworks/dock/virtual_input_device.h \
../../../../frameworks/draw/draw_arc.h \
../../../../frameworks/draw/draw_curve.h \
......@@ -225,6 +223,7 @@ HEADERS += \
../../../../interfaces/innerkits/dock/focus_manager.h \
../../../../interfaces/innerkits/dock/rotate_input_device.h \
../../../../interfaces/innerkits/dock/vibrator_manager.h \
../../../../interfaces/innerkits/engines/gfx/gfx_engine_manager.h \
../../../../interfaces/kits/animator/animator.h \
../../../../interfaces/kits/animator/easing_equation.h \
../../../../interfaces/kits/animator/interpolation.h \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册