Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: src/core/SkPaintOptionsAndroid.cpp

Issue 24075010: We don't flatten or unflatten SkPaintOptionsAndroid. Reproduce and fix. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkPaint.cpp ('k') | tests/AndroidPaintTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 The Android Open Source Project 3 * Copyright 2012 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkPaintOptionsAndroid.h" 9 #include "SkPaintOptionsAndroid.h"
10 #include "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
11 #include "SkTDict.h" 11 #include "SkTDict.h"
12 #include "SkThread.h" 12 #include "SkThread.h"
13 #include <cstring> 13 #include <cstring>
14 14
15 #ifdef SK_BUILD_FOR_ANDROID
16
17 SkLanguage SkLanguage::getParent() const { 15 SkLanguage SkLanguage::getParent() const {
18 SkASSERT(!fTag.isEmpty()); 16 SkASSERT(!fTag.isEmpty());
19 const char* tag = fTag.c_str(); 17 const char* tag = fTag.c_str();
20 18
21 // strip off the rightmost "-.*" 19 // strip off the rightmost "-.*"
22 char* parentTagEnd = strrchr(tag, '-'); 20 const char* parentTagEnd = strrchr(tag, '-');
23 if (parentTagEnd == NULL) { 21 if (parentTagEnd == NULL) {
24 return SkLanguage(); 22 return SkLanguage();
25 } 23 }
26 size_t parentTagLen = parentTagEnd - tag; 24 size_t parentTagLen = parentTagEnd - tag;
27 return SkLanguage(tag, parentTagLen); 25 return SkLanguage(tag, parentTagLen);
28 } 26 }
29 27
30 void SkPaintOptionsAndroid::flatten(SkFlattenableWriteBuffer& buffer) const { 28 void SkPaintOptionsAndroid::flatten(SkFlattenableWriteBuffer& buffer) const {
31 buffer.writeUInt(fFontVariant); 29 buffer.writeUInt(fFontVariant);
32 buffer.writeString(fLanguage.getTag().c_str()); 30 buffer.writeString(fLanguage.getTag().c_str());
33 buffer.writeBool(fUseFontFallbacks); 31 buffer.writeBool(fUseFontFallbacks);
34 } 32 }
35 33
36 void SkPaintOptionsAndroid::unflatten(SkFlattenableReadBuffer& buffer) { 34 void SkPaintOptionsAndroid::unflatten(SkFlattenableReadBuffer& buffer) {
37 fFontVariant = (FontVariant)buffer.readUInt(); 35 fFontVariant = (FontVariant)buffer.readUInt();
38 SkString tag; 36 SkString tag;
39 buffer.readString(&tag); 37 buffer.readString(&tag);
40 fLanguage = SkLanguage(tag); 38 fLanguage = SkLanguage(tag);
41 fUseFontFallbacks = buffer.readBool(); 39 fUseFontFallbacks = buffer.readBool();
42 } 40 }
43
44 #endif
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | tests/AndroidPaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698