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

Unified Diff: src/ports/SkFontHost_win_dw.cpp

Issue 12683003: override SkTypeface::onOpenStream for DW (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 | « no previous file | 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 8310)
+++ src/ports/SkFontHost_win_dw.cpp (working copy)
@@ -479,6 +479,7 @@
}
protected:
+ virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE;
virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK_OVERRIDE;
virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE;
virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
@@ -992,8 +993,6 @@
}
//Copy the mask into the glyph.
- int width = glyph.fWidth;
- size_t dstRB = glyph.rowBytes();
const uint8_t* src = (const uint8_t*)bits;
if (isBW) {
bilevel_to_bw(src, glyph);
@@ -1134,19 +1133,21 @@
SkStream* SkFontHost::OpenStream(SkFontID uniqueID) {
DWriteFontTypeface* typeface = GetDWriteFontByID(uniqueID);
- if (NULL == typeface) {
- return NULL;
- }
+ return typeface ? typeface->openStream(NULL) : NULL;
+}
+SkStream* DWriteFontTypeface::onOpenStream(int* ttcIndex) const {
+ *ttcIndex = 0;
+
UINT32 numFiles;
- HRNM(typeface->fDWriteFontFace->GetFiles(&numFiles, NULL),
+ HRNM(fDWriteFontFace->GetFiles(&numFiles, NULL),
"Could not get number of font files.");
if (numFiles != 1) {
return NULL;
}
SkTScopedComPtr<IDWriteFontFile> fontFile;
- HRNM(typeface->fDWriteFontFace->GetFiles(&numFiles, &fontFile), "Could not get font files.");
+ HRNM(fDWriteFontFace->GetFiles(&numFiles, &fontFile), "Could not get font files.");
const void* fontFileKey;
UINT32 fontFileKeySize;
@@ -1381,7 +1382,8 @@
T::TAG1,
T::TAG2,
T::TAG3);
- HRESULT hr = fontFace->TryGetFontTable(tag,
+ // TODO: need to check for failure
+ /*HRESULT hr =*/ fontFace->TryGetFontTable(tag,
reinterpret_cast<const void **>(&fData), &fSize, &fLock, &fExists);
}
~AutoDWriteTable() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698