本文整理汇总了C++中SkTDArray::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ SkTDArray::insert方法的具体用法?C++ SkTDArray::insert怎么用?C++ SkTDArray::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkTDArray
的用法示例。
在下文中一共展示了SkTDArray::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFallbackFontFamilies
static void getFallbackFontFamilies(SkTDArray<FontFamily*> &fallbackFonts) {
SkTDArray<FontFamily*> vendorFonts;
parseConfigFile(FALLBACK_FONTS_FILE, fallbackFonts);
parseConfigFile(VENDOR_FONTS_FILE, vendorFonts);
// This loop inserts the vendor fallback fonts in the correct order in the
// overall fallbacks list.
int currentOrder = -1;
for (int i = 0; i < vendorFonts.count(); ++i) {
FontFamily* family = vendorFonts[i];
int order = family->order;
if (order < 0) {
if (currentOrder < 0) {
// Default case - just add it to the end of the fallback list
*fallbackFonts.append() = family;
} else {
// no order specified on this font, but we're incrementing the order
// based on an earlier order insertion request
*fallbackFonts.insert(currentOrder++) = family;
}
} else {
// Add the font into the fallback list in the specified order. Set
// currentOrder for correct placement of other fonts in the vendor list.
*fallbackFonts.insert(order) = family;
currentOrder = order + 1;
}
}
}
示例2: insert
void ActiveTrapezoids::insert(Trapezoid *t) {
Trapezoid **tp;
for (tp = fTrapezoids.begin(); tp < fTrapezoids.end(); ++tp)
if (**tp > *t)
break;
fTrapezoids.insert(tp - fTrapezoids.begin(), 1, &t);
// SHOULD VERIFY THAT ALL TRAPEZOIDS ARE PROPERLY SORTED
}
示例3: find
int SkPictureRecord::find(SkTDArray<const SkFlatRegion* >& regions, const SkRegion& region) {
SkFlatRegion* flat = SkFlatRegion::Flatten(&fHeap, region, fRegionIndex);
int index = SkTSearch<SkFlatData>((const SkFlatData**) regions.begin(),
regions.count(), (SkFlatData*) flat, sizeof(flat), &SkFlatData::Compare);
if (index >= 0) {
(void)fHeap.unalloc(flat);
return regions[index]->index();
}
index = ~index;
*regions.insert(index) = flat;
return fRegionIndex++;
}
示例4: add_name
static void add_name(const char name[], FamilyRec* family) {
SkAutoAsciiToLC tolc(name);
name = tolc.lc();
NameFamilyPair* list = gNameList.begin();
int count = gNameList.count();
int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
if (index < 0) {
list = gNameList.insert(~index);
list->construct(name, family);
}
}
示例5: setSave
void SkSVGPaint::setSave(SkSVGParser& parser) {
SkTDArray<SkString*> clips;
SkSVGPaint* walking = parser.fHead;
int index;
SkMatrix sum;
sum.reset();
while (walking != NULL) {
for (index = kInitial + 1; index < kTerminal; index++) {
SkString* lastAttr = (*walking)[index];
if (lastAttr->size() == 0)
continue;
if (index == kTransform) {
const char* str = lastAttr->c_str();
SkASSERT(strncmp(str, "matrix(", 7) == 0);
str += 6;
const char* strEnd = strrchr(str, ')');
SkASSERT(strEnd != NULL);
SkString mat(str, strEnd - str);
SkSVGParser::ConvertToArray(mat);
SkScalar values[6];
SkParse::FindScalars(mat.c_str() + 1, values, 6);
SkMatrix matrix;
matrix.reset();
matrix.setScaleX(values[0]);
matrix.setSkewY(values[1]);
matrix.setSkewX(values[2]);
matrix.setScaleY(values[3]);
matrix.setTranslateX(values[4]);
matrix.setTranslateY(values[5]);
sum.setConcat(matrix, sum);
continue;
}
if ( index == kClipPath)
*clips.insert(0) = lastAttr;
}
walking = walking->fNext;
}
if ((sum == parser.fLastTransform) == false) {
SkMatrix inverse;
bool success = parser.fLastTransform.invert(&inverse);
SkASSERT(success == true);
SkMatrix output;
output.setConcat(inverse, sum);
parser.fLastTransform = sum;
SkString outputStr;
outputStr.appendUnichar('[');
outputStr.appendScalar(output.getScaleX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getSkewX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getTranslateX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getSkewY());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getScaleY());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getTranslateY());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getPerspX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getPerspY());
outputStr.append(",1]");
parser._startElement("matrix");
parser._addAttributeLen("matrix", outputStr.c_str(), outputStr.size());
parser._endElement();
}
#if 0 // incomplete
if (parser.fTransformClips.size() > 0) {
// need to reset the clip when the 'g' scope is ended
parser._startElement("add");
const char* start = strchr(current->f_clipPath.c_str(), '#') + 1;
SkASSERT(start);
parser._addAttributeLen("use", start, strlen(start) - 1);
parser._endElement(); // clip
}
#endif
}