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

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

Issue 1974783002: Revert of Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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(sk_sp<SkTypeface> proxy, const SkPaint& paint , bool fakeIt) 193 SkRandomTypeface::SkRandomTypeface(SkTypeface* proxy, const SkPaint& paint, bool fakeIt)
194 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) 194 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false)
195 , fProxy(std::move(proxy)) 195 , fProxy(SkRef(proxy))
196 , fPaint(paint) 196 , fPaint(paint)
197 , fFakeIt(fakeIt) {} 197 , fFakeIt(fakeIt) {}
198 198
199 SkRandomTypeface::~SkRandomTypeface() {
200 fProxy->unref();
201 }
202
199 SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEf fects& effects, 203 SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEf fects& effects,
200 const SkDescriptor* des c) const { 204 const SkDescriptor* des c) const {
201 return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), effect s, desc, fFakeIt); 205 return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), effect s, desc, fFakeIt);
202 } 206 }
203 207
204 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const { 208 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const {
205 fProxy->filterRec(rec); 209 fProxy->filterRec(rec);
206 rec->setHinting(SkPaint::kNo_Hinting); 210 rec->setHinting(SkPaint::kNo_Hinting);
207 rec->fMaskFormat = SkMask::kARGB32_Format; 211 rec->fMaskFormat = SkMask::kARGB32_Format;
208 } 212 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 250
247 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const { 251 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const {
248 return fProxy->getTableTags(tags); 252 return fProxy->getTableTags(tags);
249 } 253 }
250 254
251 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset, 255 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
252 size_t length, void* data) const { 256 size_t length, void* data) const {
253 return fProxy->getTableData(tag, offset, length, data); 257 return fProxy->getTableData(tag, offset, length, data);
254 } 258 }
255 259
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698