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

Side by Side Diff: src/fonts/SkGScalerContext.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/SkGScalerContext.h ('k') | src/fonts/SkRandomScalerContext.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 "SkDescriptor.h" 8 #include "SkDescriptor.h"
9 #include "SkGScalerContext.h" 9 #include "SkGScalerContext.h"
10 #include "SkGlyph.h" 10 #include "SkGlyph.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 metrics->fXMin = SkScalarMul(metrics->fXMin, scale); 144 metrics->fXMin = SkScalarMul(metrics->fXMin, scale);
145 metrics->fXMax = SkScalarMul(metrics->fXMax, scale); 145 metrics->fXMax = SkScalarMul(metrics->fXMax, scale);
146 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale); 146 metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale);
147 } 147 }
148 } 148 }
149 149
150 /////////////////////////////////////////////////////////////////////////////// 150 ///////////////////////////////////////////////////////////////////////////////
151 151
152 #include "SkTypefaceCache.h" 152 #include "SkTypefaceCache.h"
153 153
154 SkGTypeface::SkGTypeface(SkTypeface* proxy, const SkPaint& paint) 154 SkGTypeface::SkGTypeface(sk_sp<SkTypeface> proxy, const SkPaint& paint)
155 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) 155 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false)
156 , fProxy(SkRef(proxy)) 156 , fProxy(std::move(proxy))
157 , fPaint(paint) {} 157 , fPaint(paint)
158 158 {}
159 SkGTypeface::~SkGTypeface() {
160 fProxy->unref();
161 }
162 159
163 SkScalerContext* SkGTypeface::onCreateScalerContext(const SkScalerContextEffects & effects, 160 SkScalerContext* SkGTypeface::onCreateScalerContext(const SkScalerContextEffects & effects,
164 const SkDescriptor* desc) co nst { 161 const SkDescriptor* desc) co nst {
165 return new SkGScalerContext(const_cast<SkGTypeface*>(this), effects, desc); 162 return new SkGScalerContext(const_cast<SkGTypeface*>(this), effects, desc);
166 } 163 }
167 164
168 void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const { 165 void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const {
169 fProxy->filterRec(rec); 166 fProxy->filterRec(rec);
170 rec->setHinting(SkPaint::kNo_Hinting); 167 rec->setHinting(SkPaint::kNo_Hinting);
171 rec->fMaskFormat = SkMask::kARGB32_Format; 168 rec->fMaskFormat = SkMask::kARGB32_Format;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 248
252 friend class SkGFontBuilder; 249 friend class SkGFontBuilder;
253 SkGFont(int count, Glyph* array); 250 SkGFont(int count, Glyph* array);
254 }; 251 };
255 252
256 class SkGFontBuilder { 253 class SkGFontBuilder {
257 public: 254 public:
258 255
259 }; 256 };
260 #endif 257 #endif
OLDNEW
« no previous file with comments | « src/fonts/SkGScalerContext.h ('k') | src/fonts/SkRandomScalerContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698