aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-04-29 14:45:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-29 14:45:36 -0700
commit4d9ff62fa21326003cf5394cd1d16f4b4633102a (patch)
tree4747bd2d2b17d96ed17bf27066d0c7b024ffe1a7
parent221196dac99dcbb402fd79c651e2a96fd5016dba (diff)
Remove SkWriter32::contiguousArray().
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
-rw-r--r--include/core/SkWriter32.h6
-rw-r--r--src/core/SkPicture.cpp2
-rw-r--r--src/core/SkPictureData.cpp5
-rw-r--r--src/core/SkPictureData.h2
-rw-r--r--src/core/SkPictureRecord.h7
-rw-r--r--src/core/SkRecordedDrawable.cpp2
-rw-r--r--tests/Writer32Test.cpp13
7 files changed, 6 insertions, 31 deletions
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h
index 26388cd37e..a5ecb3f24a 100644
--- a/include/core/SkWriter32.h
+++ b/include/core/SkWriter32.h
@@ -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);
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index dfedd141db..94c13950db 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -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 {
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 4de1cc3cec..43e0793cfb 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -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);
diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h
index 4870305de4..78ca25d4ca 100644
--- a/src/core/SkPictureData.h
+++ b/src/core/SkPictureData.h
@@ -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&,
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 59bd92dc77..8504c00ee4 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -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();
}
diff --git a/src/core/SkRecordedDrawable.cpp b/src/core/SkRecordedDrawable.cpp
index 9b5874f927..3bbef833ae 100644
--- a/src/core/SkRecordedDrawable.cpp
+++ b/src/core/SkRecordedDrawable.cpp
@@ -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);
}
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 5c24259a62..ac932e1d29 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -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);