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

Side by Side Diff: src/fonts/SkRandomScalerContext.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 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
« no previous file with comments | « src/fonts/SkRandomScalerContext.h ('k') | src/pdf/SkPDFFont.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkRandomScalerContext.h" 8 #include "SkRandomScalerContext.h"
9 #include "SkGlyph.h" 9 #include "SkGlyph.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 void SkRandomScalerContext::generateFontMetrics(SkPaint::FontMetrics* metrics) { 185 void SkRandomScalerContext::generateFontMetrics(SkPaint::FontMetrics* metrics) {
186 fProxy->getFontMetrics(metrics); 186 fProxy->getFontMetrics(metrics);
187 } 187 }
188 188
189 /////////////////////////////////////////////////////////////////////////////// 189 ///////////////////////////////////////////////////////////////////////////////
190 190
191 #include "SkTypefaceCache.h" 191 #include "SkTypefaceCache.h"
192 192
193 SkRandomTypeface::SkRandomTypeface(SkTypeface* proxy, const SkPaint& paint, bool fakeIt) 193 SkRandomTypeface::SkRandomTypeface(sk_sp<SkTypeface> proxy, const SkPaint& paint , bool fakeIt)
194 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) 194 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false)
195 , fProxy(SkRef(proxy)) 195 , fProxy(std::move(proxy))
196 , fPaint(paint) 196 , fPaint(paint)
197 , fFakeIt(fakeIt) {} 197 , fFakeIt(fakeIt) {}
198 198
199 SkRandomTypeface::~SkRandomTypeface() {
200 fProxy->unref();
201 }
202
203 SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEf fects& effects, 199 SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEf fects& effects,
204 const SkDescriptor* des c) const { 200 const SkDescriptor* des c) const {
205 return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), effect s, desc, fFakeIt); 201 return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), effect s, desc, fFakeIt);
206 } 202 }
207 203
208 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const { 204 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const {
209 fProxy->filterRec(rec); 205 fProxy->filterRec(rec);
210 rec->setHinting(SkPaint::kNo_Hinting); 206 rec->setHinting(SkPaint::kNo_Hinting);
211 rec->fMaskFormat = SkMask::kARGB32_Format; 207 rec->fMaskFormat = SkMask::kARGB32_Format;
212 } 208 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 246
251 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const { 247 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const {
252 return fProxy->getTableTags(tags); 248 return fProxy->getTableTags(tags);
253 } 249 }
254 250
255 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset, 251 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
256 size_t length, void* data) const { 252 size_t length, void* data) const {
257 return fProxy->getTableData(tag, offset, length, data); 253 return fProxy->getTableData(tag, offset, length, data);
258 } 254 }
259 255
OLDNEW
« no previous file with comments | « src/fonts/SkRandomScalerContext.h ('k') | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698