Revert "migrating SkTDArray towards std::vector api"

This reverts commit 79884be809.

Reason for revert: broke flutter build -- initializer_list?

Original change's description:
> migrating SkTDArray towards std::vector api
> 
> push -> push_back
> add some aliases to match std::vector: count, reserve, ...
> 
> Bug: skia:
> Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
> Reviewed-on: https://skia-review.googlesource.com/145884
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com

Change-Id: Ib6132b725aaed7c01287e3e8c2b5a14da3d3d7e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/146140
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-08-08 15:14:28 +00:00 committed by Skia Commit-Bot
parent 79884be809
commit f9ecb4e67e
30 changed files with 112 additions and 124 deletions

View File

@ -1269,9 +1269,9 @@ static void gather_tests() {
continue;
}
if (test.needsGpu && FLAGS_gpu) {
(FLAGS_gpu_threading ? gParallelTests : gSerialTests).push_back(test);
(FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test);
} else if (!test.needsGpu && FLAGS_cpu) {
gParallelTests.push_back(test);
gParallelTests.push(test);
}
}
}

View File

@ -559,7 +559,7 @@ bool SkSVGAttributeParser::parsePoints(SkSVGPointsType* points) {
break;
}
pts.push_back(SkPoint::Make(x, y));
pts.push(SkPoint::Make(x, y));
parsedValue = true;
}
@ -636,7 +636,7 @@ bool SkSVGAttributeParser::parseDashArray(SkSVGDashArray* dashArray) {
break;
}
dashes.push_back(dash);
dashes.push(dash);
parsedValue = true;
}

View File

@ -70,7 +70,7 @@ SkMessageBus<Message>::Inbox::Inbox(uint32_t uniqueID) : fUniqueID(uniqueID) {
// Register ourselves with the corresponding message bus.
SkMessageBus<Message>* bus = SkMessageBus<Message>::Get();
SkAutoMutexAcquire lock(bus->fInboxesMutex);
bus->fInboxes.push_back(this);
bus->fInboxes.push(this);
}
template<typename Message>

View File

@ -29,7 +29,6 @@ public:
fReserve = fCount = count;
}
}
SkTDArray(const std::initializer_list<T>& list) : SkTDArray(list.begin(), list.size()) {}
SkTDArray(const SkTDArray<T>& src) : fArray(nullptr), fReserve(0), fCount(0) {
SkTDArray<T> tmp(src.fArray, src.fCount);
this->swap(tmp);
@ -78,13 +77,11 @@ public:
}
bool isEmpty() const { return fCount == 0; }
bool empty() const { return this->isEmpty(); }
/**
* Return the number of elements in the array
*/
int count() const { return fCount; }
size_t size() const { return fCount; }
/**
* Return the total number of elements allocated.
@ -98,12 +95,10 @@ public:
*/
size_t bytes() const { return fCount * sizeof(T); }
T* begin() { return fArray; }
T* begin() { return fArray; }
const T* begin() const { return fArray; }
const T* cbegin() const { return fArray; }
T* end() { return fArray ? fArray + fCount : nullptr; }
T* end() { return fArray ? fArray + fCount : nullptr; }
const T* end() const { return fArray ? fArray + fCount : nullptr; }
const T* cend() const { return fArray ? fArray + fCount : nullptr; }
T& operator[](int index) {
SkASSERT(index < fCount);
@ -156,10 +151,6 @@ public:
this->resizeStorageToAtLeast(reserve);
}
}
void reserve(size_t n) {
SkASSERT_RELEASE(SkTFitsIn<int>(n));
this->setReserve(SkToInt(n));
}
T* prepend() {
this->adjustCount(1);
@ -272,16 +263,13 @@ public:
}
// routines to treat the array like a stack
void push_back(const T& v) { *this->append() = v; }
T* push() { return this->append(); }
T* push() { return this->append(); }
void push(const T& elem) { *this->append() = elem; }
const T& top() const { return (*this)[fCount - 1]; }
T& top() { return (*this)[fCount - 1]; }
void pop(T* elem) { SkASSERT(fCount > 0); if (elem) *elem = (*this)[fCount - 1]; --fCount; }
void pop() { SkASSERT(fCount > 0); --fCount; }
// DEPRECATED -- update call-sites to remove
void push(const T& v) { this->push_back(v); }
void deleteAll() {
T* iter = fArray;
T* stop = fArray + fCount;

View File

@ -25,7 +25,7 @@ void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) {
ctm.mapRect(rect.writable());
}
fRects.push_back(*rect);
fRects.push(*rect);
fBounds.join(*rect);
}

View File

@ -63,7 +63,7 @@ void Node::observeInval(const sk_sp<Node>& node) {
auto observers = new SkTDArray<Node*>();
observers->setReserve(2);
observers->push_back(node->fInvalObserver);
observers->push(node->fInvalObserver);
node->fInvalObserverArray = observers;
node->fFlags |= kObserverArray_Flag;
@ -72,7 +72,7 @@ void Node::observeInval(const sk_sp<Node>& node) {
// No duplicate observers.
SkASSERT(node->fInvalObserverArray->find(this) < 0);
node->fInvalObserverArray->push_back(this);
node->fInvalObserverArray->push(this);
}
void Node::unobserveInval(const sk_sp<Node>& node) {

View File

@ -127,7 +127,7 @@ void SkEdgeBuilder::addLine(const SkPoint pts[]) {
if (fEdgeType == kBezier) {
SkLine* line = fAlloc.make<SkLine>();
if (line->set(pts)) {
fList.push_back(line);
fList.push(line);
}
} else if (fEdgeType == kAnalyticEdge) {
SkAnalyticEdge* edge = fAlloc.make<SkAnalyticEdge>();
@ -141,7 +141,7 @@ void SkEdgeBuilder::addLine(const SkPoint pts[]) {
goto unallocate_analytic_edge;
}
}
fList.push_back(edge);
fList.push(edge);
} else {
unallocate_analytic_edge:
;
@ -159,7 +159,7 @@ unallocate_analytic_edge:
goto unallocate_edge;
}
}
fList.push_back(edge);
fList.push(edge);
} else {
unallocate_edge:
;
@ -172,19 +172,19 @@ void SkEdgeBuilder::addQuad(const SkPoint pts[]) {
if (fEdgeType == kBezier) {
SkQuad* quad = fAlloc.make<SkQuad>();
if (quad->set(pts)) {
fList.push_back(quad);
fList.push(quad);
}
} else if (fEdgeType == kAnalyticEdge) {
SkAnalyticQuadraticEdge* edge = fAlloc.make<SkAnalyticQuadraticEdge>();
if (edge->setQuadratic(pts)) {
fList.push_back(edge);
fList.push(edge);
} else {
// TODO: unallocate edge from storage...
}
} else {
SkQuadraticEdge* edge = fAlloc.make<SkQuadraticEdge>();
if (edge->setQuadratic(pts, fShiftUp)) {
fList.push_back(edge);
fList.push(edge);
} else {
// TODO: unallocate edge from storage...
}
@ -195,19 +195,19 @@ void SkEdgeBuilder::addCubic(const SkPoint pts[]) {
if (fEdgeType == kBezier) {
SkCubic* cubic = fAlloc.make<SkCubic>();
if (cubic->set(pts)) {
fList.push_back(cubic);
fList.push(cubic);
}
} else if (fEdgeType == kAnalyticEdge) {
SkAnalyticCubicEdge* edge = fAlloc.make<SkAnalyticCubicEdge>();
if (edge->setCubic(pts)) {
fList.push_back(edge);
fList.push(edge);
} else {
// TODO: unallocate edge from storage...
}
} else {
SkCubicEdge* edge = fAlloc.make<SkCubicEdge>();
if (edge->setCubic(pts, fShiftUp)) {
fList.push_back(edge);
fList.push(edge);
} else {
// TODO: unallocate edge from storage...
}

View File

@ -3077,7 +3077,7 @@ static void tangent_cubic(const SkPoint pts[], SkScalar x, SkScalar y,
}
SkVector tangent;
SkEvalCubicAt(c, t, nullptr, &tangent, nullptr);
tangents->push_back(tangent);
tangents->push(tangent);
}
}
@ -3104,7 +3104,7 @@ static void tangent_conic(const SkPoint pts[], SkScalar x, SkScalar y, SkScalar
continue;
}
SkConic conic(pts, w);
tangents->push_back(conic.evalTangentAt(t));
tangents->push(conic.evalTangentAt(t));
}
}
@ -3130,7 +3130,7 @@ static void tangent_quad(const SkPoint pts[], SkScalar x, SkScalar y,
if (!SkScalarNearlyEqual(x, xt)) {
continue;
}
tangents->push_back(SkEvalQuadTangentAt(pts, t));
tangents->push(SkEvalQuadTangentAt(pts, t));
}
}
@ -3153,7 +3153,7 @@ static void tangent_line(const SkPoint pts[], SkScalar x, SkScalar y,
}
SkVector v;
v.set(dx, dy);
tangents->push_back(v);
tangents->push(v);
}
static bool contains_inclusive(const SkRect& r, SkScalar x, SkScalar y) {

View File

@ -47,7 +47,7 @@ void SkPictureRecord::onFlush() {
void SkPictureRecord::willSave() {
// record the offset to us, making it non-positive to distinguish a save
// from a clip entry.
fRestoreOffsetStack.push_back(-(int32_t)fWriter.bytesWritten());
fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten());
this->recordSave();
this->INHERITED::willSave();
@ -64,7 +64,7 @@ void SkPictureRecord::recordSave() {
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_back(-(int32_t)fWriter.bytesWritten());
fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten());
this->recordSaveLayer(rec);
(void)this->INHERITED::getSaveLayerStrategy(rec);

View File

@ -172,7 +172,7 @@ void SkRTree::search(Node* node, const SkRect& query, SkTDArray<int>* results) c
for (int i = 0; i < node->fNumChildren; ++i) {
if (SkRect::Intersects(node->fChildren[i].fBounds, query)) {
if (0 == node->fLevel) {
results->push_back(node->fChildren[i].fOpIndex);
results->push(node->fChildren[i].fOpIndex);
} else {
this->search(node->fChildren[i].fSubtree, query, results);
}

View File

@ -169,7 +169,7 @@ public:
fCTM = SkMatrix::I();
// We push an extra save block to track the bounds of any top-level control operations.
fSaveStack.push_back({ 0, Bounds::MakeEmpty(), nullptr, fCTM });
fSaveStack.push({ 0, Bounds::MakeEmpty(), nullptr, fCTM });
}
void cleanUp() {
@ -275,7 +275,7 @@ private:
sb.paint = paint;
sb.ctm = this->fCTM;
fSaveStack.push_back(sb);
fSaveStack.push(sb);
this->pushControl();
}
@ -329,7 +329,7 @@ private:
}
void pushControl() {
fControlIndices.push_back(fCurrentOp);
fControlIndices.push(fCurrentOp);
if (!fSaveStack.isEmpty()) {
fSaveStack.top().controlOps++;
}

View File

@ -451,10 +451,10 @@ bool GrAAConvexTessellator::extractFromPath(const SkMatrix& m, const SkPath& pat
SkASSERT(SkScalarNearlyEqual(1.0f, fNorms[cur].length()));
}
fNorms.push_back(SkPoint::Make(-fNorms[0].fX, -fNorms[0].fY));
fNorms.push(SkPoint::Make(-fNorms[0].fX, -fNorms[0].fY));
// we won't actually use the bisectors, so just push zeroes
fBisectors.push_back(SkPoint::Make(0.0, 0.0));
fBisectors.push_back(SkPoint::Make(0.0, 0.0));
fBisectors.push(SkPoint::Make(0.0, 0.0));
fBisectors.push(SkPoint::Make(0.0, 0.0));
} else {
return false;
}

View File

@ -308,16 +308,16 @@ void GrVkPipelineState::writeSamplers(GrVkGpu* gpu, const SamplerBindings bindin
const GrSamplerState& state = bindings[i].fState;
GrVkTexture* texture = bindings[i].fTexture;
fSamplers.push_back(gpu->resourceProvider().findOrCreateCompatibleSampler(
fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(
state, texture->texturePriv().maxMipMapLevel()));
const GrVkResource* textureResource = texture->resource();
textureResource->ref();
fTextures.push_back(textureResource);
fTextures.push(textureResource);
const GrVkImageView* textureView = texture->textureView();
textureView->ref();
fTextureViews.push_back(textureView);
fTextureViews.push(textureView);
VkDescriptorImageInfo imageInfo;
memset(&imageInfo, 0, sizeof(VkDescriptorImageInfo));

View File

@ -97,8 +97,8 @@ void SkPathWriter::finishContour() {
this->close();
} else {
SkASSERT(fDefer[1]);
fEndPtTs.push_back(fFirstPtT);
fEndPtTs.push_back(fDefer[1]);
fEndPtTs.push(fFirstPtT);
fEndPtTs.push(fDefer[1]);
fPartials.push_back(fCurrent);
this->init();
}

View File

@ -1464,7 +1464,7 @@ sk_sp<SkPDFDict> SkPDFDevice::makeResourceDict() const {
SkTDArray<SkPDFObject*> fonts;
fonts.setReserve(fFontResources.count());
for (SkPDFFont* font : fFontResources) {
fonts.push_back(font);
fonts.push(font);
}
return SkPDFResourceDict::Make(
&fGraphicStateResources,
@ -1900,7 +1900,7 @@ void SkPDFDevice::populateGraphicStateEntryFromPaint(
int resourceIndex = fShaderResources.find(pdfShader.get());
if (resourceIndex < 0) {
resourceIndex = fShaderResources.count();
fShaderResources.push_back(pdfShader.get());
fShaderResources.push(pdfShader.get());
pdfShader.get()->ref();
}
entry->fShaderIndex = resourceIndex;
@ -1933,7 +1933,7 @@ int SkPDFDevice::addGraphicStateResource(SkPDFObject* gs) {
int result = fGraphicStateResources.find(gs);
if (result < 0) {
result = fGraphicStateResources.count();
fGraphicStateResources.push_back(gs);
fGraphicStateResources.push(gs);
gs->ref();
}
return result;
@ -1946,7 +1946,7 @@ int SkPDFDevice::addXObjectResource(SkPDFObject* xObject) {
int result = fXObjectResources.find(xObject);
if (result < 0) {
result = fXObjectResources.count();
fXObjectResources.push_back(SkRef(xObject));
fXObjectResources.push(SkRef(xObject));
}
return result;
}
@ -1960,7 +1960,7 @@ int SkPDFDevice::getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID) {
if (resourceIndex < 0) {
fDocument->registerFont(newFont.get());
resourceIndex = fFontResources.count();
fFontResources.push_back(newFont.release());
fFontResources.push(newFont.release());
}
return resourceIndex;
}

View File

@ -61,7 +61,7 @@ void SkPDFObjectSerializer::serializeObjects(SkWStream* wStream) {
// 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_back(this->offset(wStream));
fOffsets.push(this->offset(wStream));
wStream->writeDecAsText(index);
wStream->writeText(" 0 obj\n"); // Generation number is always 0.
object->emitObject(wStream, fObjNumMap);

View File

@ -351,7 +351,7 @@ static sk_sp<SkPDFStream> get_subset_font_stream(
// TODO(halcanary): sfntly should take a more compact format.
SkTDArray<unsigned> subset;
if (!glyphUsage.has(0)) {
subset.push_back(0); // Always include glyph 0.
subset.push(0); // Always include glyph 0.
}
glyphUsage.exportTo(&subset);

View File

@ -791,11 +791,11 @@ static sk_sp<SkPDFDict> get_gradient_resource_dict(SkPDFObject* functionShader,
SkPDFObject* gState) {
SkTDArray<SkPDFObject*> patterns;
if (functionShader) {
patterns.push_back(functionShader);
patterns.push(functionShader);
}
SkTDArray<SkPDFObject*> graphicStates;
if (gState) {
graphicStates.push_back(gState);
graphicStates.push(gState);
}
return SkPDFResourceDict::Make(&graphicStates, &patterns, nullptr, nullptr);
}

View File

@ -182,7 +182,7 @@ void SkPDFAppendCmapSections(const SkUnichar* glyphToUnicode,
currentRangeEntry.fUnicode + i - currentRangeEntry.fStart;
if (!inSubset || !inRange) {
if (currentRangeEntry.fEnd > currentRangeEntry.fStart) {
bfrangeEntries.push_back(currentRangeEntry);
bfrangeEntries.push(currentRangeEntry);
} else {
BFChar* entry = bfcharEntries.append();
entry->fGlyphId = currentRangeEntry.fStart;

View File

@ -556,7 +556,7 @@ static void XMLCALL start_element_handler(void *data, const char *tag, const cha
if (child->start) {
child->start(self, tag, attributes);
}
self->fHandler.push_back(child);
self->fHandler.push(child);
XML_SetCharacterDataHandler(self->fParser, child->chars);
} else {
SK_FONTCONFIGPARSER_WARNING("'%s' tag not recognized, skipping", tag);

View File

@ -55,7 +55,7 @@ public:
unsigned int index = i * 32;
for (unsigned int j = 0; j < 32; ++j) {
if (0x1 & (value >> j)) {
array->push_back(index + j);
array->push(index + j);
}
}
}

View File

@ -61,8 +61,8 @@ DEF_GPUTEST(GpuRectanizer, reporter, factory) {
SkRandom rand;
for (int i = 0; i < 50; i++) {
rects.push_back(SkISize::Make(rand.nextRangeU(1, kWidth / 2),
rand.nextRangeU(1, kHeight / 2)));
rects.push(SkISize::Make(rand.nextRangeU(1, kWidth / 2),
rand.nextRangeU(1, kHeight / 2)));
}
test_skyline(reporter, rects);

View File

@ -281,7 +281,7 @@ public:
}
if (!header) {
fOps.push_back({opListID, nullptr});
fOps.push({opListID, nullptr});
header = &(fOps[fOps.count()-1]);
}
@ -334,7 +334,7 @@ public:
SkTDArray<LinkedListHeader*> lists;
for (int i = 0; i < numOpListIDs; ++i) {
if (LinkedListHeader* list = this->getList(opListIDs[i])) {
lists.push_back(list);
lists.push(list);
}
}

View File

@ -39,41 +39,41 @@ DEF_TEST(SkPDF_ToUnicode, reporter) {
SkTDArray<uint16_t> glyphsInSubset;
SkBitSet subset(kMaximumGlyphCount);
glyphToUnicode.push_back(0); // 0
glyphToUnicode.push_back(0); // 1
glyphToUnicode.push_back(0); // 2
glyphsInSubset.push_back(3);
glyphToUnicode.push_back(0x20); // 3
glyphsInSubset.push_back(4);
glyphToUnicode.push_back(0x25); // 4
glyphsInSubset.push_back(5);
glyphToUnicode.push_back(0x27); // 5
glyphsInSubset.push_back(6);
glyphToUnicode.push_back(0x28); // 6
glyphsInSubset.push_back(7);
glyphToUnicode.push_back(0x29); // 7
glyphsInSubset.push_back(8);
glyphToUnicode.push_back(0x2F); // 8
glyphsInSubset.push_back(9);
glyphToUnicode.push_back(0x33); // 9
glyphToUnicode.push_back(0); // 10
glyphsInSubset.push_back(11);
glyphToUnicode.push_back(0x35); // 11
glyphsInSubset.push_back(12);
glyphToUnicode.push_back(0x36); // 12
glyphsInSubset.push_back(13);
glyphToUnicode.push_back(0x37); // 13
glyphToUnicode.push(0); // 0
glyphToUnicode.push(0); // 1
glyphToUnicode.push(0); // 2
glyphsInSubset.push(3);
glyphToUnicode.push(0x20); // 3
glyphsInSubset.push(4);
glyphToUnicode.push(0x25); // 4
glyphsInSubset.push(5);
glyphToUnicode.push(0x27); // 5
glyphsInSubset.push(6);
glyphToUnicode.push(0x28); // 6
glyphsInSubset.push(7);
glyphToUnicode.push(0x29); // 7
glyphsInSubset.push(8);
glyphToUnicode.push(0x2F); // 8
glyphsInSubset.push(9);
glyphToUnicode.push(0x33); // 9
glyphToUnicode.push(0); // 10
glyphsInSubset.push(11);
glyphToUnicode.push(0x35); // 11
glyphsInSubset.push(12);
glyphToUnicode.push(0x36); // 12
glyphsInSubset.push(13);
glyphToUnicode.push(0x37); // 13
for (uint16_t i = 14; i < 0xFE; ++i) {
glyphToUnicode.push_back(0); // Zero from index 0x9 to 0xFD
glyphToUnicode.push(0); // Zero from index 0x9 to 0xFD
}
glyphsInSubset.push_back(0xFE);
glyphToUnicode.push_back(0x1010);
glyphsInSubset.push_back(0xFF);
glyphToUnicode.push_back(0x1011);
glyphsInSubset.push_back(0x100);
glyphToUnicode.push_back(0x1012);
glyphsInSubset.push_back(0x101);
glyphToUnicode.push_back(0x1013);
glyphsInSubset.push(0xFE);
glyphToUnicode.push(0x1010);
glyphsInSubset.push(0xFF);
glyphToUnicode.push(0x1011);
glyphsInSubset.push(0x100);
glyphToUnicode.push(0x1012);
glyphsInSubset.push(0x101);
glyphToUnicode.push(0x1013);
SkGlyphID lastGlyphID = SkToU16(glyphToUnicode.count() - 1);
@ -160,16 +160,16 @@ endbfrange\n";
// Glyph id 2c 51 56 57 44 4f
// Unicode 49 6e 73 74 61 6c
for (SkUnichar i = 0; i < 100; ++i) {
glyphToUnicode.push_back(i + 29);
glyphToUnicode.push(i + 29);
}
lastGlyphID = SkToU16(glyphToUnicode.count() - 1);
glyphsInSubset.push_back(0x2C);
glyphsInSubset.push_back(0x44);
glyphsInSubset.push_back(0x4F);
glyphsInSubset.push_back(0x51);
glyphsInSubset.push_back(0x56);
glyphsInSubset.push_back(0x57);
glyphsInSubset.push(0x2C);
glyphsInSubset.push(0x44);
glyphsInSubset.push(0x4F);
glyphsInSubset.push(0x51);
glyphsInSubset.push(0x56);
glyphsInSubset.push(0x57);
SkDynamicMemoryWStream buffer2;
subset2.setAll(glyphsInSubset.begin(), glyphsInSubset.count());

View File

@ -30,7 +30,7 @@ static bool verify_query(SkRect query, SkRect rects[], SkTDArray<int>& found) {
// manually intersect with every rectangle
for (int i = 0; i < NUM_RECTS; ++i) {
if (SkRect::Intersects(query, rects[i])) {
expected.push_back(i);
expected.push(i);
}
}

View File

@ -84,7 +84,7 @@ SkDebugCanvas::~SkDebugCanvas() {
}
void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) {
fCommandVector.push_back(command);
fCommandVector.push(command);
}
void SkDebugCanvas::draw(SkCanvas* canvas) {

View File

@ -253,7 +253,7 @@ void SkCommandLineFlags::Parse(int argc, const char* const * argv) {
SkTDArray<SkFlagInfo*> allFlags;
for (SkFlagInfo* flag = SkCommandLineFlags::gHead; flag;
flag = flag->next()) {
allFlags.push_back(flag);
allFlags.push(flag);
}
SkTQSort(&allFlags[0], &allFlags[allFlags.count() - 1],
CompareFlagsByName());

View File

@ -158,7 +158,7 @@ public:
void pushLayer(Layer* layer) {
layer->onAttach(this);
fLayers.push_back(layer);
fLayers.push(layer);
}
void onBackendCreated();

View File

@ -183,14 +183,14 @@ struct DiffSummary {
uint32_t mismatchValue;
if (drp->fBase.fFilename.equals(drp->fComparison.fFilename)) {
fResultsOfType[drp->fResult].push_back(new SkString(drp->fBase.fFilename));
fResultsOfType[drp->fResult].push(new SkString(drp->fBase.fFilename));
} else {
SkString* blame = new SkString("(");
blame->append(drp->fBase.fFilename);
blame->append(", ");
blame->append(drp->fComparison.fFilename);
blame->append(")");
fResultsOfType[drp->fResult].push_back(blame);
fResultsOfType[drp->fResult].push(blame);
}
switch (drp->fResult) {
case DiffRecord::kEqualBits_Result:
@ -215,7 +215,7 @@ struct DiffSummary {
break;
case DiffRecord::kCouldNotCompare_Result:
fNumMismatches++;
fStatusOfType[drp->fBase.fStatus][drp->fComparison.fStatus].push_back(
fStatusOfType[drp->fBase.fStatus][drp->fComparison.fStatus].push(
new SkString(drp->fBase.fFilename));
break;
case DiffRecord::kUnknown_Result:
@ -274,7 +274,7 @@ static void get_file_list_subdir(const SkString& rootDir, const SkString& subDir
pathRelativeToRootDir.append(fileName);
if (string_contains_any_of(pathRelativeToRootDir, matchSubstrings) &&
!string_contains_any_of(pathRelativeToRootDir, nomatchSubstrings)) {
files->push_back(new SkString(pathRelativeToRootDir));
files->push(new SkString(pathRelativeToRootDir));
}
}
@ -516,7 +516,7 @@ static void create_diff_images (DiffMetricProc dmp,
get_bounds(*drp);
}
SkASSERT(DiffRecord::kUnknown_Result != drp->fResult);
differences->push_back(drp);
differences->push(drp);
summary->add(drp);
}
@ -537,7 +537,7 @@ static void create_diff_images (DiffMetricProc dmp,
if (getBounds) {
get_bounds(*drp);
}
differences->push_back(drp);
differences->push(drp);
summary->add(drp);
}
@ -558,7 +558,7 @@ static void create_diff_images (DiffMetricProc dmp,
if (getBounds) {
get_bounds(*drp);
}
differences->push_back(drp);
differences->push(drp);
summary->add(drp);
}
@ -705,7 +705,7 @@ int main(int argc, char** argv) {
continue;
}
if (!strcmp(argv[i], "--match")) {
matchSubstrings.push_back(new SkString(argv[++i]));
matchSubstrings.push(new SkString(argv[++i]));
continue;
}
if (!strcmp(argv[i], "--nocolorspace")) {
@ -717,7 +717,7 @@ int main(int argc, char** argv) {
continue;
}
if (!strcmp(argv[i], "--nomatch")) {
nomatchSubstrings.push_back(new SkString(argv[++i]));
nomatchSubstrings.push(new SkString(argv[++i]));
continue;
}
if (!strcmp(argv[i], "--noprintdirs")) {
@ -809,7 +809,7 @@ int main(int argc, char** argv) {
// If no matchSubstrings were specified, match ALL strings
// (except for whatever nomatchSubstrings were specified, if any).
if (matchSubstrings.isEmpty()) {
matchSubstrings.push_back(new SkString(""));
matchSubstrings.push(new SkString(""));
}
create_diff_images(diffProc, colorThreshold, ignoreColorSpace, &differences,

View File

@ -124,9 +124,9 @@ void ImGuiLayer::onPaint(SkCanvas* canvas) {
pos.rewind(); uv.rewind(); color.rewind();
for (int i = 0; i < drawList->VtxBuffer.size(); ++i) {
const ImDrawVert& vert = drawList->VtxBuffer[i];
pos.push_back(SkPoint::Make(vert.pos.x, vert.pos.y));
uv.push_back(SkPoint::Make(vert.uv.x, vert.uv.y));
color.push_back(vert.col);
pos.push(SkPoint::Make(vert.pos.x, vert.pos.y));
uv.push(SkPoint::Make(vert.uv.x, vert.uv.y));
color.push(vert.col);
}
// ImGui colors are RGBA
SkSwapRB(color.begin(), color.begin(), color.count());