This method requires SkWriter32 have a contiguous array.
It does, and I plan to keep it that way (last time we checked
it's faster), but this turns that feature back into an
implementation detail.
This feature is only used by another unused feature, deep copies of
ops arrays in SkPictureData. Kill that, kill this.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=
1932223003
Depends on https://codereview.chromium.org/
1936563002/
Only deleting API
TBR=reed@google.com
Review-Url: https://codereview.chromium.org/
1932223003
fExternal = external;
}
- // Returns the current buffer.
- // The pointer may be invalidated by any future write calls.
- const uint32_t* contiguousArray() const {
- return (uint32_t*)fData;
- }
-
// size MUST be multiple of 4
uint32_t* reserve(size_t size) {
SkASSERT(SkAlign4(size) == size);
rec.beginRecording();
this->playback(&rec);
rec.endRecording();
- return new SkPictureData(rec, info, false /*deep copy ops?*/);
+ return new SkPictureData(rec, info);
}
void SkPicture::serialize(SkWStream* stream, SkPixelSerializer* pixelSerializer) const {
}
SkPictureData::SkPictureData(const SkPictureRecord& record,
- const SkPictInfo& info,
- bool deepCopyOps)
+ const SkPictInfo& info)
: fInfo(info) {
this->init();
- fOpData = record.opData(deepCopyOps);
+ fOpData = record.opData();
fContentInfo.set(record.fContentInfo);
class SkPictureData {
public:
- SkPictureData(const SkPictureRecord& record, const SkPictInfo&, bool deepCopyOps);
+ SkPictureData(const SkPictureRecord& record, const SkPictInfo&);
// Does not affect ownership of SkStream.
static SkPictureData* CreateFromStream(SkStream*,
const SkPictInfo&,
return fImageRefs;
}
- sk_sp<SkData> opData(bool deepCopy) const {
+ sk_sp<SkData> opData() const {
this->validate(fWriter.bytesWritten(), 0);
if (fWriter.bytesWritten() == 0) {
return SkData::MakeEmpty();
}
-
- if (deepCopy) {
- return SkData::MakeWithCopy(fWriter.contiguousArray(), fWriter.bytesWritten());
- }
-
return fWriter.snapshotAsData();
}
pictureRecord.endRecording();
// Flatten the recorded commands and drawables.
- SkPictureData pictureData(pictureRecord, info, false);
+ SkPictureData pictureData(pictureRecord, info);
pictureData.flatten(buffer);
}
testOverwriteT(reporter, &writer);
}
-DEF_TEST(Writer32_contiguous, reporter) {
- uint32_t storage[256];
- SkWriter32 writer;
- writer.reset(storage, sizeof(storage));
- // This write is small enough to fit in storage, so it's contiguous.
- test1(reporter, &writer);
- REPORTER_ASSERT(reporter, writer.contiguousArray() != nullptr);
-
- // Everything other aspect of contiguous/non-contiguous is an
- // implementation detail, not part of the public contract for
- // SkWriter32, and so not tested here.
-}
-
DEF_TEST(Writer32_small, reporter) {
SkSWriter32<8 * sizeof(intptr_t)> writer;
test1(reporter, &writer);