25#if defined(SK_GANESH) || defined(SK_USE_LEGACY_GANESH_TEXT_APIS)
30#include <initializer_list>
42 : fMaskType{maskFormat}, fCanDrawDirect{canDrawDirect},
43 fCreationMatrix{creationMatrix}, fCreationBounds{creationBounds},
54 maskType, creationMatrix, creationBounds, leftTop, fillerType ==
kIsDirect};
59 int checkingMaskType =
buffer.readInt();
66 const bool canDrawDirect =
buffer.readBool();
69 buffer.readMatrix(&creationMatrix);
74 if (leftTop.
empty()) {
return std::nullopt; }
77 return VertexFiller{maskType, creationMatrix, creationBounds, leftTop, canDrawDirect};
81 buffer.writeInt(
static_cast<int>(fMaskType));
82 buffer.writeBool(fCanDrawDirect);
83 buffer.writeMatrix(fCreationMatrix);
84 buffer.writeRect(fCreationBounds);
120#if defined(SK_GANESH) || defined(SK_USE_LEGACY_GANESH_TEXT_APIS)
151 if (fMaskType != MaskFormat::kARGB) {
153 return matrix.hasPerspective() ?
sizeof(Mask3DVertex) :
sizeof(Mask2DVertex);
156 return matrix.hasPerspective() ?
sizeof(ARGB3DVertex) :
sizeof(ARGB2DVertex);
161void fillDirectNoClipping(
SkZip<Mask2DVertex[4],
const Glyph*,
const SkPoint> quadData,
164 for (
auto[quad, glyph, leftTop] : quadData) {
165 auto[al, at, ar,
ab] = glyph->fAtlasLocator.getUVs();
166 SkScalar dl = leftTop.x() + originOffset.
x(),
167 dt = leftTop.y() + originOffset.
y(),
171 quad[0] = {{dl, dt},
color, {al, at}};
173 quad[2] = {{
dr, dt},
color, {ar, at}};
178template <
typename Rect>
179static auto LTBR(
const Rect& r) {
180 return std::make_tuple(r.left(), r.top(), r.right(), r.bottom());
184template<
typename Quad,
typename VertexData>
189 for (
auto[quad, glyph, leftTop] : quadData) {
190 auto[al, at, ar,
ab] = glyph->fAtlasLocator.getUVs();
191 uint16_t
w = ar - al,
193 SkScalar l = leftTop.x() + originOffset.
x(),
194 t = leftTop.y() + originOffset.
y();
195 if (
clip ==
nullptr) {
197 quad[0] = {{dl, dt},
color, {al, at}};
199 quad[2] = {{
dr, dt},
color, {ar, at}};
204 if (!
clip->containsNoEmptyCheck(devIRect)) {
206 al += clipped.left() - devIRect.
left();
207 at += clipped.top() - devIRect.
top();
208 ar += clipped.right() - devIRect.
right();
209 ab += clipped.bottom() - devIRect.
bottom();
210 std::tie(dl, dt,
dr,
db) = LTBR(clipped);
213 std::tie(dl, dt,
dr,
db) = std::make_tuple(0, 0, 0, 0);
214 std::tie(al, at, ar,
ab) = std::make_tuple(0, 0, 0, 0);
217 std::tie(dl, dt,
dr,
db) = LTBR(devIRect);
219 quad[0] = {{dl, dt},
color, {al, at}};
221 quad[2] = {{
dr, dt},
color, {ar, at}};
227template<
typename Quad,
typename VertexData>
231 for (
auto [quad, glyph, leftTop] : quadData) {
232 auto [l, t] = leftTop;
233 auto [r,
b] = leftTop + glyph->fAtlasLocator.widthHeight();
235 lb = viewDifference.
mapXY(l,
b),
236 rt = viewDifference.
mapXY(r, t),
237 rb = viewDifference.
mapXY(r,
b);
238 auto [al, at, ar,
ab] = glyph->fAtlasLocator.getUVs();
239 quad[0] = {lt,
color, {al, at}};
240 quad[1] = {lb,
color, {al,
ab}};
241 quad[2] = {rt,
color, {ar, at}};
242 quad[3] = {rb,
color, {ar,
ab}};
246template<
typename Quad,
typename VertexData>
256 for (
auto [quad, glyph, leftTop] : quadData) {
257 auto [l, t] = leftTop;
258 auto [r,
b] = leftTop + glyph->fAtlasLocator.widthHeight();
263 auto [al, at, ar,
ab] = glyph->fAtlasLocator.getUVs();
264 quad[0] = {lt,
color, {al, at}};
265 quad[1] = {lb,
color, {al,
ab}};
266 quad[2] = {rt,
color, {ar, at}};
267 quad[3] = {rb,
color, {ar,
ab}};
271void VertexFiller::fillVertexData(
int offset,
int count,
276 void* vertexBuffer)
const {
277 auto quadData = [&](
auto dst) {
284 if (fCanDrawDirect) {
285 auto [noTransformNeeded, originOffset] =
288 if (noTransformNeeded) {
290 if (fMaskType != MaskFormat::kARGB) {
291 using Quad = Mask2DVertex[4];
293 fillDirectNoClipping(quadData((
Quad*)vertexBuffer),
color, originOffset);
295 using Quad = ARGB2DVertex[4];
297 fillDirectClipped(quadData((
Quad*)vertexBuffer),
color, originOffset);
300 if (fMaskType != MaskFormat::kARGB) {
301 using Quad = Mask2DVertex[4];
303 fillDirectClipped(quadData((
Quad*)vertexBuffer),
color, originOffset, &
clip);
305 using Quad = ARGB2DVertex[4];
307 fillDirectClipped(quadData((
Quad*)vertexBuffer),
color, originOffset, &
clip);
315 SkMatrix viewDifference = this->viewDifference(positionMatrix);
317 if (fMaskType == MaskFormat::kARGB) {
318 using Quad = ARGB2DVertex[4];
319 SkASSERT(
sizeof(ARGB2DVertex) == this->vertexStride(positionMatrix));
320 fill2D(quadData((
Quad*)vertexBuffer),
color, viewDifference);
322 using Quad = Mask2DVertex[4];
323 SkASSERT(
sizeof(Mask2DVertex) == this->vertexStride(positionMatrix));
324 fill2D(quadData((
Quad*)vertexBuffer),
color, viewDifference);
327 if (fMaskType == MaskFormat::kARGB) {
328 using Quad = ARGB3DVertex[4];
329 SkASSERT(
sizeof(ARGB3DVertex) == this->vertexStride(positionMatrix));
330 fill3D(quadData((
Quad*)vertexBuffer),
color, viewDifference);
332 using Quad = Mask3DVertex[4];
333 SkASSERT(
sizeof(Mask3DVertex) == this->vertexStride(positionMatrix));
334 fill3D(quadData((
Quad*)vertexBuffer),
color, viewDifference);
340AtlasTextOp::MaskType VertexFiller::opMaskType()
const {
342 case MaskFormat::kA8:
return AtlasTextOp::MaskType::kGrayscaleCoverage;
343 case MaskFormat::kA565:
return AtlasTextOp::MaskType::kLCDCoverage;
344 case MaskFormat::kARGB:
return AtlasTextOp::MaskType::kColorBitmap;
356 const SkMatrix &positionMatrix)
const {
357 if (fCanDrawDirect) {
358 const auto [directDrawCompatible,
offset] =
361 if (directDrawCompatible) {
368 return {
false, viewDifference.
mapRect(fCreationBounds)};
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static bool SkScalarIsInt(SkScalar x)
constexpr int SkCount(const Container &c)
constexpr auto SkMakeZip(Ts &&... ts)
skgpu::MaskFormat MaskFormat
SkScalar getSkewY() const
void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
SkScalar getSkewX() const
bool invert(SkMatrix *inverse) const
void mapXY(SkScalar x, SkScalar y, SkPoint *result) const
SkScalar getScaleX() const
static const SkMatrix & I()
SkScalar getScaleY() const
SkPoint mapOrigin() const
bool hasPerspective() const
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
constexpr bool empty() const
SkSpan< T > makePODSpan(SkSpan< const T > s)
static std::optional< VertexFiller > MakeFromBuffer(SkReadBuffer &buffer, SubRunAllocator *alloc)
static VertexFiller Make(skgpu::MaskFormat maskType, const SkMatrix &creationMatrix, SkRect creationBounds, SkSpan< const SkPoint > positions, SubRunAllocator *alloc, FillerType fillerType)
std::tuple< bool, SkRect > deviceRectAndCheckTransform(const SkMatrix &positionMatrix) const
void flatten(SkWriteBuffer &buffer) const
VertexFiller(skgpu::MaskFormat maskFormat, const SkMatrix &creationMatrix, SkRect creationBounds, SkSpan< const SkPoint > leftTop, bool canDrawDirect)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
unsigned useCenter Optional< SkMatrix > matrix
const CatchEntryMove ab[]
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
std::array< Point, 4 > Quad
static const int kMaskFormatCount
skgpu::graphite::Rect Rect
static std::tuple< bool, SkVector > can_use_direct(const SkMatrix &creationMatrix, const SkMatrix &positionMatrix)
SkSpan< SkPoint > MakePointsFromBuffer(SkReadBuffer &buffer, SubRunAllocator *alloc)
bool intersect(const SkIRect &r)
constexpr int32_t top() const
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
constexpr int32_t bottom() const
constexpr int32_t right() const
constexpr int32_t left() const
constexpr float y() const
constexpr float x() const
static constexpr SkRect MakeEmpty()
constexpr SkRect makeOffset(float dx, float dy) const
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)