Remove SkWriter32::contiguousArray().
authormtklein <mtklein@chromium.org>
Fri, 29 Apr 2016 21:45:36 +0000 (14:45 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 29 Apr 2016 21:45:36 +0000 (14:45 -0700)
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

include/core/SkWriter32.h
src/core/SkPicture.cpp
src/core/SkPictureData.cpp
src/core/SkPictureData.h
src/core/SkPictureRecord.h
src/core/SkRecordedDrawable.cpp
tests/Writer32Test.cpp

index 26388cd..a5ecb3f 100644 (file)
@@ -51,12 +51,6 @@ public:
         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);
index dfedd14..94c1395 100644 (file)
@@ -181,7 +181,7 @@ SkPictureData* SkPicture::backport() const {
     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 {
index 4de1cc3..43e0793 100644 (file)
@@ -34,13 +34,12 @@ void SkPictureData::initForPlayback() 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);
 
index 4870305..78ca25d 100644 (file)
@@ -60,7 +60,7 @@ struct SkPictInfo {
 
 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&,
index 59bd92d..8504c00 100644 (file)
@@ -47,17 +47,12 @@ public:
         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();
     }
 
index 9b5874f..3bbef83 100644 (file)
@@ -77,7 +77,7 @@ void SkRecordedDrawable::flatten(SkWriteBuffer& buffer) const {
     pictureRecord.endRecording();
 
     // Flatten the recorded commands and drawables.
-    SkPictureData pictureData(pictureRecord, info, false);
+    SkPictureData pictureData(pictureRecord, info);
     pictureData.flatten(buffer);
 }
 
index 5c24259..ac932e1 100644 (file)
@@ -232,19 +232,6 @@ DEF_TEST(Writer32_dynamic, reporter) {
     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);