-
Notifications
You must be signed in to change notification settings - Fork 6k
Fixed constness of display list storage. #52705
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -237,7 +237,9 @@ class DisplayListStorage { | |||
DisplayListStorage() = default; | ||||
DisplayListStorage(DisplayListStorage&&) = default; | ||||
|
||||
uint8_t* get() const { return ptr_.get(); } | ||||
uint8_t* get() { return ptr_.get(); } | ||||
|
||||
const uint8_t* get() const { return ptr_.get(); } | ||||
|
||||
void realloc(size_t count) { | ||||
ptr_.reset(static_cast<uint8_t*>(std::realloc(ptr_.release(), count))); | ||||
|
@@ -309,6 +311,8 @@ class DisplayList : public SkRefCnt { | |||
return modifies_transparent_black_; | ||||
} | ||||
|
||||
const DisplayListStorage& GetStorage() const { return storage_; } | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a public method on DisplayList? What is it used for? The storage is supposed to be internal only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that storage is immutable there is no harm making it public. This PR was pulled out from #52715 which stores the display list. It allows people to author tools that inspect the display list. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The storage has always been immutable in practice (except for the one mutable field in it which will survive these changes because a mutable field is not disabled by a const cast) due to not being exposed. Exposing the buffer as a const pointer would not require such extensive changes and would have had the same external effect. But, I don't want to see this exposed in any case, because... The harm by making it public is to invite the concept that the data within it is meaningful in any way outside of the DL implementation itself. The implementation can and does change frequently, so the stream of data is not meaningful in any lasting (or even temporary) manner. By exposing it, it's as if we're promising reusability or meaningfulness for the data that is exposed and both of those are (while not stated in the doc comments) deliberately not supported. This is not a substitute for a serialization/readback mechanism and isn't really useful as a manual inspection tool especially in light of the fact that there exists a supported pretty printing tool for DisplayLists in engine/testing/display_list_testing.h Line 33 in 900ca9a
|
||||
|
||||
private: | ||||
DisplayList(DisplayListStorage&& ptr, | ||||
size_t byte_count, | ||||
|
@@ -324,7 +328,7 @@ class DisplayList : public SkRefCnt { | |||
|
||||
static uint32_t next_unique_id(); | ||||
|
||||
static void DisposeOps(uint8_t* ptr, uint8_t* end); | ||||
static void DisposeOps(const uint8_t* ptr, const uint8_t* end); | ||||
|
||||
const DisplayListStorage storage_; | ||||
const size_t byte_count_; | ||||
|
@@ -345,8 +349,8 @@ class DisplayList : public SkRefCnt { | |||
const sk_sp<const DlRTree> rtree_; | ||||
|
||||
void Dispatch(DlOpReceiver& ctx, | ||||
uint8_t* ptr, | ||||
uint8_t* end, | ||||
const uint8_t* ptr, | ||||
const uint8_t* end, | ||||
Culler& culler) const; | ||||
|
||||
friend class DisplayListBuilder; | ||||
|
Uh oh!
There was an error while loading. Please reload this page.