Upstreaming code from android repository.
* fix for png decoder * clean up for SkFontHost reviewed by reed@google.com git-svn-id: http://skia.googlecode.com/svn/trunk@847 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
02878b844c
commit
7b34ea61ce
@ -201,9 +201,9 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
|
||||
}
|
||||
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
|
||||
// png_set_gray_1_2_4_to_8(png_ptr);
|
||||
png_set_gray_1_2_4_to_8(png_ptr);
|
||||
}
|
||||
|
||||
|
||||
/* Make a grayscale image into RGB. */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||
|
@ -1248,7 +1248,7 @@ SkTypeface::Style find_name_and_attributes(SkStream* stream, SkString* name,
|
||||
bool* isFixedWidth) {
|
||||
FT_Library library;
|
||||
if (FT_Init_FreeType(&library)) {
|
||||
name->set(NULL);
|
||||
name->reset();
|
||||
return SkTypeface::kNormal;
|
||||
}
|
||||
|
||||
@ -1276,7 +1276,7 @@ SkTypeface::Style find_name_and_attributes(SkStream* stream, SkString* name,
|
||||
FT_Face face;
|
||||
if (FT_Open_Face(library, &args, 0, &face)) {
|
||||
FT_Done_FreeType(library);
|
||||
name->set(NULL);
|
||||
name->reset();
|
||||
return SkTypeface::kNormal;
|
||||
}
|
||||
|
||||
|
@ -426,6 +426,8 @@ static const FontInitRec gSystemFonts[] = {
|
||||
{ "DroidSansArabic.ttf", gFBNames },
|
||||
{ "DroidSansHebrew.ttf", gFBNames },
|
||||
{ "DroidSansThai.ttf", gFBNames },
|
||||
{ "MTLmr3m.ttf", gFBNames }, // Motoya Japanese Font
|
||||
{ "MTLc3m.ttf", gFBNames }, // Motoya Japanese Font
|
||||
{ "DroidSansJapanese.ttf", gFBNames },
|
||||
{ "DroidSansFallback.ttf", gFBNames }
|
||||
};
|
||||
@ -590,13 +592,6 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
|
||||
return tf;
|
||||
}
|
||||
|
||||
// static
|
||||
SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
|
||||
uint32_t fontID, bool perGlyphInfo) {
|
||||
SkASSERT(!"SkFontHost::GetAdvancedTypefaceMetrics unimplemented");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool SkFontHost::ValidFontID(uint32_t fontID) {
|
||||
SkAutoMutexAcquire ac(gFamilyMutex);
|
||||
|
||||
@ -665,7 +660,11 @@ SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
|
||||
SkString name;
|
||||
SkTypeface::Style style = find_name_and_attributes(stream, &name, &isFixedWidth);
|
||||
|
||||
return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedWidth));
|
||||
if (!name.isEmpty()) {
|
||||
return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedWidth));
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
|
||||
|
Loading…
Reference in New Issue
Block a user