summaryrefslogtreecommitdiff
path: root/libs/hwui/RenderNode.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2018-12-05 13:36:20 -0800
committerJohn Reck <jreck@google.com>2018-12-05 13:38:18 -0800
commit7af5b2c65387c08b59cdcff700a7321f85912d0e (patch)
tree4439ea6ee949c1c47b636e77513c698bff70ddbd /libs/hwui/RenderNode.cpp
parentf660c012b080496eb70ea77f141f346e80bb6cfa (diff)
Fix skp on 32-bit
%d strikes again... Test: dumped skp on 32bit app Change-Id: Ica4d9e3939d0e726beb80fbf45a938b004b5eb5d
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r--libs/hwui/RenderNode.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 4a639102192f..00ce28ad196f 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -454,6 +454,9 @@ const SkPath* RenderNode::getClippedOutline(const SkRect& clipRect) const {
using StringBuffer = FatVector<char, 128>;
template <typename... T>
+// TODO:__printflike(2, 3)
+// Doesn't work because the warning doesn't understand string_view and doesn't like that
+// it's not a C-style variadic function.
static void format(StringBuffer& buffer, const std::string_view& format, T... args) {
buffer.resize(buffer.capacity());
while (1) {
@@ -468,19 +471,20 @@ static void format(StringBuffer& buffer, const std::string_view& format, T... ar
buffer.resize(needed + 1);
return;
}
- buffer.resize(buffer.size() * 2);
+ // If we're doing a heap alloc anyway might as well give it some slop
+ buffer.resize(needed + 100);
}
}
void RenderNode::markDrawStart(SkCanvas& canvas) {
StringBuffer buffer;
- format(buffer, "RenderNode(id=%d, name='%s')", uniqueId(), getName());
+ format(buffer, "RenderNode(id=%" PRId64 ", name='%s')", uniqueId(), getName());
canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr);
}
void RenderNode::markDrawEnd(SkCanvas& canvas) {
StringBuffer buffer;
- format(buffer, "/RenderNode(id=%d, name='%s')", uniqueId(), getName());
+ format(buffer, "/RenderNode(id=%" PRId64 ", name='%s')", uniqueId(), getName());
canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr);
}