用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.1 KiB

#pragma once
#include <core/SkPaint.h>
#include <core/SkCanvas.h>
#include <core/sktdarray.h>
class SkTextLayoutEx {
public:
//not support for DT_PREFIXONLY
void init(const wchar_t text[], size_t length,SkRect rc, SkPaint &paint,UINT uFormat);
SkRect draw(SkCanvas* canvas);
private:
SkScalar drawLineEndWithEllipsis(SkCanvas *canvas, SkScalar x, SkScalar y, int iBegin,int iEnd,SkScalar maxWidth);
SkScalar drawLine(SkCanvas *canvas, SkScalar x, SkScalar y, int iBegin,int iEnd);
void buildLines();
void drawText(SkCanvas *canvas,const wchar_t* text, size_t length, SkScalar x, SkScalar y, SkPaint& paint);
SkScalar measureText( SkPaint *paint,const wchar_t* text, size_t length);
private:
SkTDArray<wchar_t> m_text; //文本内容
SkTDArray<int> m_prefix; //前缀符索引
struct LineInfo {
int nOffset;
int nLen;
};
SkTDArray<LineInfo> m_lines; //分行索引
UINT m_uFormat; //显示标志
SkRect m_rcBound; //限制矩形
SkPaint *m_paint;
};
SkRect DrawText_Skia(SkCanvas* canvas,const wchar_t *text,int len,SkRect box, SkPaint& paint,UINT uFormat);