fValue.setReserve(length);
}
-SkPDFObject* SkPDFArray::setAt(int offset, SkPDFObject* value) {
- SkASSERT(offset < fValue.count());
- value->ref();
- fValue[offset]->unref();
- fValue[offset] = value;
- return value;
-}
-
SkPDFObject* SkPDFArray::append(SkPDFObject* value) {
SkASSERT(fValue.count() < kMaxLen);
value->ref();
*/
void reserve(int length);
- /** Returns the object at the given offset in the array.
- * @param index The index into the array to retrieve.
- */
- SkPDFObject* getAt(int index) { return fValue[index]; }
-
- /** Set the object at the given offset in the array. Ref's value.
- * @param index The index into the array to set.
- * @param value The value to add to the array.
- * @return The value argument is returned.
- */
- SkPDFObject* setAt(int index, SkPDFObject* value);
-
/** Append the object to the end of the array and increments its ref count.
* @param value The value to add to the array.
* @return The value argument is returned.
SkAutoTUnref<SkPDFInt> int0(new SkPDFInt(0));
array->append(int0.get());
SimpleCheckObjectOutput(reporter, array.get(), "[42 0.5 0]");
- SkAutoTUnref<SkPDFInt> int1(new SkPDFInt(1));
- array->setAt(0, int1.get());
- SimpleCheckObjectOutput(reporter, array.get(), "[1 0.5 0]");
SkAutoTUnref<SkPDFDict> dict(new SkPDFDict);
SimpleCheckObjectOutput(reporter, dict.get(), "<<>>");
dict->insert(n2.get(), realHalf.get());
dict->insert(n3.get(), array.get());
SimpleCheckObjectOutput(reporter, dict.get(),
- "<</n1 42\n/n2 0.5\n/n3 [1 0.5 0]>>");
+ "<</n1 42\n/n2 0.5\n/n3 [42 0.5 0]>>");
TestPDFStream(reporter);