fix formatting issues

git-svn-id: http://skia.googlecode.com/svn/trunk@67 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-01-14 17:51:08 +00:00
parent 6f25297d93
commit b50a60c463
3 changed files with 31 additions and 25 deletions

View File

@ -600,8 +600,8 @@ static int computeBitDepth(int colorCount) {
have alpha in the colortable, since png doesn't support premul colors
*/
static inline int pack_palette(SkColorTable* ctable,
png_color* SK_RESTRICT palette,
png_byte* SK_RESTRICT trans, bool hasAlpha) {
png_color* SK_RESTRICT palette,
png_byte* SK_RESTRICT trans, bool hasAlpha) {
SkAutoLockColors alc(ctable);
const SkPMColor* SK_RESTRICT colors = alc.colors();
const int ctCount = ctable->count();

View File

@ -34,7 +34,8 @@ struct FontFaceRec {
SkBool8 fBold;
SkBool8 fItalic;
static const FontFaceRec& FindFace(const FontFaceRec rec[], int count, int isBold, int isItalic);
static const FontFaceRec& FindFace(const FontFaceRec rec[], int count,
int isBold, int isItalic);
};
struct FontFamilyRec {
@ -42,7 +43,8 @@ struct FontFamilyRec {
int fFaceCount;
};
const FontFaceRec& FontFaceRec::FindFace(const FontFaceRec rec[], int count, int isBold, int isItalic)
const FontFaceRec& FontFaceRec::FindFace(const FontFaceRec rec[], int count,
int isBold, int isItalic)
{
SkASSERT(count > 0);
@ -85,7 +87,7 @@ static const FontFamilyRec gFamilies[] = {
#define DEFAULT_FAMILY_INDEX DEFAULT_FAMILY_INDEX
#define DEFAULT_FAMILY_FACE_INDEX 0
////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/* map common "web" font names to our font list */
@ -121,7 +123,7 @@ static const FontFamilyMatchRec gMatches[] = {
#endif
};
////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include "SkTSearch.h"
@ -154,7 +156,8 @@ TRACE_FONT_NAME(printf("----------------- font request <%s>", target);)
if (contains_only_ascii(target))
{
// Search for the font by matching the entire name
index = SkStrLCSearch(&gMatches[0].fLCName, SK_ARRAY_COUNT(gMatches), target, sizeof(gMatches[0]));
index = SkStrLCSearch(&gMatches[0].fLCName, SK_ARRAY_COUNT(gMatches),
target, sizeof(gMatches[0]));
if (index >= 0)
{
TRACE_FONT_NAME(printf(" found %d\n", index);)
@ -187,7 +190,7 @@ TRACE_FONT_NAME(printf("----------------- font request <%s>", target);)
return &gFamilies[DEFAULT_FAMILY_INDEX];
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static const FontFaceRec* get_default_face()
{
@ -236,23 +239,28 @@ static uint32_t ptr2uint32(const void* p)
return (uint32_t)((char*)p - (char*)0);
}
SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace, const char familyName[], SkTypeface::Style style)
SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace,
const char familyName[],
SkTypeface::Style style)
{
const FontFamilyRec* family;
if (familyFace)
family = &gFamilies[((FontFaceRec_Typeface*)familyFace)->fFace.fFamilyIndex];
family = &gFamilies[
((FontFaceRec_Typeface*)familyFace)->fFace.fFamilyIndex];
else if (familyName)
family = find_family_rec(familyName);
else
family = &gFamilies[DEFAULT_FAMILY_INDEX];
const FontFaceRec& face = FontFaceRec::FindFace(family->fFaces, family->fFaceCount,
(style & SkTypeface::kBold) != 0,
(style & SkTypeface::kItalic) != 0);
const FontFaceRec& face = FontFaceRec::FindFace(family->fFaces,
family->fFaceCount,
(style & SkTypeface::kBold) != 0,
(style & SkTypeface::kItalic) != 0);
// if we're returning our input parameter, no need to create a new instance
if (familyFace != NULL && &((FontFaceRec_Typeface*)familyFace)->fFace == &face)
if (familyFace != NULL &&
&((FontFaceRec_Typeface*)familyFace)->fFace == &face)
{
familyFace->ref();
return (SkTypeface*)familyFace;
@ -286,11 +294,7 @@ void SkFontHost::CloseStream(uint32_t fontID, SkStream* stream) {
}
void SkFontHost::Serialize(const SkTypeface* tface, SkWStream* stream) {
const FontFaceRec* face;
face = &((const FontFaceRec_Typeface*)tface)->fFace;
size_t size = sizeof(face);
const FontFaceRec* face = &((const FontFaceRec_Typeface*)tface)->fFace;
stream->write(face, sizeof(face));
}
@ -300,11 +304,13 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
return new FontFaceRec_Typeface(*face);
}
SkScalerContext* SkFontHost::CreateFallbackScalerContext(const SkScalerContext::Rec& rec)
SkScalerContext* SkFontHost::CreateFallbackScalerContext(
const SkScalerContext::Rec& rec)
{
const FontFaceRec* face = get_default_face();
SkAutoDescriptor ad(sizeof(rec) + sizeof(face) + SkDescriptor::ComputeOverhead(2));
SkAutoDescriptor ad(sizeof(rec) + sizeof(face) +
SkDescriptor::ComputeOverhead(2));
SkDescriptor* desc = ad.getDesc();
SkScalerContext::Rec* newRec;

View File

@ -2,11 +2,11 @@
#ifdef SK_BUILD_FOR_WIN
static U16* concat_to_16(const char src[], const char suffix[])
static uint16_t* concat_to_16(const char src[], const char suffix[])
{
size_t i, len = strlen(src);
size_t len2 = 3 + (suffix ? strlen(suffix) : 0);
U16* dst = (U16*)sk_malloc_throw((len + len2) * sizeof(U16));
uint16_t* dst = (uint16_t*)sk_malloc_throw((len + len2) * sizeof(uint16_t));
for (i = 0; i < len; i++)
dst[i] = src[i];
@ -30,7 +30,7 @@ SkUTF16_Str::SkUTF16_Str(const char src[])
{
size_t len = strlen(src);
fStr = (U16*)sk_malloc_throw((len + 1) * sizeof(U16));
fStr = (uint16_t*)sk_malloc_throw((len + 1) * sizeof(uint16_t));
for (size_t i = 0; i < len; i++)
fStr[i] = src[i];
fStr[i] = 0;
@ -68,7 +68,7 @@ void SkOSFile::Iter::reset(const char path[], const char suffix[])
fPath16 = concat_to_16(path, suffix);
}
static bool is_magic_dir(const U16 dir[])
static bool is_magic_dir(const uint16_t dir[])
{
// return true for "." and ".."
return dir[0] == '.' && (dir[1] == 0 || dir[1] == '.' && dir[2] == 0);