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

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

Issue 21053009: Upstream changes from Android (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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 | « include/core/SkPaintOptionsAndroid.h ('k') | src/images/SkMovie_gif.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 2006 The Android Open Source Project 3 * Copyright 2006 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 9
10 #include "SkScalerContext.h" 10 #include "SkScalerContext.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkDescriptor.h" 12 #include "SkDescriptor.h"
13 #include "SkDraw.h" 13 #include "SkDraw.h"
14 #include "SkFontHost.h" 14 #include "SkFontHost.h"
15 #include "SkGlyph.h" 15 #include "SkGlyph.h"
16 #include "SkMaskFilter.h" 16 #include "SkMaskFilter.h"
17 #include "SkMaskGamma.h" 17 #include "SkMaskGamma.h"
18 #include "SkOrderedReadBuffer.h" 18 #include "SkOrderedReadBuffer.h"
19 #include "SkOrderedWriteBuffer.h"
19 #include "SkPathEffect.h" 20 #include "SkPathEffect.h"
20 #include "SkRasterizer.h" 21 #include "SkRasterizer.h"
21 #include "SkRasterClip.h" 22 #include "SkRasterClip.h"
22 #include "SkStroke.h" 23 #include "SkStroke.h"
23 #include "SkThread.h" 24 #include "SkThread.h"
24 25
25 #ifdef SK_BUILD_FOR_ANDROID 26 #ifdef SK_BUILD_FOR_ANDROID
26 #include "SkTypeface_android.h" 27 #include "SkTypeface_android.h"
27 #endif 28 #endif
28 29
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 SkTypeface* newFace = SkAndroidNextLogicalTypeface(fRec.fFontID, 137 SkTypeface* newFace = SkAndroidNextLogicalTypeface(fRec.fFontID,
137 fRec.fOrigFontID, 138 fRec.fOrigFontID,
138 fPaintOptionsAndroid); 139 fPaintOptionsAndroid);
139 if (0 == newFace) { 140 if (0 == newFace) {
140 return NULL; 141 return NULL;
141 } 142 }
142 143
143 SkAutoTUnref<SkTypeface> aur(newFace); 144 SkAutoTUnref<SkTypeface> aur(newFace);
144 uint32_t newFontID = newFace->uniqueID(); 145 uint32_t newFontID = newFace->uniqueID();
145 146
146 SkAutoDescriptor ad(sizeof(fRec) + SkDescriptor::ComputeOverhead(1)); 147 SkOrderedWriteBuffer androidBuffer(128);
148 fPaintOptionsAndroid.flatten(androidBuffer);
149
150 SkAutoDescriptor ad(sizeof(fRec) + androidBuffer.size() + SkDescriptor::C omputeOverhead(2));
147 SkDescriptor* desc = ad.getDesc(); 151 SkDescriptor* desc = ad.getDesc();
148 152
149 desc->init(); 153 desc->init();
150 SkScalerContext::Rec* newRec = 154 SkScalerContext::Rec* newRec =
151 (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag, 155 (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag,
152 sizeof(fRec), &fRec); 156 sizeof(fRec), &fRec);
157 androidBuffer.writeToMemory(desc->addEntry(kAndroidOpts_SkDescriptorTag,
158 androidBuffer.size(), NULL));
159
153 newRec->fFontID = newFontID; 160 newRec->fFontID = newFontID;
154 desc->computeChecksum(); 161 desc->computeChecksum();
155 162
156 return newFace->createScalerContext(desc); 163 return newFace->createScalerContext(desc);
157 #else 164 #else
158 return NULL; 165 return NULL;
159 #endif 166 #endif
160 } 167 }
161 168
162 /* Return the next context, creating it if its not already created, but return 169 /* Return the next context, creating it if its not already created, but return
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 862 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
856 bool allowFailure) const { 863 bool allowFailure) const {
857 SkScalerContext* c = this->onCreateScalerContext(desc); 864 SkScalerContext* c = this->onCreateScalerContext(desc);
858 865
859 if (!c && !allowFailure) { 866 if (!c && !allowFailure) {
860 c = SkNEW_ARGS(SkScalerContext_Empty, 867 c = SkNEW_ARGS(SkScalerContext_Empty,
861 (const_cast<SkTypeface*>(this), desc)); 868 (const_cast<SkTypeface*>(this), desc));
862 } 869 }
863 return c; 870 return c;
864 } 871 }
OLDNEW
« no previous file with comments | « include/core/SkPaintOptionsAndroid.h ('k') | src/images/SkMovie_gif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698