migrating SkTDArray towards std::vector api
fix for https://skia-review.googlesource.com/c/skia/+/146140
Change from original was to include <initializer_list>
Bug: skia:
Change-Id: Ie36426fcf7ce778a95e2b656ce80a9a394a8307c
Reviewed-on: https://skia-review.googlesource.com/146160
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/src/core/SkEdgeBuilder.cpp b/src/core/SkEdgeBuilder.cpp
index 48c1bca..17d84ef 100644
--- a/src/core/SkEdgeBuilder.cpp
+++ b/src/core/SkEdgeBuilder.cpp
@@ -127,7 +127,7 @@
if (fEdgeType == kBezier) {
SkLine* line = fAlloc.make<SkLine>();
if (line->set(pts)) {
- fList.push(line);
+ fList.push_back(line);
}
} else if (fEdgeType == kAnalyticEdge) {
SkAnalyticEdge* edge = fAlloc.make<SkAnalyticEdge>();
@@ -141,7 +141,7 @@
goto unallocate_analytic_edge;
}
}
- fList.push(edge);
+ fList.push_back(edge);
} else {
unallocate_analytic_edge:
;
@@ -159,7 +159,7 @@
goto unallocate_edge;
}
}
- fList.push(edge);
+ fList.push_back(edge);
} else {
unallocate_edge:
;
@@ -172,19 +172,19 @@
if (fEdgeType == kBezier) {
SkQuad* quad = fAlloc.make<SkQuad>();
if (quad->set(pts)) {
- fList.push(quad);
+ fList.push_back(quad);
}
} else if (fEdgeType == kAnalyticEdge) {
SkAnalyticQuadraticEdge* edge = fAlloc.make<SkAnalyticQuadraticEdge>();
if (edge->setQuadratic(pts)) {
- fList.push(edge);
+ fList.push_back(edge);
} else {
// TODO: unallocate edge from storage...
}
} else {
SkQuadraticEdge* edge = fAlloc.make<SkQuadraticEdge>();
if (edge->setQuadratic(pts, fShiftUp)) {
- fList.push(edge);
+ fList.push_back(edge);
} else {
// TODO: unallocate edge from storage...
}
@@ -195,19 +195,19 @@
if (fEdgeType == kBezier) {
SkCubic* cubic = fAlloc.make<SkCubic>();
if (cubic->set(pts)) {
- fList.push(cubic);
+ fList.push_back(cubic);
}
} else if (fEdgeType == kAnalyticEdge) {
SkAnalyticCubicEdge* edge = fAlloc.make<SkAnalyticCubicEdge>();
if (edge->setCubic(pts)) {
- fList.push(edge);
+ fList.push_back(edge);
} else {
// TODO: unallocate edge from storage...
}
} else {
SkCubicEdge* edge = fAlloc.make<SkCubicEdge>();
if (edge->setCubic(pts, fShiftUp)) {
- fList.push(edge);
+ fList.push_back(edge);
} else {
// TODO: unallocate edge from storage...
}
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 99ac492..05d2ca8 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -3077,7 +3077,7 @@
}
SkVector tangent;
SkEvalCubicAt(c, t, nullptr, &tangent, nullptr);
- tangents->push(tangent);
+ tangents->push_back(tangent);
}
}
@@ -3104,7 +3104,7 @@
continue;
}
SkConic conic(pts, w);
- tangents->push(conic.evalTangentAt(t));
+ tangents->push_back(conic.evalTangentAt(t));
}
}
@@ -3130,7 +3130,7 @@
if (!SkScalarNearlyEqual(x, xt)) {
continue;
}
- tangents->push(SkEvalQuadTangentAt(pts, t));
+ tangents->push_back(SkEvalQuadTangentAt(pts, t));
}
}
@@ -3153,7 +3153,7 @@
}
SkVector v;
v.set(dx, dy);
- tangents->push(v);
+ tangents->push_back(v);
}
static bool contains_inclusive(const SkRect& r, SkScalar x, SkScalar y) {
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 922fb6a..ca36e7e 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -47,7 +47,7 @@
void SkPictureRecord::willSave() {
// record the offset to us, making it non-positive to distinguish a save
// from a clip entry.
- fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten());
+ fRestoreOffsetStack.push_back(-(int32_t)fWriter.bytesWritten());
this->recordSave();
this->INHERITED::willSave();
@@ -64,7 +64,7 @@
SkCanvas::SaveLayerStrategy SkPictureRecord::getSaveLayerStrategy(const SaveLayerRec& rec) {
// record the offset to us, making it non-positive to distinguish a save
// from a clip entry.
- fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten());
+ fRestoreOffsetStack.push_back(-(int32_t)fWriter.bytesWritten());
this->recordSaveLayer(rec);
(void)this->INHERITED::getSaveLayerStrategy(rec);
diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp
index 4d1787e..8d9239c 100644
--- a/src/core/SkRTree.cpp
+++ b/src/core/SkRTree.cpp
@@ -172,7 +172,7 @@
for (int i = 0; i < node->fNumChildren; ++i) {
if (SkRect::Intersects(node->fChildren[i].fBounds, query)) {
if (0 == node->fLevel) {
- results->push(node->fChildren[i].fOpIndex);
+ results->push_back(node->fChildren[i].fOpIndex);
} else {
this->search(node->fChildren[i].fSubtree, query, results);
}
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 9c58456..e42ff29 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -169,7 +169,7 @@
fCTM = SkMatrix::I();
// We push an extra save block to track the bounds of any top-level control operations.
- fSaveStack.push({ 0, Bounds::MakeEmpty(), nullptr, fCTM });
+ fSaveStack.push_back({ 0, Bounds::MakeEmpty(), nullptr, fCTM });
}
void cleanUp() {
@@ -275,7 +275,7 @@
sb.paint = paint;
sb.ctm = this->fCTM;
- fSaveStack.push(sb);
+ fSaveStack.push_back(sb);
this->pushControl();
}
@@ -329,7 +329,7 @@
}
void pushControl() {
- fControlIndices.push(fCurrentOp);
+ fControlIndices.push_back(fCurrentOp);
if (!fSaveStack.isEmpty()) {
fSaveStack.top().controlOps++;
}
diff --git a/src/gpu/ops/GrAAConvexTessellator.cpp b/src/gpu/ops/GrAAConvexTessellator.cpp
index 72df654..e08a354 100644
--- a/src/gpu/ops/GrAAConvexTessellator.cpp
+++ b/src/gpu/ops/GrAAConvexTessellator.cpp
@@ -451,10 +451,10 @@
SkASSERT(SkScalarNearlyEqual(1.0f, fNorms[cur].length()));
}
- fNorms.push(SkPoint::Make(-fNorms[0].fX, -fNorms[0].fY));
+ fNorms.push_back(SkPoint::Make(-fNorms[0].fX, -fNorms[0].fY));
// we won't actually use the bisectors, so just push zeroes
- fBisectors.push(SkPoint::Make(0.0, 0.0));
- fBisectors.push(SkPoint::Make(0.0, 0.0));
+ fBisectors.push_back(SkPoint::Make(0.0, 0.0));
+ fBisectors.push_back(SkPoint::Make(0.0, 0.0));
} else {
return false;
}
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 011db9d..cd59eab 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -308,16 +308,16 @@
const GrSamplerState& state = bindings[i].fState;
GrVkTexture* texture = bindings[i].fTexture;
- fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(
+ fSamplers.push_back(gpu->resourceProvider().findOrCreateCompatibleSampler(
state, texture->texturePriv().maxMipMapLevel()));
const GrVkResource* textureResource = texture->resource();
textureResource->ref();
- fTextures.push(textureResource);
+ fTextures.push_back(textureResource);
const GrVkImageView* textureView = texture->textureView();
textureView->ref();
- fTextureViews.push(textureView);
+ fTextureViews.push_back(textureView);
VkDescriptorImageInfo imageInfo;
memset(&imageInfo, 0, sizeof(VkDescriptorImageInfo));
diff --git a/src/pathops/SkPathWriter.cpp b/src/pathops/SkPathWriter.cpp
index 9548c3b4f..797f42f 100644
--- a/src/pathops/SkPathWriter.cpp
+++ b/src/pathops/SkPathWriter.cpp
@@ -97,8 +97,8 @@
this->close();
} else {
SkASSERT(fDefer[1]);
- fEndPtTs.push(fFirstPtT);
- fEndPtTs.push(fDefer[1]);
+ fEndPtTs.push_back(fFirstPtT);
+ fEndPtTs.push_back(fDefer[1]);
fPartials.push_back(fCurrent);
this->init();
}
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index fc7384f..43ee5f6 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1464,7 +1464,7 @@
SkTDArray<SkPDFObject*> fonts;
fonts.setReserve(fFontResources.count());
for (SkPDFFont* font : fFontResources) {
- fonts.push(font);
+ fonts.push_back(font);
}
return SkPDFResourceDict::Make(
&fGraphicStateResources,
@@ -1900,7 +1900,7 @@
int resourceIndex = fShaderResources.find(pdfShader.get());
if (resourceIndex < 0) {
resourceIndex = fShaderResources.count();
- fShaderResources.push(pdfShader.get());
+ fShaderResources.push_back(pdfShader.get());
pdfShader.get()->ref();
}
entry->fShaderIndex = resourceIndex;
@@ -1933,7 +1933,7 @@
int result = fGraphicStateResources.find(gs);
if (result < 0) {
result = fGraphicStateResources.count();
- fGraphicStateResources.push(gs);
+ fGraphicStateResources.push_back(gs);
gs->ref();
}
return result;
@@ -1946,7 +1946,7 @@
int result = fXObjectResources.find(xObject);
if (result < 0) {
result = fXObjectResources.count();
- fXObjectResources.push(SkRef(xObject));
+ fXObjectResources.push_back(SkRef(xObject));
}
return result;
}
@@ -1960,7 +1960,7 @@
if (resourceIndex < 0) {
fDocument->registerFont(newFont.get());
resourceIndex = fFontResources.count();
- fFontResources.push(newFont.release());
+ fFontResources.push_back(newFont.release());
}
return resourceIndex;
}
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 7d91454..ace2f45 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -61,7 +61,7 @@
// always free and has a generation number of 65,535; it is
// the head of the linked list of free objects."
SkASSERT(fOffsets.count() == fNextToBeSerialized);
- fOffsets.push(this->offset(wStream));
+ fOffsets.push_back(this->offset(wStream));
wStream->writeDecAsText(index);
wStream->writeText(" 0 obj\n"); // Generation number is always 0.
object->emitObject(wStream, fObjNumMap);
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index e997650..c25d724 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -351,7 +351,7 @@
// TODO(halcanary): sfntly should take a more compact format.
SkTDArray<unsigned> subset;
if (!glyphUsage.has(0)) {
- subset.push(0); // Always include glyph 0.
+ subset.push_back(0); // Always include glyph 0.
}
glyphUsage.exportTo(&subset);
diff --git a/src/pdf/SkPDFGradientShader.cpp b/src/pdf/SkPDFGradientShader.cpp
index dc11d64..1336938 100644
--- a/src/pdf/SkPDFGradientShader.cpp
+++ b/src/pdf/SkPDFGradientShader.cpp
@@ -791,11 +791,11 @@
SkPDFObject* gState) {
SkTDArray<SkPDFObject*> patterns;
if (functionShader) {
- patterns.push(functionShader);
+ patterns.push_back(functionShader);
}
SkTDArray<SkPDFObject*> graphicStates;
if (gState) {
- graphicStates.push(gState);
+ graphicStates.push_back(gState);
}
return SkPDFResourceDict::Make(&graphicStates, &patterns, nullptr, nullptr);
}
diff --git a/src/pdf/SkPDFMakeToUnicodeCmap.cpp b/src/pdf/SkPDFMakeToUnicodeCmap.cpp
index 4f383e1..7fd2931 100644
--- a/src/pdf/SkPDFMakeToUnicodeCmap.cpp
+++ b/src/pdf/SkPDFMakeToUnicodeCmap.cpp
@@ -182,7 +182,7 @@
currentRangeEntry.fUnicode + i - currentRangeEntry.fStart;
if (!inSubset || !inRange) {
if (currentRangeEntry.fEnd > currentRangeEntry.fStart) {
- bfrangeEntries.push(currentRangeEntry);
+ bfrangeEntries.push_back(currentRangeEntry);
} else {
BFChar* entry = bfcharEntries.append();
entry->fGlyphId = currentRangeEntry.fStart;
diff --git a/src/ports/SkFontMgr_android_parser.cpp b/src/ports/SkFontMgr_android_parser.cpp
index 1269523..df58815 100644
--- a/src/ports/SkFontMgr_android_parser.cpp
+++ b/src/ports/SkFontMgr_android_parser.cpp
@@ -556,7 +556,7 @@
if (child->start) {
child->start(self, tag, attributes);
}
- self->fHandler.push(child);
+ self->fHandler.push_back(child);
XML_SetCharacterDataHandler(self->fParser, child->chars);
} else {
SK_FONTCONFIGPARSER_WARNING("'%s' tag not recognized, skipping", tag);
diff --git a/src/utils/SkBitSet.h b/src/utils/SkBitSet.h
index 98aa05f..755e63b 100644
--- a/src/utils/SkBitSet.h
+++ b/src/utils/SkBitSet.h
@@ -55,7 +55,7 @@
unsigned int index = i * 32;
for (unsigned int j = 0; j < 32; ++j) {
if (0x1 & (value >> j)) {
- array->push(index + j);
+ array->push_back(index + j);
}
}
}