// Check for integer translate with the same 2x2 matrix. // Returns the translation, and true if the change from creation matrix to the position matrix // supports using direct glyph masks. static std::tuple<bool, SkVector> can_use_direct( const SkMatrix& creationMatrix, const SkMatrix& positionMatrix) { // The existing direct glyph info can be used if the creationMatrix, and the // positionMatrix have the same 2x2, the translation between them is integer, and no // perspective is involved. Calculate the translation in source space to a translation in // device space by mapping (0, 0) through both the creationMatrix and the positionMatrix; // take the difference.
SkVector translation = positionMatrix.mapOrigin() - creationMatrix.mapOrigin(); return {creationMatrix.getScaleX() == positionMatrix.getScaleX() &&
creationMatrix.getScaleY() == positionMatrix.getScaleY() &&
creationMatrix.getSkewX() == positionMatrix.getSkewX() &&
creationMatrix.getSkewY() == positionMatrix.getSkewY() &&
!positionMatrix.hasPerspective() && !creationMatrix.hasPerspective() &&
SkScalarIsInt(translation.x()) && SkScalarIsInt(translation.y()),
translation};
}
// Handle direct mask drawing specifically. if (fCanDrawDirect) { auto [noTransformNeeded, originOffset] =
can_use_direct(fCreationMatrix, positionMatrix);
if (noTransformNeeded) { if (clip.isEmpty()) { if (fMaskType != MaskFormat::kARGB) { using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(SkMatrix::I()));
fillDirectNoClipping(quadData((Quad*)vertexBuffer), color, originOffset);
} else { using Quad = ARGB2DVertex[4];
SkASSERT(sizeof(ARGB2DVertex) == this->vertexStride(SkMatrix::I()));
fillDirectClipped(quadData((Quad*)vertexBuffer), color, originOffset);
}
} else { if (fMaskType != MaskFormat::kARGB) { using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(SkMatrix::I()));
fillDirectClipped(quadData((Quad*)vertexBuffer), color, originOffset, &clip);
} else { using Quad = ARGB2DVertex[4];
SkASSERT(sizeof(ARGB2DVertex) == this->vertexStride(SkMatrix::I()));
fillDirectClipped(quadData((Quad*)vertexBuffer), color, originOffset, &clip);
}
} return;
}
}
// Handle the general transformed case.
SkMatrix viewDifference = this->viewDifference(positionMatrix); if (!positionMatrix.hasPerspective()) { if (fMaskType == MaskFormat::kARGB) { using Quad = ARGB2DVertex[4];
SkASSERT(sizeof(ARGB2DVertex) == this->vertexStride(positionMatrix));
fill2D(quadData((Quad*)vertexBuffer), color, viewDifference);
} else { using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(positionMatrix));
fill2D(quadData((Quad*)vertexBuffer), color, viewDifference);
}
} else { if (fMaskType == MaskFormat::kARGB) { using Quad = ARGB3DVertex[4];
SkASSERT(sizeof(ARGB3DVertex) == this->vertexStride(positionMatrix));
fill3D(quadData((Quad*)vertexBuffer), color, viewDifference);
} else { using Quad = Mask3DVertex[4];
SkASSERT(sizeof(Mask3DVertex) == this->vertexStride(positionMatrix));
fill3D(quadData((Quad*)vertexBuffer), color, viewDifference);
}
}
}
using AtlasTextOp = skgpu::ganesh::AtlasTextOp;
AtlasTextOp::MaskType VertexFiller::opMaskType() const { switch (fMaskType) { case MaskFormat::kA8: return AtlasTextOp::MaskType::kGrayscaleCoverage; case MaskFormat::kA565: return AtlasTextOp::MaskType::kLCDCoverage; case MaskFormat::kARGB: return AtlasTextOp::MaskType::kColorBitmap;
}
SkUNREACHABLE;
} #endif// defined(SK_GANESH) || defined(SK_USE_LEGACY_GANESH_TEXT_APIS)
// Return true if the positionMatrix represents an integer translation. Return the device // bounding box of all the glyphs. If the bounding box is empty, then something went singular // and this operation should be dropped.
std::tuple<bool, SkRect> VertexFiller::deviceRectAndCheckTransform( const SkMatrix &positionMatrix) const { if (fCanDrawDirect) { constauto [directDrawCompatible, offset] =
can_use_direct(fCreationMatrix, positionMatrix);
if (directDrawCompatible) { return {true, fCreationBounds.makeOffset(offset)};
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.