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

Unified Diff: src/ports/SkFontHost_win_dw.cpp

Issue 12593013: remove SkFontHost::CreateScalerContext (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win_dw.cpp
===================================================================
--- src/ports/SkFontHost_win_dw.cpp (revision 8224)
+++ src/ports/SkFontHost_win_dw.cpp (working copy)
@@ -41,11 +41,11 @@
SkMask::kLCD32_Format == rec.fMaskFormat;
}
-SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) {
+SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) {
// Zero means that we don't have any fallback fonts for this fontID.
// This function is implemented on Android, but doesn't have much
// meaning here.
- return 0;
+ return NULL;
}
///////////////////////////////////////////////////////////////////////////////
@@ -477,11 +477,15 @@
HRV(factory->UnregisterFontCollectionLoader(fDWriteFontCollectionLoader.get()));
HRV(factory->UnregisterFontFileLoader(fDWriteFontFileLoader.get()));
}
+
+protected:
+ virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK_OVERRIDE;
+ virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE;
};
class SkScalerContext_Windows : public SkScalerContext {
public:
- SkScalerContext_Windows(const SkDescriptor* desc);
+ SkScalerContext_Windows(DWriteFontTypeface*, const SkDescriptor* desc);
virtual ~SkScalerContext_Windows();
protected:
@@ -707,8 +711,10 @@
return static_cast<DWriteFontTypeface*>(SkTypefaceCache::FindByID(fontID));
}
-SkScalerContext_Windows::SkScalerContext_Windows(const SkDescriptor* desc)
- : SkScalerContext(desc)
+SkScalerContext_Windows::SkScalerContext_Windows(DWriteFontTypeface* typeface,
+ const SkDescriptor* desc)
+ : SkScalerContext(typeface, desc)
+ , fTypeface(SkRef(typeface))
, fGlyphCount(-1) {
SkAutoMutexAcquire ac(gFTMutex);
@@ -719,9 +725,6 @@
fXform.dx = 0;
fXform.dy = 0;
- fTypeface.reset(GetDWriteFontByID(fRec.fFontID));
- fTypeface.get()->ref();
-
fOffscreen.init(fTypeface->fDWriteFontFace.get(), fXform, SkScalarToFloat(fRec.fTextSize));
}
@@ -1162,8 +1165,8 @@
return 0;
}
-SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc) {
- return SkNEW_ARGS(SkScalerContext_Windows, (desc));
+SkScalerContext* DWriteFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const {
+ return SkNEW_ARGS(SkScalerContext_Windows, (const_cast<DWriteFontTypeface*>(this), desc));
}
static HRESULT get_by_family_name(const char familyName[], IDWriteFontFamily** fontFamily) {
@@ -1258,7 +1261,7 @@
return NULL;
}
-void SkFontHost::FilterRec(SkScalerContext::Rec* rec, SkTypeface*) {
+void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const {
unsigned flagsWeDontSupport = SkScalerContext::kDevKernText_Flag |
SkScalerContext::kAutohinting_Flag |
SkScalerContext::kEmbeddedBitmapText_Flag |
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698