Remove SkMakeSpan
Change-Id: I33121076bac3ceca19c81ff9fb47e4b024a14230 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549838 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
de3e1964cf
commit
8ccbeeebc3
@ -82,7 +82,7 @@ static bool FuzzSkRuntimeEffect_Once(sk_sp<SkData> codeBytes,
|
||||
}
|
||||
}
|
||||
|
||||
sk_sp<SkShader> shader = effect->makeShader(uniformBytes, SkMakeSpan(children));
|
||||
sk_sp<SkShader> shader = effect->makeShader(uniformBytes, SkSpan(children));
|
||||
if (!shader) {
|
||||
return false;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
fPositions.append(fGlyphCount);
|
||||
fFont.getPos(fGlyphs.begin(), fGlyphCount, fPositions.begin());
|
||||
auto positions = SkMakeSpan(fPositions.begin(), fGlyphCount);
|
||||
auto positions = SkSpan(fPositions.begin(), fGlyphCount);
|
||||
|
||||
fLength = positions.back().x() - positions.front().x();
|
||||
fRadius = fLength / SK_FloatPI;
|
||||
|
16
gm/mesh.cpp
16
gm/mesh.cpp
@ -57,9 +57,9 @@ protected:
|
||||
}
|
||||
)";
|
||||
auto[spec, error] =
|
||||
SkMeshSpecification::Make(SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkMeshSpecification::Make(SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
sizeof(ColorVertex),
|
||||
SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkString(kVS),
|
||||
SkString(kFS));
|
||||
if (!spec) {
|
||||
@ -87,9 +87,9 @@ protected:
|
||||
}
|
||||
)";
|
||||
auto[spec, error] =
|
||||
SkMeshSpecification::Make(SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkMeshSpecification::Make(SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
sizeof(NoColorVertex),
|
||||
SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkString(kVS),
|
||||
SkString(kFS));
|
||||
if (!spec) {
|
||||
@ -380,9 +380,9 @@ protected:
|
||||
}
|
||||
|
||||
auto [spec, error] = SkMeshSpecification::Make(
|
||||
SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
sizeof(Vertex),
|
||||
SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkString(vs),
|
||||
SkString(kFS),
|
||||
std::move(cs),
|
||||
@ -510,9 +510,9 @@ protected:
|
||||
}
|
||||
)";
|
||||
auto [spec, error] =
|
||||
SkMeshSpecification::Make(SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkMeshSpecification::Make(SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
sizeof(Vertex),
|
||||
SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkString(kVS),
|
||||
SkString(kFS),
|
||||
SkColorSpace::MakeSRGB(),
|
||||
|
@ -414,13 +414,13 @@ public:
|
||||
// Now draw the image with an identity color cube - it should look like the original
|
||||
SkRuntimeEffect::ChildPtr children[] = {fIdentityCube->makeShader(sampling, normalize)};
|
||||
paint.setColorFilter(fEffect->makeColorFilter(
|
||||
SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkMakeSpan(children)));
|
||||
SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkSpan(children)));
|
||||
canvas->drawImage(fMandrill, 256, 0, sampling, &paint);
|
||||
|
||||
// ... and with a sepia-tone color cube. This should match the sepia-toned image.
|
||||
children[0] = fSepiaCube->makeShader(sampling, normalize);
|
||||
paint.setColorFilter(fEffect->makeColorFilter(
|
||||
SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkMakeSpan(children)));
|
||||
SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkSpan(children)));
|
||||
canvas->drawImage(fMandrill, 256, 256, sampling, &paint);
|
||||
}
|
||||
};
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
sk_sp<SkColorSpace> cs,
|
||||
SkAlphaType at);
|
||||
|
||||
SkSpan<const Attribute> attributes() const { return SkMakeSpan(fAttributes); }
|
||||
SkSpan<const Attribute> attributes() const { return SkSpan(fAttributes); }
|
||||
|
||||
/**
|
||||
* Combined size of all 'uniform' variables. When creating a SkMesh with this specification
|
||||
@ -154,7 +154,7 @@ public:
|
||||
* Provides info about individual uniforms including the offset into an SkData where each
|
||||
* uniform value should be placed.
|
||||
*/
|
||||
SkSpan<const Uniform> uniforms() const { return SkMakeSpan(fUniforms); }
|
||||
SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
|
||||
|
||||
/** Returns pointer to the named uniform variable's description, or nullptr if not found. */
|
||||
const Uniform* findUniform(const char* name) const;
|
||||
|
@ -17,11 +17,9 @@
|
||||
|
||||
/**
|
||||
* An SkSpan is a view of a contiguous collection of elements of type T. It can be directly
|
||||
* constructed from a pointer and size. SkMakeSpan can be used to construct one from an array,
|
||||
* constructed from a pointer and size, or it can be used to construct one from an array,
|
||||
* or a container (like std::vector).
|
||||
*
|
||||
* With C++17, we could add template deduction guides that eliminate the need for SkMakeSpan:
|
||||
* https://skia-review.googlesource.com/c/skia/+/320264
|
||||
*/
|
||||
template <typename T>
|
||||
class SkSpan {
|
||||
@ -33,7 +31,7 @@ public:
|
||||
template <typename U, typename = typename std::enable_if<std::is_same<const U, T>::value>::type>
|
||||
constexpr SkSpan(const SkSpan<U>& that) : fPtr(std::data(that)), fSize{std::size(that)} {}
|
||||
constexpr SkSpan(const SkSpan& o) = default;
|
||||
template<size_t N> constexpr SkSpan(T(&a)[N]) : SkSpan{a, N} { }
|
||||
template<size_t N> constexpr SkSpan(T(&a)[N]) : SkSpan(a, N) { }
|
||||
template<typename Container>
|
||||
constexpr SkSpan(Container& c) : SkSpan{std::data(c), std::size(c)} { }
|
||||
SkSpan(std::initializer_list<T> il) : SkSpan(std::data(il), std::size(il)) {}
|
||||
@ -72,32 +70,11 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
|
||||
static const constexpr size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
|
||||
T* fPtr;
|
||||
size_t fSize;
|
||||
};
|
||||
|
||||
template <typename T, typename S> inline constexpr SkSpan<T> SkMakeSpan(T* p, S s) {
|
||||
return SkSpan<T>{p, SkTo<size_t>(s)};
|
||||
}
|
||||
|
||||
template <size_t N, typename T> inline constexpr SkSpan<T> SkMakeSpan(T (&a)[N]) {
|
||||
return SkSpan<T>(a, N);
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
inline auto SkMakeSpan(Container& c) ->
|
||||
SkSpan<std::remove_pointer_t<decltype(std::data(std::declval<Container&>()))>> {
|
||||
return {std::data(c), std::size(c)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline auto SkMakeSpan(std::initializer_list<T> il) ->
|
||||
SkSpan<std::remove_pointer_t<decltype(std::data(std::declval<std::initializer_list<T>>()))>>
|
||||
{
|
||||
return {std::data(il), std::size(il)};
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
SkSpan(Container&) ->
|
||||
SkSpan<std::remove_pointer_t<decltype(std::data(std::declval<Container&>()))>>;
|
||||
|
@ -245,8 +245,8 @@ public:
|
||||
// provide an SkData of this size, containing values for all of those variables.
|
||||
size_t uniformSize() const;
|
||||
|
||||
SkSpan<const Uniform> uniforms() const { return SkMakeSpan(fUniforms); }
|
||||
SkSpan<const Child> children() const { return SkMakeSpan(fChildren); }
|
||||
SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
|
||||
SkSpan<const Child> children() const { return SkSpan(fChildren); }
|
||||
|
||||
// Returns pointer to the named uniform variable's description, or nullptr if not found
|
||||
const Uniform* findUniform(const char* name) const;
|
||||
|
@ -160,13 +160,13 @@ public:
|
||||
template<typename... Args>
|
||||
static DSLExpression Construct(DSLType type, DSLVarBase& var, Args&&... args) {
|
||||
DSLExpression argArray[] = {var, args...};
|
||||
return Construct(type, SkMakeSpan(argArray));
|
||||
return Construct(type, SkSpan(argArray));
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
static DSLExpression Construct(DSLType type, DSLExpression expr, Args&&... args) {
|
||||
DSLExpression argArray[] = {std::move(expr), std::move(args)...};
|
||||
return Construct(type, SkMakeSpan(argArray));
|
||||
return Construct(type, SkSpan(argArray));
|
||||
}
|
||||
|
||||
static DSLExpression Construct(DSLType type, SkSpan<DSLExpression> argArray);
|
||||
@ -260,7 +260,7 @@ DSLType Struct(std::string_view name, SkSpan<DSLField> fields,
|
||||
template<typename... Field>
|
||||
DSLType Struct(std::string_view name, Field... fields) {
|
||||
DSLField fieldTypes[] = {std::move(fields)...};
|
||||
return Struct(name, SkMakeSpan(fieldTypes), Position());
|
||||
return Struct(name, SkSpan(fieldTypes), Position());
|
||||
}
|
||||
|
||||
} // namespace dsl
|
||||
|
@ -186,7 +186,7 @@ void SkParticleEffectParams::prepare(const skresources::ResourceProvider* resour
|
||||
uniformIDs.push_back(b.uniform32(skslUniformPtr, i * sizeof(int)).id);
|
||||
}
|
||||
if (!SkSL::ProgramToSkVM(*program, *fn, &b, /*debugTrace=*/nullptr,
|
||||
SkMakeSpan(uniformIDs))) {
|
||||
SkSpan(uniformIDs))) {
|
||||
return skvm::Program{};
|
||||
}
|
||||
return b.done();
|
||||
|
@ -1375,7 +1375,7 @@ ShapedRun ShaperHarfBuzz::shape(char const * const utf8,
|
||||
}
|
||||
|
||||
SkSTArray<32, hb_feature_t> hbFeatures;
|
||||
for (const auto& feature : SkMakeSpan(features, featuresSize)) {
|
||||
for (const auto& feature : SkSpan(features, featuresSize)) {
|
||||
if (feature.end < SkTo<size_t>(utf8Start - utf8) ||
|
||||
SkTo<size_t>(utf8End - utf8) <= feature.start)
|
||||
{
|
||||
|
@ -204,10 +204,10 @@ public:
|
||||
Type type() const { return fType; }
|
||||
const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; }
|
||||
SkSpan<const SkString> vars() const {
|
||||
return fVars ? SkMakeSpan<const Vars>(fVars->fData) : SkSpan<const SkString>{nullptr, 0};
|
||||
return fVars ? SkSpan<const SkString>(fVars->fData) : SkSpan<const SkString>{nullptr, 0};
|
||||
}
|
||||
SkSpan< SkString> vars() {
|
||||
return fVars ? SkMakeSpan< Vars>(fVars->fData) : SkSpan< SkString>{nullptr, 0};
|
||||
return fVars ? SkSpan<SkString>(fVars->fData) : SkSpan< SkString>{nullptr, 0};
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -2408,10 +2408,10 @@ void SkCanvas::drawGlyphs(int count, const SkGlyphID* glyphs, const SkPoint* pos
|
||||
|
||||
SkGlyphRun glyphRun {
|
||||
font,
|
||||
SkMakeSpan(positions, count),
|
||||
SkMakeSpan(glyphs, count),
|
||||
SkMakeSpan(utf8text, textByteCount),
|
||||
SkMakeSpan(clusters, count),
|
||||
SkSpan(positions, count),
|
||||
SkSpan(glyphs, count),
|
||||
SkSpan(utf8text, textByteCount),
|
||||
SkSpan(clusters, count),
|
||||
SkSpan<SkVector>()
|
||||
};
|
||||
SkGlyphRunList glyphRunList = fScratchGlyphRunBuilder->makeGlyphRunList(
|
||||
@ -2425,8 +2425,8 @@ void SkCanvas::drawGlyphs(int count, const SkGlyphID glyphs[], const SkPoint pos
|
||||
|
||||
SkGlyphRun glyphRun {
|
||||
font,
|
||||
SkMakeSpan(positions, count),
|
||||
SkMakeSpan(glyphs, count),
|
||||
SkSpan(positions, count),
|
||||
SkSpan(glyphs, count),
|
||||
SkSpan<const char>(),
|
||||
SkSpan<const uint32_t>(),
|
||||
SkSpan<SkVector>()
|
||||
@ -2441,12 +2441,12 @@ void SkCanvas::drawGlyphs(int count, const SkGlyphID glyphs[], const SkRSXform x
|
||||
if (count <= 0) { return; }
|
||||
|
||||
auto [positions, rotateScales] =
|
||||
fScratchGlyphRunBuilder->convertRSXForm(SkMakeSpan(xforms, count));
|
||||
fScratchGlyphRunBuilder->convertRSXForm(SkSpan(xforms, count));
|
||||
|
||||
SkGlyphRun glyphRun {
|
||||
font,
|
||||
positions,
|
||||
SkMakeSpan(glyphs, count),
|
||||
SkSpan(glyphs, count),
|
||||
SkSpan<const char>(),
|
||||
SkSpan<const uint32_t>(),
|
||||
rotateScales
|
||||
|
@ -171,7 +171,7 @@ SkScalar SkFont::measureText(const void* text, size_t length, SkTextEncoding enc
|
||||
|
||||
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this, paint);
|
||||
SkBulkGlyphMetrics metrics{strikeSpec};
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, glyphCount));
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, glyphCount));
|
||||
|
||||
SkScalar width = 0;
|
||||
if (bounds) {
|
||||
@ -209,7 +209,7 @@ void SkFont::getWidthsBounds(const SkGlyphID glyphIDs[],
|
||||
const SkPaint* paint) const {
|
||||
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this, paint);
|
||||
SkBulkGlyphMetrics metrics{strikeSpec};
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count));
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, count));
|
||||
|
||||
if (bounds) {
|
||||
SkMatrix scaleMat = SkMatrix::Scale(strikeToSourceScale, strikeToSourceScale);
|
||||
@ -230,7 +230,7 @@ void SkFont::getWidthsBounds(const SkGlyphID glyphIDs[],
|
||||
void SkFont::getPos(const SkGlyphID glyphIDs[], int count, SkPoint pos[], SkPoint origin) const {
|
||||
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this);
|
||||
SkBulkGlyphMetrics metrics{strikeSpec};
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count));
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, count));
|
||||
|
||||
SkPoint sum = origin;
|
||||
for (auto glyph : glyphs) {
|
||||
@ -244,7 +244,7 @@ void SkFont::getXPos(
|
||||
|
||||
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this);
|
||||
SkBulkGlyphMetrics metrics{strikeSpec};
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count));
|
||||
SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, count));
|
||||
|
||||
SkScalar loc = origin;
|
||||
SkScalar* cursor = xpos;
|
||||
@ -262,7 +262,7 @@ void SkFont::getPaths(const SkGlyphID glyphIDs[], int count,
|
||||
|
||||
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeWithNoDevice(font);
|
||||
SkBulkGlyphMetricsAndPaths paths{strikeSpec};
|
||||
SkSpan<const SkGlyph*> glyphs = paths.glyphs(SkMakeSpan(glyphIDs, count));
|
||||
SkSpan<const SkGlyph*> glyphs = paths.glyphs(SkSpan(glyphIDs, count));
|
||||
|
||||
for (auto glyph : glyphs) {
|
||||
proc(glyph->path(), mx, ctx);
|
||||
|
@ -192,7 +192,7 @@ static SkSpan<const SkPoint> draw_text_positions(
|
||||
*positionCursor++ = endOfLastGlyph;
|
||||
endOfLastGlyph += glyph->advanceVector();
|
||||
}
|
||||
return SkMakeSpan(buffer, glyphIDs.size());
|
||||
return SkSpan(buffer, glyphIDs.size());
|
||||
}
|
||||
|
||||
const SkGlyphRunList& SkGlyphRunBuilder::textToGlyphRunList(
|
||||
@ -242,20 +242,20 @@ const SkGlyphRunList& SkGlyphRunBuilder::blobToGlyphRunList(
|
||||
break;
|
||||
}
|
||||
case SkTextBlobRunIterator::kHorizontal_Positioning: {
|
||||
positions = SkMakeSpan(positionCursor, runSize);
|
||||
positions = SkSpan(positionCursor, runSize);
|
||||
for (auto x : SkSpan<const SkScalar>{it.pos(), glyphIDs.size()}) {
|
||||
*positionCursor++ = SkPoint::Make(x, it.offset().y());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SkTextBlobRunIterator::kFull_Positioning: {
|
||||
positions = SkMakeSpan(it.points(), runSize);
|
||||
positions = SkSpan(it.points(), runSize);
|
||||
break;
|
||||
}
|
||||
case SkTextBlobRunIterator::kRSXform_Positioning: {
|
||||
positions = SkMakeSpan(positionCursor, runSize);
|
||||
scaledRotations = SkMakeSpan(scaledRotationsCursor, runSize);
|
||||
for (const SkRSXform& xform : SkMakeSpan(it.xforms(), runSize)) {
|
||||
positions = SkSpan(positionCursor, runSize);
|
||||
scaledRotations = SkSpan(scaledRotationsCursor, runSize);
|
||||
for (const SkRSXform& xform : SkSpan(it.xforms(), runSize)) {
|
||||
*positionCursor++ = {xform.fTx, xform.fTy};
|
||||
*scaledRotationsCursor++ = {xform.fSCos, xform.fSSin};
|
||||
}
|
||||
@ -279,8 +279,8 @@ std::tuple<SkSpan<const SkPoint>, SkSpan<const SkVector>>
|
||||
SkGlyphRunBuilder::convertRSXForm(SkSpan<const SkRSXform> xforms) {
|
||||
const int count = SkCount(xforms);
|
||||
this->prepareBuffers(count, count);
|
||||
auto positions = SkMakeSpan(fPositions.get(), count);
|
||||
auto scaledRotations = SkMakeSpan(fScaledRotations.get(), count);
|
||||
auto positions = SkSpan(fPositions.get(), count);
|
||||
auto scaledRotations = SkSpan(fScaledRotations.get(), count);
|
||||
for (auto [pos, sr, xform] : SkMakeZip(positions, scaledRotations, xforms)) {
|
||||
auto [scos, ssin, tx, ty] = xform;
|
||||
pos = {tx, ty};
|
||||
@ -325,7 +325,7 @@ SkSpan<const SkGlyphID> SkGlyphRunBuilder::textToGlyphIDs(
|
||||
if (count > 0) {
|
||||
fScratchGlyphIDs.resize(count);
|
||||
font.textToGlyphs(bytes, byteLength, encoding, fScratchGlyphIDs.data(), count);
|
||||
return SkMakeSpan(fScratchGlyphIDs);
|
||||
return SkSpan(fScratchGlyphIDs);
|
||||
} else {
|
||||
return SkSpan<const SkGlyphID>();
|
||||
}
|
||||
@ -356,7 +356,7 @@ void SkGlyphRunBuilder::makeGlyphRun(
|
||||
|
||||
const SkGlyphRunList& SkGlyphRunBuilder::setGlyphRunList(
|
||||
const SkTextBlob* blob, const SkRect& bounds, SkPoint origin) {
|
||||
fGlyphRunList.emplace(blob, bounds, origin, SkMakeSpan(fGlyphRunListStorage), this);
|
||||
fGlyphRunList.emplace(blob, bounds, origin, SkSpan(fGlyphRunListStorage), this);
|
||||
return fGlyphRunList.value();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ struct SkMeshSpecificationPriv {
|
||||
using ColorType = SkMeshSpecification::ColorType;
|
||||
|
||||
static SkSpan<const Varying> Varyings(const SkMeshSpecification& spec) {
|
||||
return SkMakeSpan(spec.fVaryings);
|
||||
return SkSpan(spec.fVaryings);
|
||||
}
|
||||
|
||||
static const SkSL::Program* VS(const SkMeshSpecification& spec) { return spec.fVS.get(); }
|
||||
|
@ -182,7 +182,7 @@ SkPaintParamsKey SkPaintParamsKeyBuilder::lockAsKey() {
|
||||
fIsValid = true;
|
||||
fStack.rewind();
|
||||
|
||||
return SkPaintParamsKey(SkMakeSpan(fData.begin(), fData.count()), this);
|
||||
return SkPaintParamsKey(SkSpan(fData.begin(), fData.count()), this);
|
||||
}
|
||||
|
||||
void SkPaintParamsKeyBuilder::makeInvalid() {
|
||||
|
@ -776,7 +776,7 @@ std::unique_ptr<SkFilterColorProgram> SkFilterColorProgram::Make(const SkRuntime
|
||||
effect->fMain,
|
||||
&p,
|
||||
/*debugTrace=*/nullptr,
|
||||
SkMakeSpan(uniform),
|
||||
SkSpan(uniform),
|
||||
/*device=*/zeroCoord,
|
||||
/*local=*/zeroCoord,
|
||||
inputColor,
|
||||
@ -892,7 +892,7 @@ static GrFPResult make_effect_fp(sk_sp<SkRuntimeEffect> effect,
|
||||
std::move(inputFP),
|
||||
std::move(destColorFP),
|
||||
std::move(uniforms),
|
||||
SkMakeSpan(childFPs));
|
||||
SkSpan(childFPs));
|
||||
SkASSERT(fp);
|
||||
return GrFPSuccess(std::move(fp));
|
||||
}
|
||||
@ -990,7 +990,7 @@ public:
|
||||
std::move(uniforms),
|
||||
std::move(inputFP),
|
||||
/*destColorFP=*/nullptr,
|
||||
SkMakeSpan(fChildren),
|
||||
SkSpan(fChildren),
|
||||
childArgs);
|
||||
}
|
||||
#endif
|
||||
@ -1016,7 +1016,7 @@ public:
|
||||
// something. (Uninitialized values can trigger asserts in skvm::Builder).
|
||||
skvm::Coord zeroCoord = { p->splat(0.0f), p->splat(0.0f) };
|
||||
return SkSL::ProgramToSkVM(*fEffect->fBaseProgram, fEffect->fMain, p,/*debugTrace=*/nullptr,
|
||||
SkMakeSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
|
||||
SkSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
|
||||
c, c, &callbacks);
|
||||
}
|
||||
|
||||
@ -1096,7 +1096,7 @@ sk_sp<SkFlattenable> SkRuntimeColorFilter::CreateProc(SkReadBuffer& buffer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
return effect->makeColorFilter(std::move(uniforms), SkMakeSpan(children));
|
||||
return effect->makeColorFilter(std::move(uniforms), SkSpan(children));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1118,7 +1118,7 @@ public:
|
||||
sk_sp<SkRuntimeEffect> unoptimized = fEffect->makeUnoptimizedClone();
|
||||
sk_sp<SkSL::SkVMDebugTrace> debugTrace = make_skvm_debug_trace(unoptimized.get(), coord);
|
||||
auto debugShader = sk_make_sp<SkRTShader>(unoptimized, debugTrace, fUniforms,
|
||||
&this->getLocalMatrix(), SkMakeSpan(fChildren));
|
||||
&this->getLocalMatrix(), SkSpan(fChildren));
|
||||
|
||||
return SkRuntimeEffect::TracedShader{std::move(debugShader), std::move(debugTrace)};
|
||||
}
|
||||
@ -1143,7 +1143,7 @@ public:
|
||||
std::move(uniforms),
|
||||
/*inputFP=*/nullptr,
|
||||
/*destColorFP=*/nullptr,
|
||||
SkMakeSpan(fChildren),
|
||||
SkSpan(fChildren),
|
||||
args);
|
||||
if (!success) {
|
||||
return nullptr;
|
||||
@ -1186,7 +1186,7 @@ public:
|
||||
*inputs);
|
||||
|
||||
return SkSL::ProgramToSkVM(*fEffect->fBaseProgram, fEffect->fMain, p, fDebugTrace.get(),
|
||||
SkMakeSpan(uniform), device, local, paint, paint, &callbacks);
|
||||
SkSpan(uniform), device, local, paint, paint, &callbacks);
|
||||
}
|
||||
|
||||
void flatten(SkWriteBuffer& buffer) const override {
|
||||
@ -1260,7 +1260,7 @@ sk_sp<SkFlattenable> SkRTShader::CreateProc(SkReadBuffer& buffer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
return effect->makeShader(std::move(uniforms), SkMakeSpan(children), localMPtr);
|
||||
return effect->makeShader(std::move(uniforms), SkSpan(children), localMPtr);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1291,7 +1291,7 @@ public:
|
||||
// Emit the blend function as an SkVM program.
|
||||
skvm::Coord zeroCoord = {p->splat(0.0f), p->splat(0.0f)};
|
||||
return SkSL::ProgramToSkVM(*fEffect->fBaseProgram, fEffect->fMain, p,/*debugTrace=*/nullptr,
|
||||
SkMakeSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
|
||||
SkSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
|
||||
src, dst, &callbacks);
|
||||
}
|
||||
|
||||
@ -1310,7 +1310,7 @@ public:
|
||||
std::move(uniforms),
|
||||
std::move(srcFP),
|
||||
std::move(dstFP),
|
||||
SkMakeSpan(fChildren),
|
||||
SkSpan(fChildren),
|
||||
args);
|
||||
|
||||
return success ? std::move(fp) : nullptr;
|
||||
@ -1357,7 +1357,7 @@ sk_sp<SkFlattenable> SkRuntimeBlender::CreateProc(SkReadBuffer& buffer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
return effect->makeBlender(std::move(uniforms), SkMakeSpan(children));
|
||||
return effect->makeBlender(std::move(uniforms), SkSpan(children));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1370,7 +1370,7 @@ sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<const SkData> uniforms,
|
||||
for (size_t i = 0; i < childCount; ++i) {
|
||||
children.emplace_back(childShaders[i]);
|
||||
}
|
||||
return this->makeShader(std::move(uniforms), SkMakeSpan(children), localMatrix);
|
||||
return this->makeShader(std::move(uniforms), SkSpan(children), localMatrix);
|
||||
}
|
||||
|
||||
sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<const SkData> uniforms,
|
||||
@ -1433,7 +1433,7 @@ sk_sp<SkImage> SkRuntimeEffect::makeImage(GrRecordingContext* rContext,
|
||||
/*inputFP=*/nullptr,
|
||||
/*destColorFP=*/nullptr,
|
||||
std::move(uniforms),
|
||||
SkMakeSpan(childFPs));
|
||||
SkSpan(childFPs));
|
||||
|
||||
if (localMatrix) {
|
||||
SkMatrix invLM;
|
||||
@ -1484,7 +1484,7 @@ sk_sp<SkColorFilter> SkRuntimeEffect::makeColorFilter(sk_sp<const SkData> unifor
|
||||
for (size_t i = 0; i < childCount; ++i) {
|
||||
children.emplace_back(childColorFilters[i]);
|
||||
}
|
||||
return this->makeColorFilter(std::move(uniforms), SkMakeSpan(children));
|
||||
return this->makeColorFilter(std::move(uniforms), SkSpan(children));
|
||||
}
|
||||
|
||||
sk_sp<SkColorFilter> SkRuntimeEffect::makeColorFilter(sk_sp<const SkData> uniforms,
|
||||
@ -1593,7 +1593,7 @@ sk_sp<SkImage> SkRuntimeShaderBuilder::makeImage(GrRecordingContext* recordingCo
|
||||
bool mipmapped) {
|
||||
return this->effect()->makeImage(recordingContext,
|
||||
this->uniforms(),
|
||||
SkMakeSpan(this->children(), this->numChildren()),
|
||||
SkSpan(this->children(), this->numChildren()),
|
||||
localMatrix,
|
||||
resultInfo,
|
||||
mipmapped);
|
||||
@ -1601,7 +1601,7 @@ sk_sp<SkImage> SkRuntimeShaderBuilder::makeImage(GrRecordingContext* recordingCo
|
||||
|
||||
sk_sp<SkShader> SkRuntimeShaderBuilder::makeShader(const SkMatrix* localMatrix) {
|
||||
return this->effect()->makeShader(
|
||||
this->uniforms(), SkMakeSpan(this->children(), this->numChildren()), localMatrix);
|
||||
this->uniforms(), SkSpan(this->children(), this->numChildren()), localMatrix);
|
||||
}
|
||||
|
||||
SkRuntimeBlendBuilder::SkRuntimeBlendBuilder(sk_sp<SkRuntimeEffect> effect)
|
||||
@ -1611,7 +1611,7 @@ SkRuntimeBlendBuilder::~SkRuntimeBlendBuilder() = default;
|
||||
|
||||
sk_sp<SkBlender> SkRuntimeBlendBuilder::makeBlender() {
|
||||
return this->effect()->makeBlender(this->uniforms(),
|
||||
SkMakeSpan(this->children(), this->numChildren()));
|
||||
SkSpan(this->children(), this->numChildren()));
|
||||
}
|
||||
|
||||
#endif // SK_ENABLE_SKSL
|
||||
|
@ -197,7 +197,7 @@ SkShaderCodeDictionary::Entry* SkShaderCodeDictionary::makeEntry(
|
||||
uint8_t* newKeyData = fArena.makeArray<uint8_t>(key.sizeInBytes());
|
||||
memcpy(newKeyData, key.data(), key.sizeInBytes());
|
||||
|
||||
SkSpan<const uint8_t> newKeyAsSpan = SkMakeSpan(newKeyData, key.sizeInBytes());
|
||||
SkSpan<const uint8_t> newKeyAsSpan = SkSpan(newKeyData, key.sizeInBytes());
|
||||
#ifdef SK_GRAPHITE_ENABLED
|
||||
return fArena.make([&](void *ptr) { return new(ptr) Entry(newKeyAsSpan, blendInfo); });
|
||||
#else
|
||||
@ -714,7 +714,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kSolidColorShader] = {
|
||||
"SolidColor",
|
||||
SkMakeSpan(kSolidShaderUniforms),
|
||||
SkSpan(kSolidShaderUniforms),
|
||||
SnippetRequirementFlags::kNone,
|
||||
{ }, // no samplers
|
||||
kSolidShaderName,
|
||||
@ -725,7 +725,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kLinearGradientShader4] = {
|
||||
"LinearGradient4",
|
||||
SkMakeSpan(kLinearGradientUniforms4),
|
||||
SkSpan(kLinearGradientUniforms4),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kLinearGradient4Name,
|
||||
@ -736,7 +736,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kLinearGradientShader8] = {
|
||||
"LinearGradient8",
|
||||
SkMakeSpan(kLinearGradientUniforms8),
|
||||
SkSpan(kLinearGradientUniforms8),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kLinearGradient8Name,
|
||||
@ -747,7 +747,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kRadialGradientShader4] = {
|
||||
"RadialGradient4",
|
||||
SkMakeSpan(kRadialGradientUniforms4),
|
||||
SkSpan(kRadialGradientUniforms4),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kRadialGradient4Name,
|
||||
@ -758,7 +758,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kRadialGradientShader8] = {
|
||||
"RadialGradient8",
|
||||
SkMakeSpan(kRadialGradientUniforms8),
|
||||
SkSpan(kRadialGradientUniforms8),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kRadialGradient8Name,
|
||||
@ -769,7 +769,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kSweepGradientShader4] = {
|
||||
"SweepGradient4",
|
||||
SkMakeSpan(kSweepGradientUniforms4),
|
||||
SkSpan(kSweepGradientUniforms4),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kSweepGradient4Name,
|
||||
@ -780,7 +780,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kSweepGradientShader8] = {
|
||||
"SweepGradient8",
|
||||
SkMakeSpan(kSweepGradientUniforms8),
|
||||
SkSpan(kSweepGradientUniforms8),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kSweepGradient8Name,
|
||||
@ -791,7 +791,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kConicalGradientShader4] = {
|
||||
"ConicalGradient4",
|
||||
SkMakeSpan(kConicalGradientUniforms4),
|
||||
SkSpan(kConicalGradientUniforms4),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kConicalGradient4Name,
|
||||
@ -802,7 +802,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kConicalGradientShader8] = {
|
||||
"ConicalGradient8",
|
||||
SkMakeSpan(kConicalGradientUniforms8),
|
||||
SkSpan(kConicalGradientUniforms8),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kConicalGradient8Name,
|
||||
@ -813,7 +813,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kLocalMatrixShader] = {
|
||||
"LocalMatrixShader",
|
||||
SkMakeSpan(kLocalMatrixShaderUniforms),
|
||||
SkSpan(kLocalMatrixShaderUniforms),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kLocalMatrixShaderName,
|
||||
@ -824,9 +824,9 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kImageShader] = {
|
||||
"ImageShader",
|
||||
SkMakeSpan(kImageShaderUniforms),
|
||||
SkSpan(kImageShaderUniforms),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
SkMakeSpan(kISTexturesAndSamplers, kNumImageShaderTexturesAndSamplers),
|
||||
SkSpan(kISTexturesAndSamplers, kNumImageShaderTexturesAndSamplers),
|
||||
kImageShaderName,
|
||||
GenerateImageShaderGlueCode,
|
||||
kNoChildren,
|
||||
@ -835,7 +835,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kBlendShader] = {
|
||||
"BlendShader",
|
||||
SkMakeSpan(kBlendShaderUniforms),
|
||||
SkSpan(kBlendShaderUniforms),
|
||||
SnippetRequirementFlags::kNone,
|
||||
{ }, // no samplers
|
||||
kBlendShaderName,
|
||||
@ -846,14 +846,14 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kRuntimeShader] = {
|
||||
"RuntimeShader",
|
||||
SkMakeSpan(kRuntimeShaderUniforms),
|
||||
SkSpan(kRuntimeShaderUniforms),
|
||||
SnippetRequirementFlags::kLocalCoords,
|
||||
{ }, // no samplers
|
||||
kRuntimeShaderName,
|
||||
GenerateDefaultGlueCode,
|
||||
kNoChildren,
|
||||
kNoPointers,
|
||||
SkMakeSpan(kRuntimeShaderDataPayload)
|
||||
SkSpan(kRuntimeShaderDataPayload)
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kFixedFunctionBlender] = {
|
||||
"FixedFunctionBlender",
|
||||
@ -868,7 +868,7 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
|
||||
};
|
||||
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kShaderBasedBlender] = {
|
||||
"ShaderBasedBlender",
|
||||
SkMakeSpan(kShaderBasedBlenderUniforms),
|
||||
SkSpan(kShaderBasedBlenderUniforms),
|
||||
SnippetRequirementFlags::kNone,
|
||||
{ }, // no samplers
|
||||
kBlendHelperName,
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
constexpr Iterator begin() const { return Iterator{this, 0}; }
|
||||
constexpr Iterator end() const { return Iterator{this, this->size()}; }
|
||||
template<size_t I> constexpr auto get() const {
|
||||
return SkMakeSpan(std::get<I>(fPointers), fSize);
|
||||
return SkSpan(std::get<I>(fPointers), fSize);
|
||||
}
|
||||
constexpr std::tuple<Ts*...> data() const { return fPointers; }
|
||||
constexpr SkZip first(size_t n) const {
|
||||
|
@ -74,27 +74,27 @@ ReducedBlendModeInfo GetReducedBlendModeInfo(SkBlendMode mode) {
|
||||
static constexpr float kLighten[] = {-1};
|
||||
|
||||
switch (mode) {
|
||||
case SkBlendMode::kSrcOver: return {"blend_porter_duff", SkMakeSpan(kSrcOver)};
|
||||
case SkBlendMode::kDstOver: return {"blend_porter_duff", SkMakeSpan(kDstOver)};
|
||||
case SkBlendMode::kSrcIn: return {"blend_porter_duff", SkMakeSpan(kSrcIn)};
|
||||
case SkBlendMode::kDstIn: return {"blend_porter_duff", SkMakeSpan(kDstIn)};
|
||||
case SkBlendMode::kSrcOut: return {"blend_porter_duff", SkMakeSpan(kSrcOut)};
|
||||
case SkBlendMode::kDstOut: return {"blend_porter_duff", SkMakeSpan(kDstOut)};
|
||||
case SkBlendMode::kSrcATop: return {"blend_porter_duff", SkMakeSpan(kSrcATop)};
|
||||
case SkBlendMode::kDstATop: return {"blend_porter_duff", SkMakeSpan(kDstATop)};
|
||||
case SkBlendMode::kXor: return {"blend_porter_duff", SkMakeSpan(kXor)};
|
||||
case SkBlendMode::kPlus: return {"blend_porter_duff", SkMakeSpan(kPlus)};
|
||||
case SkBlendMode::kSrcOver: return {"blend_porter_duff", SkSpan(kSrcOver)};
|
||||
case SkBlendMode::kDstOver: return {"blend_porter_duff", SkSpan(kDstOver)};
|
||||
case SkBlendMode::kSrcIn: return {"blend_porter_duff", SkSpan(kSrcIn)};
|
||||
case SkBlendMode::kDstIn: return {"blend_porter_duff", SkSpan(kDstIn)};
|
||||
case SkBlendMode::kSrcOut: return {"blend_porter_duff", SkSpan(kSrcOut)};
|
||||
case SkBlendMode::kDstOut: return {"blend_porter_duff", SkSpan(kDstOut)};
|
||||
case SkBlendMode::kSrcATop: return {"blend_porter_duff", SkSpan(kSrcATop)};
|
||||
case SkBlendMode::kDstATop: return {"blend_porter_duff", SkSpan(kDstATop)};
|
||||
case SkBlendMode::kXor: return {"blend_porter_duff", SkSpan(kXor)};
|
||||
case SkBlendMode::kPlus: return {"blend_porter_duff", SkSpan(kPlus)};
|
||||
|
||||
case SkBlendMode::kHue: return {"blend_hslc", SkMakeSpan(kHue)};
|
||||
case SkBlendMode::kSaturation: return {"blend_hslc", SkMakeSpan(kSaturation)};
|
||||
case SkBlendMode::kColor: return {"blend_hslc", SkMakeSpan(kColor)};
|
||||
case SkBlendMode::kLuminosity: return {"blend_hslc", SkMakeSpan(kLuminosity)};
|
||||
case SkBlendMode::kHue: return {"blend_hslc", SkSpan(kHue)};
|
||||
case SkBlendMode::kSaturation: return {"blend_hslc", SkSpan(kSaturation)};
|
||||
case SkBlendMode::kColor: return {"blend_hslc", SkSpan(kColor)};
|
||||
case SkBlendMode::kLuminosity: return {"blend_hslc", SkSpan(kLuminosity)};
|
||||
|
||||
case SkBlendMode::kOverlay: return {"blend_overlay", SkMakeSpan(kOverlay)};
|
||||
case SkBlendMode::kHardLight: return {"blend_overlay", SkMakeSpan(kHardLight)};
|
||||
case SkBlendMode::kOverlay: return {"blend_overlay", SkSpan(kOverlay)};
|
||||
case SkBlendMode::kHardLight: return {"blend_overlay", SkSpan(kHardLight)};
|
||||
|
||||
case SkBlendMode::kDarken: return {"blend_darken", SkMakeSpan(kDarken)};
|
||||
case SkBlendMode::kLighten: return {"blend_darken", SkMakeSpan(kLighten)};
|
||||
case SkBlendMode::kDarken: return {"blend_darken", SkSpan(kDarken)};
|
||||
case SkBlendMode::kLighten: return {"blend_darken", SkSpan(kLighten)};
|
||||
|
||||
default: return {BlendFuncName(mode), {}};
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ static void reorder_array_by_llist(const SkTInternalLList<T>& llist, SkTArray<sk
|
||||
bool GrDrawingManager::reorderTasks(GrResourceAllocator* resourceAllocator) {
|
||||
SkASSERT(fReduceOpsTaskSplitting);
|
||||
SkTInternalLList<GrRenderTask> llist;
|
||||
bool clustered = GrClusterRenderTasks(SkMakeSpan(fDAG), &llist);
|
||||
bool clustered = GrClusterRenderTasks(SkSpan(fDAG), &llist);
|
||||
if (!clustered) {
|
||||
return false;
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ public:
|
||||
*/
|
||||
void addDependenciesFromOtherTask(GrRenderTask* otherTask);
|
||||
|
||||
SkSpan<GrRenderTask*> dependencies() { return SkMakeSpan(fDependencies); }
|
||||
SkSpan<GrRenderTask*> dependents() { return SkMakeSpan(fDependents); }
|
||||
SkSpan<GrRenderTask*> dependencies() { return SkSpan(fDependencies); }
|
||||
SkSpan<GrRenderTask*> dependents() { return SkSpan(fDependents); }
|
||||
|
||||
void replaceDependency(const GrRenderTask* toReplace, GrRenderTask* replaceWith);
|
||||
void replaceDependent(const GrRenderTask* toReplace, GrRenderTask* replaceWith);
|
||||
|
@ -252,8 +252,8 @@ private:
|
||||
const GrFragmentProcessor& _proc) override {
|
||||
const GrSkSLFP& outer = _proc.cast<GrSkSLFP>();
|
||||
pdman.setRuntimeEffectUniforms(outer.fEffect->uniforms(),
|
||||
SkMakeSpan(fUniformHandles),
|
||||
SkMakeSpan(outer.specialized(), outer.uniformCount()),
|
||||
SkSpan(fUniformHandles),
|
||||
SkSpan(outer.specialized(), outer.uniformCount()),
|
||||
outer.uniformData());
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ void GrGLSLProgramBuilder::writeFPFunction(const GrFragmentProcessor& fp,
|
||||
|
||||
fFS.emitFunction(SkSLType::kHalf4,
|
||||
impl.functionName(),
|
||||
SkMakeSpan(params, numParams),
|
||||
SkSpan(params, numParams),
|
||||
fFS.code().c_str());
|
||||
fFS.deleteStage();
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ static std::unique_ptr<GrFragmentProcessor> make_dual_interval_colorizer(const S
|
||||
vc2 - threshold * scale[1]};
|
||||
return GrSkSLFP::Make(effect, "DualIntervalColorizer", /*inputFP=*/nullptr,
|
||||
GrSkSLFP::OptFlags::kNone,
|
||||
"scale", SkMakeSpan(scale),
|
||||
"bias", SkMakeSpan(bias),
|
||||
"scale", SkSpan(scale),
|
||||
"bias", SkSpan(bias),
|
||||
"threshold", threshold);
|
||||
}
|
||||
|
||||
@ -235,8 +235,8 @@ static std::unique_ptr<GrFragmentProcessor> make_unrolled_colorizer(int interval
|
||||
/*inputFP=*/nullptr, GrSkSLFP::OptFlags::kNone,
|
||||
"thresholds1_7", thresholds1_7,
|
||||
"thresholds9_13", thresholds9_13,
|
||||
"scale", SkMakeSpan(scale, intervalCount),
|
||||
"bias", SkMakeSpan(bias, intervalCount));
|
||||
"scale", SkSpan(scale, intervalCount),
|
||||
"bias", SkSpan(bias, intervalCount));
|
||||
}
|
||||
|
||||
// The "looping" colorizer uses a real loop to binary-search the array of gradient stops.
|
||||
@ -325,9 +325,9 @@ static std::unique_ptr<GrFragmentProcessor> make_looping_colorizer(int intervalC
|
||||
|
||||
return GrSkSLFP::Make(cacheEntry->effect, "LoopingBinaryColorizer",
|
||||
/*inputFP=*/nullptr, GrSkSLFP::OptFlags::kNone,
|
||||
"thresholds", SkMakeSpan((const SkV4*)thresholds, intervalChunks),
|
||||
"scale", SkMakeSpan(scale, intervalCount),
|
||||
"bias", SkMakeSpan(bias, intervalCount));
|
||||
"thresholds", SkSpan((const SkV4*)thresholds, intervalChunks),
|
||||
"scale", SkSpan(scale, intervalCount),
|
||||
"bias", SkSpan(bias, intervalCount));
|
||||
}
|
||||
|
||||
// Converts an input array of {colors, positions} into an array of {scales, biases, thresholds}.
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
}
|
||||
if (mgp.fUniforms) {
|
||||
pdman.setRuntimeEffectUniforms(mgp.fSpec->uniforms(),
|
||||
SkMakeSpan(fSpecUniformHandles),
|
||||
SkSpan(fSpecUniformHandles),
|
||||
mgp.fUniforms->data());
|
||||
}
|
||||
}
|
||||
@ -682,9 +682,9 @@ static sk_sp<SkMeshSpecification> make_vertices_spec(bool hasColors, bool hasTex
|
||||
vs += "return a.pos;\n}";
|
||||
fs += "}";
|
||||
auto [spec, error] = SkMeshSpecification::Make(
|
||||
SkMakeSpan(attributes),
|
||||
SkSpan(attributes),
|
||||
size,
|
||||
SkMakeSpan(varyings),
|
||||
SkSpan(varyings),
|
||||
vs,
|
||||
fs);
|
||||
SkASSERT(spec);
|
||||
|
@ -30,7 +30,7 @@ class GraphicsPipelineDesc {
|
||||
public:
|
||||
GraphicsPipelineDesc();
|
||||
|
||||
SkSpan<const uint32_t> asKey() const { return SkMakeSpan(fKey.data(), fKey.size()); }
|
||||
SkSpan<const uint32_t> asKey() const { return SkSpan(fKey.data(), fKey.size()); }
|
||||
|
||||
bool operator==(const GraphicsPipelineDesc& that) const {
|
||||
return this->fKey == that.fKey;
|
||||
|
@ -95,9 +95,9 @@ public:
|
||||
|
||||
// The uniforms of a RenderStep are bound to the kRenderStep slot, the rest of the pipeline
|
||||
// may still use uniforms bound to other slots.
|
||||
SkSpan<const SkUniform> uniforms() const { return SkMakeSpan(fUniforms); }
|
||||
SkSpan<const Attribute> vertexAttributes() const { return SkMakeSpan(fVertexAttrs); }
|
||||
SkSpan<const Attribute> instanceAttributes() const { return SkMakeSpan(fInstanceAttrs); }
|
||||
SkSpan<const SkUniform> uniforms() const { return SkSpan(fUniforms); }
|
||||
SkSpan<const Attribute> vertexAttributes() const { return SkSpan(fVertexAttrs); }
|
||||
SkSpan<const Attribute> instanceAttributes() const { return SkSpan(fInstanceAttrs); }
|
||||
|
||||
|
||||
// TODO: Actual API to do things
|
||||
|
@ -509,7 +509,7 @@ UniformManager::UniformManager(Layout layout) : fLayout(layout) {
|
||||
}
|
||||
|
||||
SkUniformDataBlock UniformManager::peekData() const {
|
||||
return SkUniformDataBlock(SkMakeSpan(fStorage.begin(), fStorage.count()));
|
||||
return SkUniformDataBlock(SkSpan(fStorage.begin(), fStorage.count()));
|
||||
}
|
||||
|
||||
void UniformManager::reset() {
|
||||
|
@ -783,7 +783,7 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrDirectContext* dContex
|
||||
surfaceContext.writePixels(dContext, pixmap, {0, 0});
|
||||
|
||||
GrSurfaceProxy* p[1] = {surfaceContext.asSurfaceProxy()};
|
||||
drawingManager->flush(SkMakeSpan(p), SkSurface::BackendSurfaceAccess::kNoAccess, {}, nullptr);
|
||||
drawingManager->flush(p, SkSurface::BackendSurfaceAccess::kNoAccess, {}, nullptr);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ static void gradient_function_code(const SkShader::GradientInfo& info,
|
||||
}
|
||||
|
||||
// If a cap on depth is needed, loop here.
|
||||
write_gradient_ranges(info, SkMakeSpan(rangeEnds.get(), rangeEndsCount), true, true, result);
|
||||
write_gradient_ranges(info, SkSpan(rangeEnds.get(), rangeEndsCount), true, true, result);
|
||||
|
||||
// Clamp the final color.
|
||||
result->writeText("0 gt {");
|
||||
|
@ -111,7 +111,7 @@ std::unique_ptr<SkPDFArray> SkPDFMakeCIDGlyphWidthsArray(const SkTypeface& typef
|
||||
subset.getSetValues([&](unsigned index) {
|
||||
glyphIDs.push_back(SkToU16(index));
|
||||
});
|
||||
auto glyphs = paths.glyphs(SkMakeSpan(glyphIDs));
|
||||
auto glyphs = paths.glyphs(SkSpan(glyphIDs));
|
||||
|
||||
#if defined(SK_PDF_CAN_USE_DW)
|
||||
std::vector<int16_t> advances;
|
||||
@ -120,7 +120,7 @@ std::unique_ptr<SkPDFArray> SkPDFMakeCIDGlyphWidthsArray(const SkTypeface& typef
|
||||
advances.push_back((int16_t)glyph->advanceX());
|
||||
}
|
||||
std::sort(advances.begin(), advances.end());
|
||||
int16_t modeAdvance = findMode(SkMakeSpan(advances));
|
||||
int16_t modeAdvance = findMode(SkSpan(advances));
|
||||
*defaultAdvance = scale_from_font_units(modeAdvance, emSize);
|
||||
#else
|
||||
*defaultAdvance = 0;
|
||||
|
@ -310,7 +310,7 @@ void SkPDFEmitType1Font(const SkPDFFont& pdfFont, SkPDFDocument* doc) {
|
||||
}
|
||||
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePDFVector(*typeface, &emSize);
|
||||
SkBulkGlyphMetrics metrics{strikeSpec};
|
||||
auto glyphs = metrics.glyphs(SkMakeSpan(glyphIDs.get(), glyphRangeSize));
|
||||
auto glyphs = metrics.glyphs(SkSpan(glyphIDs.get(), glyphRangeSize));
|
||||
for (int i = 0; i < glyphRangeSize; ++i) {
|
||||
widths->appendScalar(from_font_units(glyphs[i]->advanceX(), SkToU16(emSize)));
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ DSLType DSLParser::structDeclaration() {
|
||||
this->error(this->rangeFrom(start), "struct '" + std::string(this->text(name)) +
|
||||
"' must contain at least one field");
|
||||
}
|
||||
return dsl::Struct(this->text(name), SkMakeSpan(fields), this->rangeFrom(start));
|
||||
return dsl::Struct(this->text(name), SkSpan(fields), this->rangeFrom(start));
|
||||
}
|
||||
|
||||
/* structDeclaration ((IDENTIFIER varDeclarationEnd) | SEMICOLON) */
|
||||
|
@ -761,7 +761,7 @@ SpvId SPIRVCodeGenerator::writeOpCompositeConstruct(const Type& type,
|
||||
// If this is a vector composed entirely of literals, write a constant-composite instead.
|
||||
if (type.isVector()) {
|
||||
SkSTArray<4, SpvId> constants;
|
||||
if (this->toConstants(SkMakeSpan(values), &constants)) {
|
||||
if (this->toConstants(SkSpan(values), &constants)) {
|
||||
// Create a vector from literals.
|
||||
return this->writeOpConstantComposite(type, constants);
|
||||
}
|
||||
@ -770,7 +770,7 @@ SpvId SPIRVCodeGenerator::writeOpCompositeConstruct(const Type& type,
|
||||
// If this is a matrix composed entirely of literals, constant-composite them instead.
|
||||
if (type.isMatrix()) {
|
||||
SkSTArray<16, SpvId> constants;
|
||||
if (this->toConstants(SkMakeSpan(values), &constants)) {
|
||||
if (this->toConstants(SkSpan(values), &constants)) {
|
||||
// Create each matrix column.
|
||||
SkASSERT(type.isMatrix());
|
||||
const Type& vecType = type.componentType().toCompound(fContext,
|
||||
|
@ -155,7 +155,7 @@ struct Value {
|
||||
return fVals[i];
|
||||
}
|
||||
|
||||
SkSpan<skvm::Val> asSpan() { return SkMakeSpan(fVals); }
|
||||
SkSpan<skvm::Val> asSpan() { return SkSpan(fVals); }
|
||||
|
||||
private:
|
||||
SkSTArray<4, skvm::Val, true> fVals;
|
||||
@ -1599,7 +1599,7 @@ Value SkVMGenerator::writeFunctionCall(const FunctionCall& call) {
|
||||
// This merges currentFunction().fReturned into fConditionMask. Lanes that conditionally
|
||||
// returned in the current function would otherwise resume execution within the child.
|
||||
ScopedCondition m(this, ~currentFunction().fReturned);
|
||||
returnSlot = this->writeFunction(call, funcDef, SkMakeSpan(argVals));
|
||||
returnSlot = this->writeFunction(call, funcDef, SkSpan(argVals));
|
||||
}
|
||||
|
||||
// Propagate new values of any 'out' params back to the original arguments
|
||||
@ -2153,7 +2153,7 @@ skvm::Color ProgramToSkVM(const Program& program,
|
||||
}
|
||||
|
||||
SkVMGenerator generator(program, builder, debugTrace, callbacks);
|
||||
generator.writeProgram(uniforms, device, function, {args, argSlots}, SkMakeSpan(result));
|
||||
generator.writeProgram(uniforms, device, function, {args, argSlots}, SkSpan(result));
|
||||
|
||||
return skvm::Color{{builder, result[0]},
|
||||
{builder, result[1]},
|
||||
@ -2232,7 +2232,7 @@ bool ProgramToSkVM(const Program& program,
|
||||
Callbacks callbacks(sampledColor);
|
||||
|
||||
SkVMGenerator generator(program, b, debugTrace, &callbacks);
|
||||
generator.writeProgram(uniforms, device, function, SkMakeSpan(argVals), SkMakeSpan(returnVals));
|
||||
generator.writeProgram(uniforms, device, function, SkSpan(argVals), SkSpan(returnVals));
|
||||
|
||||
// If the SkSL tried to use any shader, colorFilter, or blender objects - we don't have a
|
||||
// mechanism (yet) for binding to those.
|
||||
@ -2396,7 +2396,7 @@ bool testingOnly_ProgramToSkVMShader(const Program& program,
|
||||
skvm::Color destColor = builder->uniformColor(SkColors::kBlack, &uniforms);
|
||||
|
||||
skvm::Color result = SkSL::ProgramToSkVM(program, *main, builder, debugTrace,
|
||||
SkMakeSpan(uniformVals), device, local, inColor,
|
||||
SkSpan(uniformVals), device, local, inColor,
|
||||
destColor, &callbacks);
|
||||
|
||||
storeF(builder->varying<float>(), result.r);
|
||||
|
@ -335,11 +335,11 @@ static bool find_existing_declaration(const Context& context,
|
||||
const FunctionDeclaration* declPtr;
|
||||
switch (entry->kind()) {
|
||||
case Symbol::Kind::kUnresolvedFunction:
|
||||
functions = SkMakeSpan(entry->as<UnresolvedFunction>().functions());
|
||||
functions = SkSpan(entry->as<UnresolvedFunction>().functions());
|
||||
break;
|
||||
case Symbol::Kind::kFunctionDeclaration:
|
||||
declPtr = &entry->as<FunctionDeclaration>();
|
||||
functions = SkMakeSpan(&declPtr, 1);
|
||||
functions = SkSpan(&declPtr, 1);
|
||||
break;
|
||||
default:
|
||||
errors.error(pos, "symbol '" + std::string(name) + "' was already defined");
|
||||
|
@ -22,10 +22,10 @@ static SkSpan<const FunctionDeclaration* const> get_overload_set(
|
||||
switch (s.kind()) {
|
||||
case Symbol::Kind::kFunctionDeclaration:
|
||||
scratchPtr = &s.as<FunctionDeclaration>();
|
||||
return SkMakeSpan(&scratchPtr, 1);
|
||||
return SkSpan(&scratchPtr, 1);
|
||||
|
||||
case Symbol::Kind::kUnresolvedFunction:
|
||||
return SkMakeSpan(s.as<UnresolvedFunction>().functions());
|
||||
return SkSpan(s.as<UnresolvedFunction>().functions());
|
||||
|
||||
default:
|
||||
return SkSpan<const FunctionDeclaration* const>{};
|
||||
|
@ -112,13 +112,13 @@ static bool eliminate_dead_local_variables(const Context& context,
|
||||
bool Transform::EliminateDeadLocalVariables(const Context& context,
|
||||
LoadedModule& module,
|
||||
ProgramUsage* usage) {
|
||||
return eliminate_dead_local_variables(context, SkMakeSpan(module.fElements), usage);
|
||||
return eliminate_dead_local_variables(context, SkSpan(module.fElements), usage);
|
||||
}
|
||||
|
||||
bool Transform::EliminateDeadLocalVariables(Program& program, ProgramUsage* usage) {
|
||||
return program.fConfig->fSettings.fRemoveDeadVariables
|
||||
? eliminate_dead_local_variables(*program.fContext,
|
||||
SkMakeSpan(program.fOwnedElements),
|
||||
SkSpan(program.fOwnedElements),
|
||||
usage)
|
||||
: false;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static void eliminate_empty_statements(SkSpan<std::unique_ptr<ProgramElement>> e
|
||||
}
|
||||
|
||||
void Transform::EliminateEmptyStatements(LoadedModule& module) {
|
||||
return eliminate_empty_statements(SkMakeSpan(module.fElements));
|
||||
return eliminate_empty_statements(SkSpan(module.fElements));
|
||||
}
|
||||
|
||||
} // namespace SkSL
|
||||
|
@ -146,11 +146,11 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
|
||||
}
|
||||
|
||||
void Transform::EliminateUnreachableCode(LoadedModule& module, ProgramUsage* usage) {
|
||||
return eliminate_unreachable_code(SkMakeSpan(module.fElements), usage);
|
||||
return eliminate_unreachable_code(SkSpan(module.fElements), usage);
|
||||
}
|
||||
|
||||
void Transform::EliminateUnreachableCode(Program& program, ProgramUsage* usage) {
|
||||
return eliminate_unreachable_code(SkMakeSpan(program.fOwnedElements), usage);
|
||||
return eliminate_unreachable_code(SkSpan(program.fOwnedElements), usage);
|
||||
}
|
||||
|
||||
} // namespace SkSL
|
||||
|
@ -32,7 +32,7 @@ GlyphVector GlyphVector::Make(
|
||||
variants[i] = gv.glyph()->getPackedID();
|
||||
}
|
||||
|
||||
return GlyphVector{std::move(strike), SkMakeSpan(variants, glyphs.size())};
|
||||
return GlyphVector{std::move(strike), SkSpan(variants, glyphs.size())};
|
||||
}
|
||||
|
||||
std::optional<GlyphVector> GlyphVector::MakeFromBuffer(SkReadBuffer& buffer,
|
||||
@ -64,7 +64,7 @@ std::optional<GlyphVector> GlyphVector::MakeFromBuffer(SkReadBuffer& buffer,
|
||||
for (int i = 0; i < glyphCount; i++) {
|
||||
variants[i].packedGlyphID = SkPackedGlyphID(buffer.readUInt());
|
||||
}
|
||||
return {GlyphVector{std::move(strike), SkMakeSpan(variants, glyphCount)}};
|
||||
return {GlyphVector{std::move(strike), SkSpan(variants, glyphCount)}};
|
||||
}
|
||||
|
||||
void GlyphVector::flatten(SkWriteBuffer& buffer) {
|
||||
@ -82,7 +82,7 @@ void GlyphVector::flatten(SkWriteBuffer& buffer) {
|
||||
}
|
||||
|
||||
SkSpan<const Glyph*> GlyphVector::glyphs() const {
|
||||
return SkMakeSpan(reinterpret_cast<const Glyph**>(fGlyphs.data()), fGlyphs.size());
|
||||
return SkSpan(reinterpret_cast<const Glyph**>(fGlyphs.data()), fGlyphs.size());
|
||||
}
|
||||
|
||||
// packedGlyphIDToGlyph must be run in single-threaded mode.
|
||||
|
@ -525,7 +525,7 @@ std::optional<PathOpSubmitter> PathOpSubmitter::MakeFromBuffer(SkReadBuffer& buf
|
||||
auto paths = alloc->makeUniqueArray<SkPath>(glyphCount);
|
||||
SkBulkGlyphMetricsAndPaths pathGetter{std::move(strike)};
|
||||
|
||||
for (auto [i, glyphID] : SkMakeEnumerate(SkMakeSpan(glyphIDs, glyphCount))) {
|
||||
for (auto [i, glyphID] : SkMakeEnumerate(SkSpan(glyphIDs, glyphCount))) {
|
||||
const SkPath* path = pathGetter.glyph(glyphID)->path();
|
||||
// There should never be missing paths in a sub run.
|
||||
if (path == nullptr) { return {}; }
|
||||
@ -535,8 +535,8 @@ std::optional<PathOpSubmitter> PathOpSubmitter::MakeFromBuffer(SkReadBuffer& buf
|
||||
SkASSERT(buffer.isValid());
|
||||
return {PathOpSubmitter{isAntiAlias,
|
||||
strikeToSourceScale,
|
||||
SkMakeSpan(positions, glyphCount),
|
||||
SkMakeSpan(glyphIDs, glyphCount),
|
||||
SkSpan(positions, glyphCount),
|
||||
SkSpan(glyphIDs, glyphCount),
|
||||
std::move(paths),
|
||||
*descriptor->getDesc()}};
|
||||
}
|
||||
@ -575,8 +575,8 @@ PathOpSubmitter PathOpSubmitter::Make(const SkZip<SkGlyphVariant, SkPoint>& acce
|
||||
|
||||
return PathOpSubmitter{isAntiAliased,
|
||||
strikeToSourceScale,
|
||||
SkMakeSpan(positions, glyphCount),
|
||||
SkMakeSpan(glyphIDs, glyphCount),
|
||||
SkSpan(positions, glyphCount),
|
||||
SkSpan(glyphIDs, glyphCount),
|
||||
std::move(paths),
|
||||
descriptor};
|
||||
}
|
||||
@ -793,7 +793,7 @@ std::optional<DrawableOpSubmitter> DrawableOpSubmitter::MakeFromBuffer(
|
||||
|
||||
auto drawables = alloc->makePODArray<SkDrawable*>(glyphCount);
|
||||
SkBulkGlyphMetricsAndDrawables drawableGetter(sk_sp<SkStrike>{strike});
|
||||
auto glyphs = drawableGetter.glyphs(SkMakeSpan(glyphIDs, glyphCount));
|
||||
auto glyphs = drawableGetter.glyphs(SkSpan(glyphIDs, glyphCount));
|
||||
|
||||
for (auto [i, glyph] : SkMakeEnumerate(glyphs)) {
|
||||
drawables[i] = glyph->drawable();
|
||||
@ -801,9 +801,9 @@ std::optional<DrawableOpSubmitter> DrawableOpSubmitter::MakeFromBuffer(
|
||||
|
||||
SkASSERT(buffer.isValid());
|
||||
return {DrawableOpSubmitter{strikeToSourceScale,
|
||||
SkMakeSpan(positions, glyphCount),
|
||||
SkMakeSpan(glyphIDs, glyphCount),
|
||||
SkMakeSpan(drawables, glyphCount),
|
||||
SkSpan(positions, glyphCount),
|
||||
SkSpan(glyphIDs, glyphCount),
|
||||
SkSpan(drawables, glyphCount),
|
||||
std::move(strike),
|
||||
*descriptor->getDesc()}};
|
||||
}
|
||||
@ -840,9 +840,9 @@ DrawableOpSubmitter DrawableOpSubmitter::Make(const SkZip<SkGlyphVariant, SkPoin
|
||||
}
|
||||
|
||||
return DrawableOpSubmitter{strikeToSourceScale,
|
||||
SkMakeSpan(positions, glyphCount),
|
||||
SkMakeSpan(glyphIDs, glyphCount),
|
||||
SkMakeSpan(drawables, glyphCount),
|
||||
SkSpan(positions, glyphCount),
|
||||
SkSpan(glyphIDs, glyphCount),
|
||||
SkSpan(drawables, glyphCount),
|
||||
std::move(strike),
|
||||
descriptor};
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ void SkShaperJSONWriter::commitRunBuffer(const SkShaper::RunHandler::RunInfo& in
|
||||
} else {
|
||||
VisualizeClusters(fUTF8.c_str(),
|
||||
info.utf8Range.begin(), info.utf8Range.end(),
|
||||
SkMakeSpan(fGlyphs),
|
||||
SkMakeSpan(fClusters),
|
||||
SkSpan(fGlyphs),
|
||||
SkSpan(fClusters),
|
||||
[this](size_t codePointCount, SkSpan<const char> utf1to1,
|
||||
SkSpan<const SkGlyphID> glyph1to1) {
|
||||
this->displayMToN(codePointCount, utf1to1, glyph1to1);
|
||||
|
@ -46,7 +46,7 @@ DEF_TEST(GlyphVector_Serialization, r) {
|
||||
}
|
||||
|
||||
GlyphVector src = GlyphVector::Make(
|
||||
strikeSpec.findOrCreateStrike(), SkMakeSpan(glyphs, N), &alloc);
|
||||
strikeSpec.findOrCreateStrike(), SkSpan(glyphs, N), &alloc);
|
||||
|
||||
SkBinaryWriteBuffer wBuffer;
|
||||
src.flatten(wBuffer);
|
||||
|
@ -135,9 +135,9 @@ static const Varying kValidVaryings[] = {
|
||||
static void test_good(skiatest::Reporter* r) {
|
||||
for (const auto& validFS : kValidFSes) {
|
||||
if (!check_for_success(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
validFS)) {
|
||||
return;
|
||||
@ -184,9 +184,9 @@ static void test_bad_sig(skiatest::Reporter* r) {
|
||||
invalidVS.appendf("%s %s", vsSig, kVSBody);
|
||||
for (const auto& validFS : kValidFSes) {
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
invalidVS,
|
||||
validFS)) {
|
||||
return;
|
||||
@ -198,9 +198,9 @@ static void test_bad_sig(skiatest::Reporter* r) {
|
||||
SkString invalidFS;
|
||||
invalidFS.appendf("%s %s", noColorFSSig, kNoColorFSBody);
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
invalidFS)) {
|
||||
return;
|
||||
@ -211,9 +211,9 @@ static void test_bad_sig(skiatest::Reporter* r) {
|
||||
SkString invalidFS;
|
||||
invalidFS.appendf("%s %s", colorFSSig, kColorFSBody);
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
invalidFS)) {
|
||||
return;
|
||||
@ -231,9 +231,9 @@ static void test_float4_color(skiatest::Reporter* r) {
|
||||
)"
|
||||
};
|
||||
check_for_success(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kFloat4FS);
|
||||
}
|
||||
@ -247,9 +247,9 @@ static void test_bad_globals(skiatest::Reporter* r) {
|
||||
SkString badVS = kValidVS;
|
||||
badVS.prepend(global);
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
badVS,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -259,9 +259,9 @@ static void test_bad_globals(skiatest::Reporter* r) {
|
||||
SkString badFS = kValidFSes[0];
|
||||
badFS.prepend(global);
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
badFS)) {
|
||||
return;
|
||||
@ -433,8 +433,8 @@ static void test_good_uniforms(skiatest::Reporter* r) {
|
||||
}
|
||||
fs.prepend(unis);
|
||||
|
||||
auto attrs = SkMakeSpan(kValidAttrs , SK_ARRAY_COUNT(kValidAttrs) );
|
||||
auto varys = SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings));
|
||||
auto attrs = SkSpan(kValidAttrs , SK_ARRAY_COUNT(kValidAttrs) );
|
||||
auto varys = SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings));
|
||||
sk_sp<SkMeshSpecification> spec;
|
||||
if (!check_for_success(r, attrs, kValidStride, varys, vs, fs, &spec)) {
|
||||
return;
|
||||
@ -524,8 +524,8 @@ static void test_bad_uniforms(skiatest::Reporter* r) {
|
||||
SkString fs = kValidFSes[0];
|
||||
fs.prepend(u2);
|
||||
|
||||
auto attrs = SkMakeSpan(kValidAttrs , SK_ARRAY_COUNT(kValidAttrs) );
|
||||
auto varys = SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings));
|
||||
auto attrs = SkSpan(kValidAttrs , SK_ARRAY_COUNT(kValidAttrs) );
|
||||
auto varys = SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings));
|
||||
if (!check_for_failure(r, attrs, kValidStride, varys, vs, fs)) {
|
||||
return;
|
||||
}
|
||||
@ -538,9 +538,9 @@ static void test_no_main(skiatest::Reporter* r) {
|
||||
|
||||
// Empty VS
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkString{},
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -548,9 +548,9 @@ static void test_no_main(skiatest::Reporter* r) {
|
||||
|
||||
// VS with helper function but no main
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kHelper,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -558,9 +558,9 @@ static void test_no_main(skiatest::Reporter* r) {
|
||||
|
||||
// Empty FS
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
SkString{})) {
|
||||
return;
|
||||
@ -568,9 +568,9 @@ static void test_no_main(skiatest::Reporter* r) {
|
||||
|
||||
// VS with helper function but no main
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kHelper)) {
|
||||
return;
|
||||
@ -582,7 +582,7 @@ static void test_zero_attrs(skiatest::Reporter* r) {
|
||||
check_for_failure(r,
|
||||
SkSpan<Attribute>(),
|
||||
kValidStride,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -590,7 +590,7 @@ static void test_zero_attrs(skiatest::Reporter* r) {
|
||||
static void test_zero_varyings(skiatest::Reporter* r) {
|
||||
// Varyings are not required.
|
||||
check_for_success(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkSpan<Varying>(),
|
||||
kValidVS,
|
||||
@ -600,9 +600,9 @@ static void test_zero_varyings(skiatest::Reporter* r) {
|
||||
static void test_bad_strides(skiatest::Reporter* r) {
|
||||
// Zero stride
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
0,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -610,9 +610,9 @@ static void test_bad_strides(skiatest::Reporter* r) {
|
||||
|
||||
// Unaligned
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride + 1,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -620,9 +620,9 @@ static void test_bad_strides(skiatest::Reporter* r) {
|
||||
|
||||
// Too large
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
1 << 20,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -635,9 +635,9 @@ static void test_bad_offsets(skiatest::Reporter* r) {
|
||||
{Attribute::Type::kFloat4, 1, SkString{"var"}},
|
||||
};
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
32,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -649,9 +649,9 @@ static void test_bad_offsets(skiatest::Reporter* r) {
|
||||
{Attribute::Type::kFloat2, 16, SkString{"var"}},
|
||||
};
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
20,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -662,9 +662,9 @@ static void test_bad_offsets(skiatest::Reporter* r) {
|
||||
{Attribute::Type::kFloat, std::numeric_limits<size_t>::max() - 3, SkString{"var"}},
|
||||
};
|
||||
if (!check_for_failure(r,
|
||||
SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
4,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0])) {
|
||||
return;
|
||||
@ -680,9 +680,9 @@ static void test_too_many_attrs(skiatest::Reporter* r) {
|
||||
attrs.push_back({Attribute::Type::kFloat4, 0, SkStringPrintf("attr%zu", i)});
|
||||
}
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(attrs),
|
||||
SkSpan(attrs),
|
||||
4*4,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -695,9 +695,9 @@ static void test_too_many_varyings(skiatest::Reporter* r) {
|
||||
varyings.push_back({Varying::Type::kFloat4, SkStringPrintf("varying%zu", i)});
|
||||
}
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(varyings),
|
||||
SkSpan(varyings),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -708,9 +708,9 @@ static void test_duplicate_attribute_names(skiatest::Reporter* r) {
|
||||
{Attribute::Type::kFloat2, 16, SkString{"var"}}
|
||||
};
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
24,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -721,9 +721,9 @@ static void test_duplicate_varying_names(skiatest::Reporter* r) {
|
||||
{Varying::Type::kFloat3, SkString{"var"}}
|
||||
};
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -735,9 +735,9 @@ static void test_sneaky_attribute_name(skiatest::Reporter* r) {
|
||||
{Attribute::Type::kFloat4, 0, SkString{kSneakyName}},
|
||||
};
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
16,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -747,9 +747,9 @@ static void test_sneaky_varying_name(skiatest::Reporter* r) {
|
||||
{Varying::Type::kFloat4, SkString{kSneakyName}},
|
||||
};
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -759,9 +759,9 @@ static void test_empty_attribute_name(skiatest::Reporter* r) {
|
||||
{Attribute::Type::kFloat4, 0, SkString{}},
|
||||
};
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
SkSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
|
||||
16,
|
||||
SkMakeSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
SkSpan(kValidVaryings, SK_ARRAY_COUNT(kValidVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
@ -771,9 +771,9 @@ static void test_empty_varying_name(skiatest::Reporter* r) {
|
||||
{Varying::Type::kFloat4, SkString{}},
|
||||
};
|
||||
check_for_failure(r,
|
||||
SkMakeSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
SkSpan(kValidAttrs, SK_ARRAY_COUNT(kValidAttrs)),
|
||||
kValidStride,
|
||||
SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
SkSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
|
||||
kValidVS,
|
||||
kValidFSes[0]);
|
||||
}
|
||||
|
@ -1199,7 +1199,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrSkSLFP_UniformArray, r, ctxInfo) {
|
||||
// Render our shader into the fill-context with our various input colors.
|
||||
testCtx->fillWithFP(GrSkSLFP::Make(effect, "test_fp", /*inputFP=*/nullptr,
|
||||
GrSkSLFP::OptFlags::kNone,
|
||||
"color", SkMakeSpan(colorArray)));
|
||||
"color", SkSpan(colorArray)));
|
||||
// Read our color back and ensure it matches.
|
||||
GrColor actual;
|
||||
GrPixmap pixmap(info, &actual, sizeof(GrColor));
|
||||
|
@ -556,7 +556,7 @@ DEF_TEST(SkSLInterpreterCompound, r) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
uniforms[i] = b.uniform32(uniformPtr, i * sizeof(int)).id;
|
||||
}
|
||||
SkSL::ProgramToSkVM(*program, *fn, &b, /*debugTrace=*/nullptr, SkMakeSpan(uniforms));
|
||||
SkSL::ProgramToSkVM(*program, *fn, &b, /*debugTrace=*/nullptr, SkSpan(uniforms));
|
||||
return b.done();
|
||||
};
|
||||
|
||||
|
@ -130,7 +130,7 @@ static SkBitmap bitmap_from_shader(skiatest::Reporter* r,
|
||||
5, 6, 7, 8,
|
||||
9, 10, 11, 12,
|
||||
13, 14, 15, 16});
|
||||
set_uniform_array(&builder, "testArray", SkMakeSpan(kArray));
|
||||
set_uniform_array(&builder, "testArray", SkSpan(kArray));
|
||||
|
||||
sk_sp<SkShader> shader = builder.makeShader();
|
||||
if (!shader) {
|
||||
|
@ -65,7 +65,7 @@ DEF_TEST(SkShaperTest_cluster, reporter) {
|
||||
};
|
||||
|
||||
SkShaperJSONWriter::BreakupClusters(
|
||||
0, oneCase.utf8Len, SkMakeSpan(oneCase.clusters), checker);
|
||||
0, oneCase.utf8Len, SkSpan(oneCase.clusters), checker);
|
||||
REPORTER_ASSERT(reporter, answerCount == oneCase.answers.size());
|
||||
}
|
||||
}
|
||||
@ -114,8 +114,8 @@ DEF_TEST(SkShaperTest_VisualizeCluster, reporter) {
|
||||
|
||||
SkShaperJSONWriter::VisualizeClusters(oneCase.utf8.c_str(),
|
||||
0, oneCase.utf8.size(),
|
||||
SkMakeSpan(oneCase.glyphIDs),
|
||||
SkMakeSpan(oneCase.clusters),
|
||||
SkSpan(oneCase.glyphIDs),
|
||||
SkSpan(oneCase.clusters),
|
||||
checker);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <vector>
|
||||
|
||||
DEF_TEST(SkSpanBasicTemplateGuide, reporter) {
|
||||
// Test constness preservation for SkMakeSpan.
|
||||
// Test constness preservation for SkSpan.
|
||||
{
|
||||
std::vector<int> v = {{1, 2, 3, 4, 5}};
|
||||
auto s = SkSpan(v);
|
||||
@ -70,61 +70,6 @@ DEF_TEST(SkSpanBasicTemplateGuide, reporter) {
|
||||
}
|
||||
}
|
||||
|
||||
DEF_TEST(SkSpanBasicMakeSpan, reporter) {
|
||||
// Test constness preservation for SkMakeSpan.
|
||||
{
|
||||
std::vector<int> v = {{1, 2, 3, 4, 5}};
|
||||
auto s = SkMakeSpan(v);
|
||||
REPORTER_ASSERT(reporter, s[3] == 4);
|
||||
s[3] = 100;
|
||||
REPORTER_ASSERT(reporter, s[3] == 100);
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> t = {{1, 2, 3, 4, 5}};
|
||||
const std::vector<int>& v = t;
|
||||
auto s = SkMakeSpan(v);
|
||||
//s[3] = 100; // Should fail to compile
|
||||
REPORTER_ASSERT(reporter, s[3] == 4);
|
||||
REPORTER_ASSERT(reporter, t[3] == 4);
|
||||
t[3] = 100;
|
||||
REPORTER_ASSERT(reporter, s[3] == 100);
|
||||
}
|
||||
|
||||
{
|
||||
std::array<int, 5> v = {{1, 2, 3, 4, 5}};
|
||||
auto s = SkMakeSpan(v); // {1, 2, 3, 4, 5}
|
||||
REPORTER_ASSERT(reporter, s[3] == 4);
|
||||
s[3] = 100; // {1, 2, 3, 100, 5}
|
||||
REPORTER_ASSERT(reporter, s[3] == 100);
|
||||
auto s1 = s.subspan(1,3); // {2, 3, 100}
|
||||
REPORTER_ASSERT(reporter, s1.size() == 3);
|
||||
REPORTER_ASSERT(reporter, s1.front() == 2);
|
||||
REPORTER_ASSERT(reporter, s1.back() == 100);
|
||||
auto s2 = s.subspan(2); // {3, 100, 5}
|
||||
REPORTER_ASSERT(reporter, s2.size() == 3);
|
||||
REPORTER_ASSERT(reporter, s2.front() == 3);
|
||||
REPORTER_ASSERT(reporter, s2.back() == 5);
|
||||
}
|
||||
|
||||
{
|
||||
std::array<int, 5> t = {{1, 2, 3, 4, 5}};
|
||||
const std::array<int, 5>& v = t;
|
||||
auto s = SkMakeSpan(v);
|
||||
//s[3] = 100; // Should fail to compile
|
||||
REPORTER_ASSERT(reporter, s[3] == 4);
|
||||
REPORTER_ASSERT(reporter, t[3] == 4);
|
||||
t[3] = 100;
|
||||
REPORTER_ASSERT(reporter, s[3] == 100);
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> v;
|
||||
auto s = SkMakeSpan(v);
|
||||
REPORTER_ASSERT(reporter, s.empty());
|
||||
}
|
||||
}
|
||||
|
||||
static bool test_span_parameter(SkSpan<const int> s) {
|
||||
return s[0] == 1 && s[1] == 2 && s[2] == 3;
|
||||
}
|
||||
|
@ -206,14 +206,14 @@ DEF_TEST(SkEnumerate, reporter) {
|
||||
REPORTER_ASSERT(reporter, check == 4);
|
||||
|
||||
check = 0;
|
||||
for (auto [i, v] : SkMakeEnumerate(SkMakeSpan(vec))) {
|
||||
for (auto [i, v] : SkMakeEnumerate(SkSpan(vec))) {
|
||||
REPORTER_ASSERT(reporter, i == check);
|
||||
REPORTER_ASSERT(reporter, v == (int)check+1);
|
||||
check++;
|
||||
}
|
||||
|
||||
{
|
||||
auto e = SkMakeEnumerate(SkMakeSpan(vec)).first(2);
|
||||
auto e = SkMakeEnumerate(SkSpan(vec)).first(2);
|
||||
for (auto[i, v] : e) {
|
||||
REPORTER_ASSERT(reporter, v == (int) i + 1);
|
||||
}
|
||||
@ -221,7 +221,7 @@ DEF_TEST(SkEnumerate, reporter) {
|
||||
}
|
||||
|
||||
{
|
||||
auto e = SkMakeEnumerate(SkMakeSpan(vec)).last(2);
|
||||
auto e = SkMakeEnumerate(SkSpan(vec)).last(2);
|
||||
for (auto[i, v] : e) {
|
||||
REPORTER_ASSERT(reporter, v == (int) i + 1);
|
||||
}
|
||||
@ -229,7 +229,7 @@ DEF_TEST(SkEnumerate, reporter) {
|
||||
}
|
||||
|
||||
{
|
||||
auto e = SkMakeEnumerate(SkMakeSpan(vec)).subspan(1, 2);
|
||||
auto e = SkMakeEnumerate(SkSpan(vec)).subspan(1, 2);
|
||||
for (auto[i, v] : e) {
|
||||
REPORTER_ASSERT(reporter, v == (int) i + 1);
|
||||
}
|
||||
@ -246,7 +246,7 @@ DEF_TEST(SkEnumerate, reporter) {
|
||||
};
|
||||
|
||||
I is[10];
|
||||
auto s = SkMakeSpan(is);
|
||||
auto s = SkSpan(is);
|
||||
for (auto [i, v] : SkMakeEnumerate(s)) {
|
||||
new (&v) I(i);
|
||||
}
|
||||
@ -260,12 +260,12 @@ DEF_TEST(SkEnumerate, reporter) {
|
||||
{
|
||||
std::unique_ptr<int> is[10];
|
||||
std::unique_ptr<int> os[10];
|
||||
auto s = SkMakeSpan(is);
|
||||
auto s = SkSpan(is);
|
||||
for (auto [i, v] : SkMakeEnumerate(s)) {
|
||||
v = std::make_unique<int>(i);
|
||||
}
|
||||
|
||||
for (auto [i, v] : SkMakeEnumerate(SkMakeSpan(os))) {
|
||||
for (auto [i, v] : SkMakeEnumerate(SkSpan(os))) {
|
||||
v = std::move(s[i]);
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ DEF_TEST(SkEnumerate, reporter) {
|
||||
{
|
||||
std::unique_ptr<int> is[10];
|
||||
std::unique_ptr<int> os[10];
|
||||
auto s = SkMakeSpan(is);
|
||||
auto s = SkSpan(is);
|
||||
for (auto [i, v] : SkMakeEnumerate(s)) {
|
||||
v = std::make_unique<int>(i);
|
||||
}
|
||||
@ -299,7 +299,7 @@ DEF_TEST(SkZip, reporter) {
|
||||
const float B[] = {10.f, 20.f, 30.f, 40.f};
|
||||
std::vector<int> C = {{20, 30, 40, 50}};
|
||||
std::array<int, 4> D = {{100, 200, 300, 400}};
|
||||
SkSpan<int> S = SkMakeSpan(C);
|
||||
SkSpan<int> S = SkSpan(C);
|
||||
|
||||
// Check SkZip calls
|
||||
SkZip<uint16_t, const float, int, int, int>
|
||||
@ -472,7 +472,7 @@ DEF_TEST(SkMakeZip, reporter) {
|
||||
const float B[] = {10.f, 20.f, 30.f, 40.f};
|
||||
const std::vector<int> C = {{20, 30, 40, 50}};
|
||||
std::array<int, 4> D = {{100, 200, 300, 400}};
|
||||
SkSpan<const int> S = SkMakeSpan(C);
|
||||
SkSpan<const int> S = SkSpan(C);
|
||||
uint16_t* P = &A[0];
|
||||
{
|
||||
// Check make zip
|
||||
|
@ -113,8 +113,7 @@ void big_test(Context *context, skiatest::Reporter* reporter) {
|
||||
|
||||
// only option (imageShader_0)
|
||||
[[maybe_unused]] auto imageShader_0 = blendShader_1.addChildOption(
|
||||
1, SkShaderType::kImage,
|
||||
SkMakeSpan(tilingOptions));
|
||||
1, SkShaderType::kImage, tilingOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
{ "translate", SkSLType::kFloat2 },
|
||||
};
|
||||
|
||||
UniformExpectationsValidator uev(gatherer, SkMakeSpan(kRectUniforms, kNumRectUniforms));
|
||||
UniformExpectationsValidator uev(gatherer, SkSpan(kRectUniforms, kNumRectUniforms));
|
||||
#endif
|
||||
|
||||
// TODO: A << API for uniforms would be nice, particularly if it could take pre-computed
|
||||
@ -150,7 +150,7 @@ public:
|
||||
{ "scale", SkSLType::kFloat2 },
|
||||
{ "translate", SkSLType::kFloat2 },
|
||||
};
|
||||
UniformExpectationsValidator uev(gatherer, SkMakeSpan(kRectUniforms, kNumRectUniforms));
|
||||
UniformExpectationsValidator uev(gatherer, SkSpan(kRectUniforms, kNumRectUniforms));
|
||||
#endif
|
||||
|
||||
gatherer->write(SkPoint::Make(2.0f, 2.0f));
|
||||
|
@ -31,7 +31,7 @@ SkPaintParamsKey create_key_with_data(SkPaintParamsKeyBuilder* builder,
|
||||
SkPaintParamsKey create_key(SkPaintParamsKeyBuilder* builder, int snippetID, int size) {
|
||||
SkASSERT(size <= 1024);
|
||||
static constexpr uint8_t kDummyData[1024] = {};
|
||||
return create_key_with_data(builder, snippetID, SkMakeSpan(kDummyData, size));
|
||||
return create_key_with_data(builder, snippetID, SkSpan(kDummyData, size));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@ -59,7 +59,7 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(KeyValidBlockSizeTest, reporter, context) {
|
||||
{"data", SkPaintParamsKey::DataPayloadType::kByte, kMaxBlockDataSize},
|
||||
};
|
||||
|
||||
int userSnippetID = dict->addUserDefinedSnippet("keyAlmostTooBig", SkMakeSpan(kDataFields));
|
||||
int userSnippetID = dict->addUserDefinedSnippet("keyAlmostTooBig", kDataFields);
|
||||
SkPaintParamsKey key = create_key(&builder, userSnippetID, kMaxBlockDataSize);
|
||||
|
||||
// Key is created successfully.
|
||||
@ -78,7 +78,7 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(KeyTooLargeBlockSizeTest, reporter, context) {
|
||||
{"data", SkPaintParamsKey::DataPayloadType::kByte, kBlockDataSize},
|
||||
};
|
||||
|
||||
int userSnippetID = dict->addUserDefinedSnippet("keyTooBig", SkMakeSpan(kDataFields));
|
||||
int userSnippetID = dict->addUserDefinedSnippet("keyTooBig", kDataFields);
|
||||
SkPaintParamsKey key = create_key(&builder, userSnippetID, kBlockDataSize);
|
||||
|
||||
// Key creation fails.
|
||||
@ -93,8 +93,8 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(KeyEqualityChecksSnippetID, reporter, context) {
|
||||
{"data", SkPaintParamsKey::DataPayloadType::kByte, kBlockDataSize},
|
||||
};
|
||||
|
||||
int userSnippetID1 = dict->addUserDefinedSnippet("key1", SkMakeSpan(kDataFields));
|
||||
int userSnippetID2 = dict->addUserDefinedSnippet("key2", SkMakeSpan(kDataFields));
|
||||
int userSnippetID1 = dict->addUserDefinedSnippet("key1", kDataFields);
|
||||
int userSnippetID2 = dict->addUserDefinedSnippet("key2", kDataFields);
|
||||
|
||||
SkPaintParamsKeyBuilder builderA(dict, SkBackend::kGraphite);
|
||||
SkPaintParamsKeyBuilder builderB(dict, SkBackend::kGraphite);
|
||||
@ -118,7 +118,7 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(KeyEqualityChecksData, reporter, context) {
|
||||
{"data", SkPaintParamsKey::DataPayloadType::kByte, kBlockDataSize},
|
||||
};
|
||||
|
||||
int userSnippetID = dict->addUserDefinedSnippet("key", SkMakeSpan(kDataFields));
|
||||
int userSnippetID = dict->addUserDefinedSnippet("key", kDataFields);
|
||||
|
||||
static constexpr uint8_t kData [kBlockDataSize] = {1, 2, 3, 4};
|
||||
static constexpr uint8_t kData2[kBlockDataSize] = {1, 2, 3, 99};
|
||||
@ -126,9 +126,9 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(KeyEqualityChecksData, reporter, context) {
|
||||
SkPaintParamsKeyBuilder builderA(dict, SkBackend::kGraphite);
|
||||
SkPaintParamsKeyBuilder builderB(dict, SkBackend::kGraphite);
|
||||
SkPaintParamsKeyBuilder builderC(dict, SkBackend::kGraphite);
|
||||
SkPaintParamsKey keyA = create_key_with_data(&builderA, userSnippetID, SkMakeSpan(kData));
|
||||
SkPaintParamsKey keyB = create_key_with_data(&builderB, userSnippetID, SkMakeSpan(kData));
|
||||
SkPaintParamsKey keyC = create_key_with_data(&builderC, userSnippetID, SkMakeSpan(kData2));
|
||||
SkPaintParamsKey keyA = create_key_with_data(&builderA, userSnippetID, kData);
|
||||
SkPaintParamsKey keyB = create_key_with_data(&builderB, userSnippetID, kData);
|
||||
SkPaintParamsKey keyC = create_key_with_data(&builderC, userSnippetID, kData2);
|
||||
|
||||
// Verify that keyA matches keyB, and that it does not match keyC.
|
||||
REPORTER_ASSERT(reporter, keyA == keyB);
|
||||
@ -147,7 +147,7 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(KeyBlockReaderWorks, reporter, context) {
|
||||
{"DataY", SkPaintParamsKey::DataPayloadType::kByte, kBlockDataSizeY},
|
||||
};
|
||||
|
||||
int userSnippetID = dict->addUserDefinedSnippet("key", SkMakeSpan(kDataFields));
|
||||
int userSnippetID = dict->addUserDefinedSnippet("key", kDataFields);
|
||||
|
||||
static constexpr uint8_t kDataX[kBlockDataSizeX] = {1, 2, 3};
|
||||
static constexpr uint8_t kDataY[kBlockDataSizeY] = {4, 5, 6, 7, 8, 9, 10};
|
||||
|
@ -38,7 +38,7 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(PipelineDataCacheTest, reporter, context) {
|
||||
static const char kMemory1[kSize] = {
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
|
||||
};
|
||||
SkUniformDataBlock udb1(SkMakeSpan(kMemory1, kSize));
|
||||
SkUniformDataBlock udb1(SkSpan(kMemory1, kSize));
|
||||
UniformDataCache::Index id1;
|
||||
{
|
||||
id1 = cache->insert(udb1);
|
||||
@ -54,7 +54,7 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(PipelineDataCacheTest, reporter, context) {
|
||||
static const char kMemory2[kSize] = {
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
|
||||
};
|
||||
SkUniformDataBlock udb2(SkMakeSpan(kMemory2, kSize));
|
||||
SkUniformDataBlock udb2(SkSpan(kMemory2, kSize));
|
||||
UniformDataCache::Index id2 = cache->insert(udb2);
|
||||
REPORTER_ASSERT(reporter, id2.isValid());
|
||||
REPORTER_ASSERT(reporter, id2 == id1);
|
||||
@ -70,7 +70,7 @@ DEF_GRAPHITE_TEST_FOR_CONTEXTS(PipelineDataCacheTest, reporter, context) {
|
||||
static const char kMemory3[kSize] = {
|
||||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21
|
||||
};
|
||||
SkUniformDataBlock udb3(SkMakeSpan(kMemory3, kSize));
|
||||
SkUniformDataBlock udb3(SkSpan(kMemory3, kSize));
|
||||
UniformDataCache::Index id3 = cache->insert(udb3);
|
||||
REPORTER_ASSERT(reporter, id3.isValid());
|
||||
REPORTER_ASSERT(reporter, id3 != id1);
|
||||
|
@ -344,7 +344,7 @@ sk_sp<TestSVGTypeface> TestSVGTypeface::Default() {
|
||||
return sk_make_sp<DefaultTypeface>("Emoji",
|
||||
1000,
|
||||
metrics,
|
||||
SkMakeSpan(glyphs),
|
||||
glyphs,
|
||||
SkFontStyle::Normal());
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ sk_sp<TestSVGTypeface> TestSVGTypeface::Planets() {
|
||||
return sk_make_sp<PlanetTypeface>("Planets",
|
||||
200,
|
||||
metrics,
|
||||
SkMakeSpan(glyphs),
|
||||
glyphs,
|
||||
SkFontStyle::Normal());
|
||||
}
|
||||
|
||||
|
@ -403,12 +403,12 @@ int main(int , char * const []) {
|
||||
};
|
||||
|
||||
static constexpr FontFamilyDesc kFamiliesData[] = {
|
||||
{"monospace", "Liberation Mono", "LiberationMono", SkMakeSpan(kMonoFonts)},
|
||||
{"sans-serif", "Liberation Sans", "LiberationSans", SkMakeSpan(kSansFonts)},
|
||||
{"serif", "Liberation Serif", "LiberationSerif", SkMakeSpan(kSerifFonts)},
|
||||
{"monospace", "Liberation Mono", "LiberationMono", kMonoFonts},
|
||||
{"sans-serif", "Liberation Sans", "LiberationSans", kSansFonts},
|
||||
{"serif", "Liberation Serif", "LiberationSerif", kSerifFonts},
|
||||
};
|
||||
|
||||
static constexpr SkSpan<const FontFamilyDesc> kFamilies(SkMakeSpan(kFamiliesData));
|
||||
static constexpr SkSpan<const FontFamilyDesc> kFamilies(kFamiliesData);
|
||||
|
||||
#ifdef SK_BUILD_FOR_UNIX
|
||||
generate_fonts("/usr/share/fonts/truetype/liberation/", kFamilies);
|
||||
|
@ -45,9 +45,9 @@ int main(int argc, char** argv) {
|
||||
// But the planet font cannot get very big in the size limited cbdt format.
|
||||
unsigned small[] = { 8, 16 };
|
||||
|
||||
export_ttx(TestSVGTypeface::Default(), SkString(), SkMakeSpan(usual), SkMakeSpan(usual));
|
||||
export_ttx(TestSVGTypeface::Default(), SkString(), SkSpan(usual), SkSpan(usual));
|
||||
export_ttx(
|
||||
TestSVGTypeface::Planets(), SkString("planet"), SkMakeSpan(small), SkMakeSpan(usual));
|
||||
TestSVGTypeface::Planets(), SkString("planet"), SkSpan(small), SkSpan(usual));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user