From 8ccbeeebc34d80ac9525dfcca122d196bbbb0630 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Tue, 14 Jun 2022 12:09:25 -0400 Subject: [PATCH] Remove SkMakeSpan Change-Id: I33121076bac3ceca19c81ff9fb47e4b024a14230 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549838 Reviewed-by: Brian Osman Reviewed-by: Ben Wagner Commit-Queue: Herb Derby --- fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp | 2 +- gm/drawglyphs.cpp | 2 +- gm/mesh.cpp | 16 +-- gm/runtimeshader.cpp | 4 +- include/core/SkMesh.h | 4 +- include/core/SkSpan.h | 29 +---- include/effects/SkRuntimeEffect.h | 4 +- include/sksl/DSLType.h | 6 +- modules/particles/src/SkParticleEffect.cpp | 2 +- modules/skshaper/src/SkShaper_harfbuzz.cpp | 2 +- modules/svg/include/SkSVGTypes.h | 4 +- src/core/SkCanvas.cpp | 16 +-- src/core/SkFont.cpp | 10 +- src/core/SkGlyphRun.cpp | 20 ++-- src/core/SkMeshPriv.h | 2 +- src/core/SkPaintParamsKey.cpp | 2 +- src/core/SkRuntimeEffect.cpp | 36 +++--- src/core/SkShaderCodeDictionary.cpp | 34 +++--- src/core/SkZip.h | 2 +- src/gpu/Blend.cpp | 36 +++--- src/gpu/ganesh/GrDrawingManager.cpp | 2 +- src/gpu/ganesh/GrRenderTask.h | 4 +- src/gpu/ganesh/effects/GrSkSLFP.cpp | 4 +- src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp | 2 +- src/gpu/ganesh/gradients/GrGradientShader.cpp | 14 +-- src/gpu/ganesh/ops/DrawMeshOp.cpp | 6 +- src/gpu/graphite/GraphicsPipelineDesc.h | 2 +- src/gpu/graphite/Renderer.h | 6 +- src/gpu/graphite/UniformManager.cpp | 2 +- src/image/SkImage_Gpu.cpp | 2 +- src/pdf/SkPDFGradientShader.cpp | 2 +- src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp | 4 +- src/pdf/SkPDFType1Font.cpp | 2 +- src/sksl/SkSLDSLParser.cpp | 2 +- src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp | 4 +- src/sksl/codegen/SkSLVMCodeGenerator.cpp | 10 +- src/sksl/ir/SkSLFunctionDeclaration.cpp | 4 +- src/sksl/ir/SkSLSymbolTable.cpp | 4 +- .../SkSLEliminateDeadLocalVariables.cpp | 4 +- .../SkSLEliminateEmptyStatements.cpp | 2 +- .../SkSLEliminateUnreachableCode.cpp | 4 +- src/text/gpu/GlyphVector.cpp | 6 +- src/text/gpu/SubRunContainer.cpp | 24 ++-- src/utils/SkShaperJSONWriter.cpp | 4 +- tests/GrGlyphVectorTest.cpp | 2 +- tests/MeshTest.cpp | 112 +++++++++--------- tests/SkRuntimeEffectTest.cpp | 2 +- tests/SkSLInterpreterTest.cpp | 2 +- tests/SkSLTest.cpp | 2 +- tests/SkShaperJSONWriterTest.cpp | 6 +- tests/SkSpanTest.cpp | 57 +-------- tests/UtilsTest.cpp | 20 ++-- tests/graphite/CombinationBuilderTest.cpp | 3 +- tests/graphite/CommandBufferTest.cpp | 4 +- tests/graphite/KeyTest.cpp | 20 ++-- tests/graphite/PipelineDataCacheTest.cpp | 6 +- tools/fonts/TestSVGTypeface.cpp | 4 +- tools/fonts/create_test_font.cpp | 8 +- tools/fonts/create_test_font_color.cpp | 4 +- 59 files changed, 263 insertions(+), 342 deletions(-) diff --git a/fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp b/fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp index 1f24351af4..a75587f888 100644 --- a/fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp +++ b/fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp @@ -82,7 +82,7 @@ static bool FuzzSkRuntimeEffect_Once(sk_sp codeBytes, } } - sk_sp shader = effect->makeShader(uniformBytes, SkMakeSpan(children)); + sk_sp shader = effect->makeShader(uniformBytes, SkSpan(children)); if (!shader) { return false; } diff --git a/gm/drawglyphs.cpp b/gm/drawglyphs.cpp index 92dfb26f6d..364ef60b4f 100644 --- a/gm/drawglyphs.cpp +++ b/gm/drawglyphs.cpp @@ -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; diff --git a/gm/mesh.cpp b/gm/mesh.cpp index e23c1f34e4..fd56e20ce9 100644 --- a/gm/mesh.cpp +++ b/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(), diff --git a/gm/runtimeshader.cpp b/gm/runtimeshader.cpp index 5d8f13779d..5d773e3dd7 100644 --- a/gm/runtimeshader.cpp +++ b/gm/runtimeshader.cpp @@ -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); } }; diff --git a/include/core/SkMesh.h b/include/core/SkMesh.h index 24d9efcc3e..0592e6d118 100644 --- a/include/core/SkMesh.h +++ b/include/core/SkMesh.h @@ -141,7 +141,7 @@ public: sk_sp cs, SkAlphaType at); - SkSpan attributes() const { return SkMakeSpan(fAttributes); } + SkSpan 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 uniforms() const { return SkMakeSpan(fUniforms); } + SkSpan 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; diff --git a/include/core/SkSpan.h b/include/core/SkSpan.h index fb4620d7ba..90a85e2334 100644 --- a/include/core/SkSpan.h +++ b/include/core/SkSpan.h @@ -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 class SkSpan { @@ -33,7 +31,7 @@ public: template ::value>::type> constexpr SkSpan(const SkSpan& that) : fPtr(std::data(that)), fSize{std::size(that)} {} constexpr SkSpan(const SkSpan& o) = default; - template constexpr SkSpan(T(&a)[N]) : SkSpan{a, N} { } + template constexpr SkSpan(T(&a)[N]) : SkSpan(a, N) { } template constexpr SkSpan(Container& c) : SkSpan{std::data(c), std::size(c)} { } SkSpan(std::initializer_list il) : SkSpan(std::data(il), std::size(il)) {} @@ -72,32 +70,11 @@ public: } private: - static constexpr size_t kMaxSize = std::numeric_limits::max() / sizeof(T); + static const constexpr size_t kMaxSize = std::numeric_limits::max() / sizeof(T); T* fPtr; size_t fSize; }; -template inline constexpr SkSpan SkMakeSpan(T* p, S s) { - return SkSpan{p, SkTo(s)}; -} - -template inline constexpr SkSpan SkMakeSpan(T (&a)[N]) { - return SkSpan(a, N); -} - -template -inline auto SkMakeSpan(Container& c) -> - SkSpan()))>> { - return {std::data(c), std::size(c)}; -} - -template -inline auto SkMakeSpan(std::initializer_list il) -> - SkSpan>()))>> -{ - return {std::data(il), std::size(il)}; -} - template SkSpan(Container&) -> SkSpan()))>>; diff --git a/include/effects/SkRuntimeEffect.h b/include/effects/SkRuntimeEffect.h index 794ea6f3f4..080b17a5c0 100644 --- a/include/effects/SkRuntimeEffect.h +++ b/include/effects/SkRuntimeEffect.h @@ -245,8 +245,8 @@ public: // provide an SkData of this size, containing values for all of those variables. size_t uniformSize() const; - SkSpan uniforms() const { return SkMakeSpan(fUniforms); } - SkSpan children() const { return SkMakeSpan(fChildren); } + SkSpan uniforms() const { return SkSpan(fUniforms); } + SkSpan 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; diff --git a/include/sksl/DSLType.h b/include/sksl/DSLType.h index 972997522b..5fc745f49c 100644 --- a/include/sksl/DSLType.h +++ b/include/sksl/DSLType.h @@ -160,13 +160,13 @@ public: template static DSLExpression Construct(DSLType type, DSLVarBase& var, Args&&... args) { DSLExpression argArray[] = {var, args...}; - return Construct(type, SkMakeSpan(argArray)); + return Construct(type, SkSpan(argArray)); } template 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 argArray); @@ -260,7 +260,7 @@ DSLType Struct(std::string_view name, SkSpan fields, template 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 diff --git a/modules/particles/src/SkParticleEffect.cpp b/modules/particles/src/SkParticleEffect.cpp index bf05dfa0bf..a31f10be7b 100644 --- a/modules/particles/src/SkParticleEffect.cpp +++ b/modules/particles/src/SkParticleEffect.cpp @@ -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(); diff --git a/modules/skshaper/src/SkShaper_harfbuzz.cpp b/modules/skshaper/src/SkShaper_harfbuzz.cpp index 3d45a5ee88..b3c272967a 100644 --- a/modules/skshaper/src/SkShaper_harfbuzz.cpp +++ b/modules/skshaper/src/SkShaper_harfbuzz.cpp @@ -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(utf8Start - utf8) || SkTo(utf8End - utf8) <= feature.start) { diff --git a/modules/svg/include/SkSVGTypes.h b/modules/svg/include/SkSVGTypes.h index 39ea899474..9e88e270a1 100644 --- a/modules/svg/include/SkSVGTypes.h +++ b/modules/svg/include/SkSVGTypes.h @@ -204,10 +204,10 @@ public: Type type() const { return fType; } const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; } SkSpan vars() const { - return fVars ? SkMakeSpan(fVars->fData) : SkSpan{nullptr, 0}; + return fVars ? SkSpan(fVars->fData) : SkSpan{nullptr, 0}; } SkSpan< SkString> vars() { - return fVars ? SkMakeSpan< Vars>(fVars->fData) : SkSpan< SkString>{nullptr, 0}; + return fVars ? SkSpan(fVars->fData) : SkSpan< SkString>{nullptr, 0}; } private: diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index a0855f6bcd..dafda871b0 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -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() }; 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(), SkSpan(), SkSpan() @@ -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(), SkSpan(), rotateScales diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp index 53be4b646a..929a466b64 100644 --- a/src/core/SkFont.cpp +++ b/src/core/SkFont.cpp @@ -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 glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, glyphCount)); + SkSpan 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 glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count)); + SkSpan 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 glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count)); + SkSpan 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 glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count)); + SkSpan 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 glyphs = paths.glyphs(SkMakeSpan(glyphIDs, count)); + SkSpan glyphs = paths.glyphs(SkSpan(glyphIDs, count)); for (auto glyph : glyphs) { proc(glyph->path(), mx, ctx); diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp index 15062bdbab..90901e3c94 100644 --- a/src/core/SkGlyphRun.cpp +++ b/src/core/SkGlyphRun.cpp @@ -192,7 +192,7 @@ static SkSpan 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{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> SkGlyphRunBuilder::convertRSXForm(SkSpan 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 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(); } @@ -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(); } diff --git a/src/core/SkMeshPriv.h b/src/core/SkMeshPriv.h index f681bce902..05c6fcb7ea 100644 --- a/src/core/SkMeshPriv.h +++ b/src/core/SkMeshPriv.h @@ -29,7 +29,7 @@ struct SkMeshSpecificationPriv { using ColorType = SkMeshSpecification::ColorType; static SkSpan Varyings(const SkMeshSpecification& spec) { - return SkMakeSpan(spec.fVaryings); + return SkSpan(spec.fVaryings); } static const SkSL::Program* VS(const SkMeshSpecification& spec) { return spec.fVS.get(); } diff --git a/src/core/SkPaintParamsKey.cpp b/src/core/SkPaintParamsKey.cpp index abf36acf07..5715c9a91d 100644 --- a/src/core/SkPaintParamsKey.cpp +++ b/src/core/SkPaintParamsKey.cpp @@ -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() { diff --git a/src/core/SkRuntimeEffect.cpp b/src/core/SkRuntimeEffect.cpp index 9132f8b6ea..1d297d87ad 100644 --- a/src/core/SkRuntimeEffect.cpp +++ b/src/core/SkRuntimeEffect.cpp @@ -776,7 +776,7 @@ std::unique_ptr 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 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 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 unoptimized = fEffect->makeUnoptimizedClone(); sk_sp debugTrace = make_skvm_debug_trace(unoptimized.get(), coord); auto debugShader = sk_make_sp(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 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 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 SkRuntimeEffect::makeShader(sk_sp 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 SkRuntimeEffect::makeShader(sk_sp uniforms, @@ -1433,7 +1433,7 @@ sk_sp 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 SkRuntimeEffect::makeColorFilter(sk_sp 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 SkRuntimeEffect::makeColorFilter(sk_sp uniforms, @@ -1593,7 +1593,7 @@ sk_sp 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 SkRuntimeShaderBuilder::makeImage(GrRecordingContext* recordingCo sk_sp 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 effect) @@ -1611,7 +1611,7 @@ SkRuntimeBlendBuilder::~SkRuntimeBlendBuilder() = default; sk_sp SkRuntimeBlendBuilder::makeBlender() { return this->effect()->makeBlender(this->uniforms(), - SkMakeSpan(this->children(), this->numChildren())); + SkSpan(this->children(), this->numChildren())); } #endif // SK_ENABLE_SKSL diff --git a/src/core/SkShaderCodeDictionary.cpp b/src/core/SkShaderCodeDictionary.cpp index a3d3140e8f..273a239119 100644 --- a/src/core/SkShaderCodeDictionary.cpp +++ b/src/core/SkShaderCodeDictionary.cpp @@ -197,7 +197,7 @@ SkShaderCodeDictionary::Entry* SkShaderCodeDictionary::makeEntry( uint8_t* newKeyData = fArena.makeArray(key.sizeInBytes()); memcpy(newKeyData, key.data(), key.sizeInBytes()); - SkSpan newKeyAsSpan = SkMakeSpan(newKeyData, key.sizeInBytes()); + SkSpan 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, diff --git a/src/core/SkZip.h b/src/core/SkZip.h index 1f32bfed8f..b1c59a6ce5 100644 --- a/src/core/SkZip.h +++ b/src/core/SkZip.h @@ -79,7 +79,7 @@ public: constexpr Iterator begin() const { return Iterator{this, 0}; } constexpr Iterator end() const { return Iterator{this, this->size()}; } template constexpr auto get() const { - return SkMakeSpan(std::get(fPointers), fSize); + return SkSpan(std::get(fPointers), fSize); } constexpr std::tuple data() const { return fPointers; } constexpr SkZip first(size_t n) const { diff --git a/src/gpu/Blend.cpp b/src/gpu/Blend.cpp index a4caa45437..85dc8c5a5c 100644 --- a/src/gpu/Blend.cpp +++ b/src/gpu/Blend.cpp @@ -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), {}}; } diff --git a/src/gpu/ganesh/GrDrawingManager.cpp b/src/gpu/ganesh/GrDrawingManager.cpp index b47ea61c1a..b0da868d9f 100644 --- a/src/gpu/ganesh/GrDrawingManager.cpp +++ b/src/gpu/ganesh/GrDrawingManager.cpp @@ -356,7 +356,7 @@ static void reorder_array_by_llist(const SkTInternalLList& llist, SkTArray llist; - bool clustered = GrClusterRenderTasks(SkMakeSpan(fDAG), &llist); + bool clustered = GrClusterRenderTasks(SkSpan(fDAG), &llist); if (!clustered) { return false; } diff --git a/src/gpu/ganesh/GrRenderTask.h b/src/gpu/ganesh/GrRenderTask.h index cc7fcdee60..b3c8ef320c 100644 --- a/src/gpu/ganesh/GrRenderTask.h +++ b/src/gpu/ganesh/GrRenderTask.h @@ -77,8 +77,8 @@ public: */ void addDependenciesFromOtherTask(GrRenderTask* otherTask); - SkSpan dependencies() { return SkMakeSpan(fDependencies); } - SkSpan dependents() { return SkMakeSpan(fDependents); } + SkSpan dependencies() { return SkSpan(fDependencies); } + SkSpan dependents() { return SkSpan(fDependents); } void replaceDependency(const GrRenderTask* toReplace, GrRenderTask* replaceWith); void replaceDependent(const GrRenderTask* toReplace, GrRenderTask* replaceWith); diff --git a/src/gpu/ganesh/effects/GrSkSLFP.cpp b/src/gpu/ganesh/effects/GrSkSLFP.cpp index 756407621e..c164f9ffa4 100644 --- a/src/gpu/ganesh/effects/GrSkSLFP.cpp +++ b/src/gpu/ganesh/effects/GrSkSLFP.cpp @@ -252,8 +252,8 @@ private: const GrFragmentProcessor& _proc) override { const GrSkSLFP& outer = _proc.cast(); pdman.setRuntimeEffectUniforms(outer.fEffect->uniforms(), - SkMakeSpan(fUniformHandles), - SkMakeSpan(outer.specialized(), outer.uniformCount()), + SkSpan(fUniformHandles), + SkSpan(outer.specialized(), outer.uniformCount()), outer.uniformData()); } diff --git a/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp index 1a9a1fa0fc..87b3acd0b5 100644 --- a/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp @@ -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(); } diff --git a/src/gpu/ganesh/gradients/GrGradientShader.cpp b/src/gpu/ganesh/gradients/GrGradientShader.cpp index 7e9e210d02..68012423f8 100644 --- a/src/gpu/ganesh/gradients/GrGradientShader.cpp +++ b/src/gpu/ganesh/gradients/GrGradientShader.cpp @@ -120,8 +120,8 @@ static std::unique_ptr 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 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 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}. diff --git a/src/gpu/ganesh/ops/DrawMeshOp.cpp b/src/gpu/ganesh/ops/DrawMeshOp.cpp index 851829b27d..3809851a25 100644 --- a/src/gpu/ganesh/ops/DrawMeshOp.cpp +++ b/src/gpu/ganesh/ops/DrawMeshOp.cpp @@ -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 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); diff --git a/src/gpu/graphite/GraphicsPipelineDesc.h b/src/gpu/graphite/GraphicsPipelineDesc.h index 888b176fb2..b4b316d6d1 100644 --- a/src/gpu/graphite/GraphicsPipelineDesc.h +++ b/src/gpu/graphite/GraphicsPipelineDesc.h @@ -30,7 +30,7 @@ class GraphicsPipelineDesc { public: GraphicsPipelineDesc(); - SkSpan asKey() const { return SkMakeSpan(fKey.data(), fKey.size()); } + SkSpan asKey() const { return SkSpan(fKey.data(), fKey.size()); } bool operator==(const GraphicsPipelineDesc& that) const { return this->fKey == that.fKey; diff --git a/src/gpu/graphite/Renderer.h b/src/gpu/graphite/Renderer.h index 4416db6e65..33d5ba40ae 100644 --- a/src/gpu/graphite/Renderer.h +++ b/src/gpu/graphite/Renderer.h @@ -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 uniforms() const { return SkMakeSpan(fUniforms); } - SkSpan vertexAttributes() const { return SkMakeSpan(fVertexAttrs); } - SkSpan instanceAttributes() const { return SkMakeSpan(fInstanceAttrs); } + SkSpan uniforms() const { return SkSpan(fUniforms); } + SkSpan vertexAttributes() const { return SkSpan(fVertexAttrs); } + SkSpan instanceAttributes() const { return SkSpan(fInstanceAttrs); } // TODO: Actual API to do things diff --git a/src/gpu/graphite/UniformManager.cpp b/src/gpu/graphite/UniformManager.cpp index 949665ed61..ad93cef083 100644 --- a/src/gpu/graphite/UniformManager.cpp +++ b/src/gpu/graphite/UniformManager.cpp @@ -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() { diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index db00ba919d..5de41b1f39 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -783,7 +783,7 @@ sk_sp 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; } diff --git a/src/pdf/SkPDFGradientShader.cpp b/src/pdf/SkPDFGradientShader.cpp index 0511f7a0ee..4db74f24e5 100644 --- a/src/pdf/SkPDFGradientShader.cpp +++ b/src/pdf/SkPDFGradientShader.cpp @@ -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 {"); diff --git a/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp b/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp index 2696166b0b..d6e0fe0645 100644 --- a/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp +++ b/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp @@ -111,7 +111,7 @@ std::unique_ptr 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 advances; @@ -120,7 +120,7 @@ std::unique_ptr 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; diff --git a/src/pdf/SkPDFType1Font.cpp b/src/pdf/SkPDFType1Font.cpp index 7a60669b4b..8dd8c5dbaa 100644 --- a/src/pdf/SkPDFType1Font.cpp +++ b/src/pdf/SkPDFType1Font.cpp @@ -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))); } diff --git a/src/sksl/SkSLDSLParser.cpp b/src/sksl/SkSLDSLParser.cpp index 83bf05dc49..21c2b68b02 100644 --- a/src/sksl/SkSLDSLParser.cpp +++ b/src/sksl/SkSLDSLParser.cpp @@ -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) */ diff --git a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp index 602996cd00..97c5478c45 100644 --- a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp +++ b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp @@ -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, diff --git a/src/sksl/codegen/SkSLVMCodeGenerator.cpp b/src/sksl/codegen/SkSLVMCodeGenerator.cpp index afa8026752..68f8799ffb 100644 --- a/src/sksl/codegen/SkSLVMCodeGenerator.cpp +++ b/src/sksl/codegen/SkSLVMCodeGenerator.cpp @@ -155,7 +155,7 @@ struct Value { return fVals[i]; } - SkSpan asSpan() { return SkMakeSpan(fVals); } + SkSpan 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(), result.r); diff --git a/src/sksl/ir/SkSLFunctionDeclaration.cpp b/src/sksl/ir/SkSLFunctionDeclaration.cpp index c6002792ec..2066281705 100644 --- a/src/sksl/ir/SkSLFunctionDeclaration.cpp +++ b/src/sksl/ir/SkSLFunctionDeclaration.cpp @@ -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().functions()); + functions = SkSpan(entry->as().functions()); break; case Symbol::Kind::kFunctionDeclaration: declPtr = &entry->as(); - functions = SkMakeSpan(&declPtr, 1); + functions = SkSpan(&declPtr, 1); break; default: errors.error(pos, "symbol '" + std::string(name) + "' was already defined"); diff --git a/src/sksl/ir/SkSLSymbolTable.cpp b/src/sksl/ir/SkSLSymbolTable.cpp index 8522743675..77b504e745 100644 --- a/src/sksl/ir/SkSLSymbolTable.cpp +++ b/src/sksl/ir/SkSLSymbolTable.cpp @@ -22,10 +22,10 @@ static SkSpan get_overload_set( switch (s.kind()) { case Symbol::Kind::kFunctionDeclaration: scratchPtr = &s.as(); - return SkMakeSpan(&scratchPtr, 1); + return SkSpan(&scratchPtr, 1); case Symbol::Kind::kUnresolvedFunction: - return SkMakeSpan(s.as().functions()); + return SkSpan(s.as().functions()); default: return SkSpan{}; diff --git a/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp b/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp index 33943407c5..fa0cee4168 100644 --- a/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp +++ b/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp @@ -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; } diff --git a/src/sksl/transform/SkSLEliminateEmptyStatements.cpp b/src/sksl/transform/SkSLEliminateEmptyStatements.cpp index 238f4ec041..ca49a151a6 100644 --- a/src/sksl/transform/SkSLEliminateEmptyStatements.cpp +++ b/src/sksl/transform/SkSLEliminateEmptyStatements.cpp @@ -56,7 +56,7 @@ static void eliminate_empty_statements(SkSpan> e } void Transform::EliminateEmptyStatements(LoadedModule& module) { - return eliminate_empty_statements(SkMakeSpan(module.fElements)); + return eliminate_empty_statements(SkSpan(module.fElements)); } } // namespace SkSL diff --git a/src/sksl/transform/SkSLEliminateUnreachableCode.cpp b/src/sksl/transform/SkSLEliminateUnreachableCode.cpp index 2e44912f07..4187929132 100644 --- a/src/sksl/transform/SkSLEliminateUnreachableCode.cpp +++ b/src/sksl/transform/SkSLEliminateUnreachableCode.cpp @@ -146,11 +146,11 @@ static void eliminate_unreachable_code(SkSpan> 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 diff --git a/src/text/gpu/GlyphVector.cpp b/src/text/gpu/GlyphVector.cpp index 654329c0a8..15a1dc0f5b 100644 --- a/src/text/gpu/GlyphVector.cpp +++ b/src/text/gpu/GlyphVector.cpp @@ -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::MakeFromBuffer(SkReadBuffer& buffer, @@ -64,7 +64,7 @@ std::optional 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 GlyphVector::glyphs() const { - return SkMakeSpan(reinterpret_cast(fGlyphs.data()), fGlyphs.size()); + return SkSpan(reinterpret_cast(fGlyphs.data()), fGlyphs.size()); } // packedGlyphIDToGlyph must be run in single-threaded mode. diff --git a/src/text/gpu/SubRunContainer.cpp b/src/text/gpu/SubRunContainer.cpp index 51091424a7..0f9484acb3 100644 --- a/src/text/gpu/SubRunContainer.cpp +++ b/src/text/gpu/SubRunContainer.cpp @@ -525,7 +525,7 @@ std::optional PathOpSubmitter::MakeFromBuffer(SkReadBuffer& buf auto paths = alloc->makeUniqueArray(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::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& 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::MakeFromBuffer( auto drawables = alloc->makePODArray(glyphCount); SkBulkGlyphMetricsAndDrawables drawableGetter(sk_sp{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::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 utf1to1, SkSpan glyph1to1) { this->displayMToN(codePointCount, utf1to1, glyph1to1); diff --git a/tests/GrGlyphVectorTest.cpp b/tests/GrGlyphVectorTest.cpp index 3a2f0b8143..6b9245606d 100644 --- a/tests/GrGlyphVectorTest.cpp +++ b/tests/GrGlyphVectorTest.cpp @@ -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); diff --git a/tests/MeshTest.cpp b/tests/MeshTest.cpp index 904ea38b53..c4e6150b03 100644 --- a/tests/MeshTest.cpp +++ b/tests/MeshTest.cpp @@ -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 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(), 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(), 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::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]); } diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp index 61360979b2..30a25f652d 100644 --- a/tests/SkRuntimeEffectTest.cpp +++ b/tests/SkRuntimeEffectTest.cpp @@ -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)); diff --git a/tests/SkSLInterpreterTest.cpp b/tests/SkSLInterpreterTest.cpp index 0563a15bf3..f9b9a055a2 100644 --- a/tests/SkSLInterpreterTest.cpp +++ b/tests/SkSLInterpreterTest.cpp @@ -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(); }; diff --git a/tests/SkSLTest.cpp b/tests/SkSLTest.cpp index cdfb403abb..d917efdb16 100644 --- a/tests/SkSLTest.cpp +++ b/tests/SkSLTest.cpp @@ -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 shader = builder.makeShader(); if (!shader) { diff --git a/tests/SkShaperJSONWriterTest.cpp b/tests/SkShaperJSONWriterTest.cpp index c7d4ec382b..42a8fa553d 100644 --- a/tests/SkShaperJSONWriterTest.cpp +++ b/tests/SkShaperJSONWriterTest.cpp @@ -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); } } diff --git a/tests/SkSpanTest.cpp b/tests/SkSpanTest.cpp index 78eb4be3b1..3e88c5d4a0 100644 --- a/tests/SkSpanTest.cpp +++ b/tests/SkSpanTest.cpp @@ -11,7 +11,7 @@ #include DEF_TEST(SkSpanBasicTemplateGuide, reporter) { - // Test constness preservation for SkMakeSpan. + // Test constness preservation for SkSpan. { std::vector 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 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 t = {{1, 2, 3, 4, 5}}; - const std::vector& 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 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 t = {{1, 2, 3, 4, 5}}; - const std::array& 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 v; - auto s = SkMakeSpan(v); - REPORTER_ASSERT(reporter, s.empty()); - } -} - static bool test_span_parameter(SkSpan s) { return s[0] == 1 && s[1] == 2 && s[2] == 3; } diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp index 20d1d3f9da..423a17559d 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -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 is[10]; std::unique_ptr os[10]; - auto s = SkMakeSpan(is); + auto s = SkSpan(is); for (auto [i, v] : SkMakeEnumerate(s)) { v = std::make_unique(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 is[10]; std::unique_ptr os[10]; - auto s = SkMakeSpan(is); + auto s = SkSpan(is); for (auto [i, v] : SkMakeEnumerate(s)) { v = std::make_unique(i); } @@ -299,7 +299,7 @@ DEF_TEST(SkZip, reporter) { const float B[] = {10.f, 20.f, 30.f, 40.f}; std::vector C = {{20, 30, 40, 50}}; std::array D = {{100, 200, 300, 400}}; - SkSpan S = SkMakeSpan(C); + SkSpan S = SkSpan(C); // Check SkZip calls SkZip @@ -472,7 +472,7 @@ DEF_TEST(SkMakeZip, reporter) { const float B[] = {10.f, 20.f, 30.f, 40.f}; const std::vector C = {{20, 30, 40, 50}}; std::array D = {{100, 200, 300, 400}}; - SkSpan S = SkMakeSpan(C); + SkSpan S = SkSpan(C); uint16_t* P = &A[0]; { // Check make zip diff --git a/tests/graphite/CombinationBuilderTest.cpp b/tests/graphite/CombinationBuilderTest.cpp index 84f3fc0c40..9ce2280ddb 100644 --- a/tests/graphite/CombinationBuilderTest.cpp +++ b/tests/graphite/CombinationBuilderTest.cpp @@ -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); } } } diff --git a/tests/graphite/CommandBufferTest.cpp b/tests/graphite/CommandBufferTest.cpp index 8524c24e42..bdaf7e5f71 100644 --- a/tests/graphite/CommandBufferTest.cpp +++ b/tests/graphite/CommandBufferTest.cpp @@ -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)); diff --git a/tests/graphite/KeyTest.cpp b/tests/graphite/KeyTest.cpp index 1394b3cb77..0b623af0b9 100644 --- a/tests/graphite/KeyTest.cpp +++ b/tests/graphite/KeyTest.cpp @@ -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}; diff --git a/tests/graphite/PipelineDataCacheTest.cpp b/tests/graphite/PipelineDataCacheTest.cpp index 8941f29889..66005f2b52 100644 --- a/tests/graphite/PipelineDataCacheTest.cpp +++ b/tests/graphite/PipelineDataCacheTest.cpp @@ -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); diff --git a/tools/fonts/TestSVGTypeface.cpp b/tools/fonts/TestSVGTypeface.cpp index 2a044321c5..8cd046c18d 100644 --- a/tools/fonts/TestSVGTypeface.cpp +++ b/tools/fonts/TestSVGTypeface.cpp @@ -344,7 +344,7 @@ sk_sp TestSVGTypeface::Default() { return sk_make_sp("Emoji", 1000, metrics, - SkMakeSpan(glyphs), + glyphs, SkFontStyle::Normal()); } @@ -394,7 +394,7 @@ sk_sp TestSVGTypeface::Planets() { return sk_make_sp("Planets", 200, metrics, - SkMakeSpan(glyphs), + glyphs, SkFontStyle::Normal()); } diff --git a/tools/fonts/create_test_font.cpp b/tools/fonts/create_test_font.cpp index a187aed7c3..28ffe5af3e 100644 --- a/tools/fonts/create_test_font.cpp +++ b/tools/fonts/create_test_font.cpp @@ -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 kFamilies(SkMakeSpan(kFamiliesData)); + static constexpr SkSpan kFamilies(kFamiliesData); #ifdef SK_BUILD_FOR_UNIX generate_fonts("/usr/share/fonts/truetype/liberation/", kFamilies); diff --git a/tools/fonts/create_test_font_color.cpp b/tools/fonts/create_test_font_color.cpp index 6b1a0a6bca..1ba7f9867e 100644 --- a/tools/fonts/create_test_font_color.cpp +++ b/tools/fonts/create_test_font_color.cpp @@ -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; }