178 {
184 acceptedPackedGlyphIDs.
resize(maxGlyphRunSize);
185 acceptedPositions.
resize(maxGlyphRunSize);
186 const auto acceptedBuffer =
SkMakeZip(acceptedPackedGlyphIDs, acceptedPositions);
187 rejectedGlyphIDs.
resize(maxGlyphRunSize);
188 rejectedPositions.
resize(maxGlyphRunSize);
189 const auto rejectedBuffer =
SkMakeZip(rejectedGlyphIDs, rejectedPositions);
190
191
192
193 auto& props = (kN32_SkColorType == fColorType &&
paint.isSrcOver())
194 ? fDeviceProps
195 : fBitmapFallbackProps;
196
198 SkMatrix positionMatrix{drawMatrix};
200 for (auto& glyphRun : glyphRunList) {
201 const SkFont& runFont = glyphRun.font();
202
204
206 auto [strikeSpec, strikeToSourceScale] =
208
209 auto strike = strikeSpec.findOrCreateStrike();
210
211 {
214 acceptedBuffer,
215 rejectedBuffer);
216
218
219
222
225 const bool needsExactCTM = pathPaint.
getShader() ||
228 (stroking && !hairline);
229
230 if (!needsExactCTM) {
231 for (
auto [glyph,
pos] : accepted) {
235 m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
236 translate.
x(), translate.
y());
240 }
241 } else {
242 for (
auto [glyph,
pos] : accepted) {
246 m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
247 translate.
x(), translate.
y());
248
250 path->transform(
m, &deviceOutline);
252 canvas->
drawPath(deviceOutline, pathPaint);
253 }
254 }
255 }
256
260 acceptedBuffer,
261 rejectedBuffer);
263
264 for (
auto [glyph,
pos] : accepted) {
268 m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
269 translate.
x(), translate.
y());
272 m.mapRect(&drawableBounds);
274 drawable->
draw(canvas, &
m);
275 }
276 }
277 }
278 if (!
source.
empty() && !positionMatrix.hasPerspective()) {
280 runFont,
paint, props, fScalerContextFlags, positionMatrix);
281
283
285 positionMatrix,
287 acceptedBuffer,
288 rejectedBuffer);
290 bitmapDevice->paintMasks(accepted,
paint);
291 }
293 std::vector<SkPoint> sourcePositions;
294
295
299
300 auto glyphIDs =
source.get<0>();
301 auto positions =
source.get<1>();
304
305
307 if (glyph->isEmpty()) {
308 continue;
309 }
312
313 sourcePositions.push_back(srcPos);
315 rect.makeOffset(srcPos);
316 positionMatrix.mapRectToQuad(corners,
rect);
317
320
323
326
329 }
330
331 if (maxScale <= 0) {
332 continue;
333 }
334
335 if (maxScale * runFont.
getSize() > 256) {
336 maxScale = 256.0f / runFont.
getSize();
337 }
338
341 runFont,
paint, props, fScalerContextFlags, cacheScale);
342
344
346 positionMatrix,
348 acceptedBuffer,
349 rejectedBuffer);
350 const SkScalar invMaxScale = 1.0f/maxScale;
351 for (
auto [glyph, srcPos] :
SkMakeZip(accepted.get<0>(), sourcePositions)) {
352 SkMask mask = glyph->mask();
353
355 continue;
356 }
359 const_cast<uint8_t*
>(mask.
fImage),
362
363
364
367
368
369
371 translate.
preScale(invMaxScale, invMaxScale);
372
373
374
376 }
377 }
378
379
380
381 }
382}
constexpr auto SkMakeZip(Ts &&... ts)
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawPath(const SkPath &path, const SkPaint &paint)
void concat(const SkMatrix &matrix)
void draw(SkCanvas *, const SkMatrix *=nullptr)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
static const SkMatrix & I()
SkMatrix & preTranslate(SkScalar dx, SkScalar dy)
SkMatrix & preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkPathEffect * getPathEffect() const
void setAntiAlias(bool aa)
@ kFill_Style
set to fill geometry
SkMaskFilter * getMaskFilter() const
SkScalar getStrokeWidth() const
SkShader * getShader() const
SkPath & setIsVolatile(bool isVolatile)
static SkStrikeSpec MakeMask(const SkFont &font, const SkPaint &paint, const SkSurfaceProps &surfaceProps, SkScalerContextFlags scalerContextFlags, const SkMatrix &deviceMatrix)
static bool ShouldDrawAsPath(const SkPaint &paint, const SkFont &font, const SkMatrix &matrix)
sk_sp< SkStrike > findOrCreateStrike() const
static std::tuple< SkStrikeSpec, SkScalar > MakePath(const SkFont &font, const SkPaint &paint, const SkSurfaceProps &surfaceProps, SkScalerContextFlags scalerContextFlags)
void resize(size_t count)
size_t maxGlyphRunSize() const
static float max(float r, float g, float b)
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
std::tuple< SkZip< const SkGlyphID, const SkPoint >, SkZip< SkGlyphID, SkPoint > > prepare_for_drawable_drawing(StrikeForGPU *strike, SkZip< const SkGlyphID, const SkPoint > source, SkZip< SkGlyphID, SkPoint > acceptedBuffer, SkZip< SkGlyphID, SkPoint > rejectedBuffer)
std::tuple< SkZip< const SkGlyphID, const SkPoint >, SkZip< SkGlyphID, SkPoint > > prepare_for_path_drawing(StrikeForGPU *strike, SkZip< const SkGlyphID, const SkPoint > source, SkZip< SkGlyphID, SkPoint > acceptedBuffer, SkZip< SkGlyphID, SkPoint > rejectedBuffer)
std::tuple< SkZip< const SkPackedGlyphID, const SkPoint, const SkMask::Format >, SkZip< SkGlyphID, SkPoint >, SkRect > prepare_for_direct_mask_drawing(StrikeForGPU *strike, const SkMatrix &positionMatrix, SkZip< const SkGlyphID, const SkPoint > source, SkZip< SkPackedGlyphID, SkPoint, SkMask::Format > acceptedBuffer, SkZip< SkGlyphID, SkPoint > rejectedBuffer)
constexpr int32_t top() const
constexpr SkISize size() const
constexpr int32_t left() const
static SkImageInfo MakeN32Premul(int width, int height)
@ kARGB32_Format
SkPMColor.
uint8_t const *const fImage
static constexpr SkPoint Make(float x, float y)
constexpr float y() const
constexpr float x() const