31#include <initializer_list>
41 auto widthHeight =
a.widthHeight();
48 for (
int x = -10;
x < 10;
x++) {
49 for(
int y = -10;
y < 10;
y++) {
56 for (
int x = -10;
x < 10;
x++) {
57 for(
int y = -10;
y < 10;
y++) {
67 glyph->fAdvanceX = 10;
68 glyph->fAdvanceY = 11;
73 glyph->fMaskFormat = SkMask::Format::kA8_Format;
77 glyph->fAdvanceX = 10;
78 glyph->fAdvanceY = 11;
83 glyph->fMaskFormat = SkMask::Format::kA8_Format;
93 srcGlyph.flattenMetrics(writeBuffer);
110 srcGlyph.flattenMetrics(writeBuffer);
123 uint8_t badData[] = {1, 2, 3, 4, 5, 6, 7, 8};
135 static constexpr uint8_t
X = 0xff;
136 static constexpr uint8_t O = 0x00;
137 uint8_t imageData[][8] = {
149 srcGlyph.setImage(&alloc, imageData);
152 srcGlyph.flattenMetrics(writeBuffer);
153 srcGlyph.flattenImage(writeBuffer);
165 dstGlyph->addImageFromBuffer(readBuffer, &alloc);
167 const uint8_t* dstImage = (
const uint8_t*)dstGlyph->image();
168 for (
int y = 0;
y < dstGlyph->height(); ++
y) {
169 for (
int x = 0;
x < dstGlyph->width(); ++
x) {
176 srcGlyph.flattenMetrics(badWriteBuffer);
178 badWriteBuffer.writeInt(8);
180 data = badWriteBuffer.snapshotAsData();
190 dstGlyph->addImageFromBuffer(badReadBuffer, &alloc);
201 srcPath.
addRect(srcGlyph.rect());
203 srcGlyph.setPath(&alloc, &srcPath,
false);
206 srcGlyph.flattenMetrics(writeBuffer);
207 srcGlyph.flattenPath(writeBuffer);
219 dstGlyph->addPathFromBuffer(readBuffer, &alloc);
222 const SkPath* dstPath = dstGlyph->path();
228 srcGlyph.flattenMetrics(badWriteBuffer);
231 badWriteBuffer.writeInt(9);
233 data = badWriteBuffer.snapshotAsData();
242 dstGlyph->addPathFromBuffer(badReadBuffer, &alloc);
249 srcGlyph.flattenMetrics(badWriteBuffer);
251 data = badWriteBuffer.snapshotAsData();
261 dstGlyph->addPathFromBuffer(badReadBuffer, &alloc);
272 class TestDrawable final :
public SkDrawable {
288 srcGlyph.setDrawable(&alloc, srcDrawable);
292 srcGlyph.flattenMetrics(writeBuffer);
293 srcGlyph.flattenDrawable(writeBuffer);
305 dstGlyph->addDrawableFromBuffer(readBuffer, &alloc);
308 SkDrawable* dstDrawable = dstGlyph->drawable();
313 srcGlyph.flattenMetrics(badWriteBuffer);
315 badWriteBuffer.writeInt(8);
317 data = badWriteBuffer.snapshotAsData();
327 dstGlyph->addDrawableFromBuffer(badReadBuffer, &alloc);
333 class TestDrawable final :
public SkDrawable {
339 size_t onApproximateBytesUsed()
override {
342 void onDraw(
SkCanvas* canvas)
override {
365 badWriteBuffer.writeInt(8);
367 data = badWriteBuffer.snapshotAsData();
385 SkString(
"half4 main(float2 xy) { return half4(0, 1, 0, 1); }"))
419 for (
bool allowSkSL : {
true,
false}) {
428 readBuffer.setAllowSkSL(allowSkSL);
constexpr int kMaxPictureOpsToUnrollInsteadOfRef
static sk_sp< SkDrawable > make_sksl_drawable()
DEF_TEST(SkGlyphRectBasic, reporter)
static sk_sp< SkDrawable > make_nested_sksl_drawable()
#define REPORTER_ASSERT(r, cond,...)
void writeInt(int32_t value) override
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawPicture(const SkPicture *picture)
virtual SkRect onGetBounds()=0
virtual void onDraw(SkCanvas *)=0
virtual size_t onApproximateBytesUsed()
static void SetGlyph2(SkGlyph *glyph)
static void SetGlyph1(SkGlyph *glyph)
static std::optional< SkGlyph > MakeFromBuffer(SkReadBuffer &)
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
static sk_sp< SkPictureBackedGlyphDrawable > MakeFromBuffer(SkReadBuffer &buffer)
static void FlattenDrawable(SkWriteBuffer &buffer, SkDrawable *drawable)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkDrawable > finishRecordingAsDrawable()
virtual int approximateOpCount(bool nested=false) const =0
sk_sp< SkShader > makeShader(sk_sp< const SkData > uniforms, sk_sp< SkShader > children[], size_t childCount, const SkMatrix *localMatrix=nullptr) const
static Result MakeForShader(SkString sksl, const Options &)
sk_sp< SkBlender > blender SkRect rect
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
SkGlyphRect rect_union(SkGlyphRect, SkGlyphRect)
SkGlyphRect rect_intersection(SkGlyphRect, SkGlyphRect)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
sk_sp< SkRuntimeEffect > effect
std::shared_ptr< const fml::Mapping > data