aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPaint.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-11 10:27:40 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-11 14:49:31 +0000
commitb99beddc7a0f6003d6dd88119e7f2734fc508322 (patch)
tree0b213528a3741e155c48c74a881af5c4c52b4a10 /src/core/SkPaint.cpp
parent327290fcafab2e702c839da8f3b7b29428294ea2 (diff)
Add serialize + catalog api to SkTextBlob
Bug: skia:6836 Change-Id: I858cf936b015c14f12a41a4912e19bb15de8abaa Reviewed-on: https://skia-review.googlesource.com/21730 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core/SkPaint.cpp')
-rw-r--r--src/core/SkPaint.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index dcd29d6100..58f132d6d1 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1861,8 +1861,15 @@ static FlatFlags unpack_paint_flags(SkPaint* paint, uint32_t packed) {
it if there are not tricky elements like shaders, etc.
*/
void SkPaint::flatten(SkWriteBuffer& buffer) const {
+ // If the writer is xprocess, then we force recording our typeface, even if its "default"
+ // since the other process may have a different notion of default.
+ SkTypeface* tf = this->getTypeface();
+ if (!tf && buffer.isCrossProcess()) {
+ tf = SkTypeface::GetDefaultTypeface(SkTypeface::kNormal);
+ }
+
uint8_t flatFlags = 0;
- if (this->getTypeface()) {
+ if (tf) {
flatFlags |= kHasTypeface_FlatFlag;
}
if (asint(this->getPathEffect()) |
@@ -1891,7 +1898,7 @@ void SkPaint::flatten(SkWriteBuffer& buffer) const {
// now we're done with ptr and the (pre)reserved space. If we need to write
// additional fields, use the buffer directly
if (flatFlags & kHasTypeface_FlatFlag) {
- buffer.writeTypeface(this->getTypeface());
+ buffer.writeTypeface(tf);
}
if (flatFlags & kHasEffects_FlatFlag) {
buffer.writeFlattenable(this->getPathEffect());