Upstream changes from Android

R=scroggo@google.com

Review URL: https://codereview.chromium.org/21053009

git-svn-id: http://skia.googlecode.com/svn/trunk@10461 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
djsollen@google.com 2013-07-31 15:48:10 +00:00
parent 631a59b939
commit 29bf862515
4 changed files with 20 additions and 7 deletions

View File

@ -94,9 +94,9 @@ public:
enum FontVariant { enum FontVariant {
kDefault_Variant, // Currently setting yourself to Default gives you Compact Variant kDefault_Variant = 0x01, // Currently setting yourself to Default gives you Compact Variant
kCompact_Variant, kCompact_Variant = 0x02,
kElegant_Variant, kElegant_Variant = 0x04,
kLast_Variant = kElegant_Variant, kLast_Variant = kElegant_Variant,
}; };

View File

@ -16,6 +16,7 @@
#include "SkMaskFilter.h" #include "SkMaskFilter.h"
#include "SkMaskGamma.h" #include "SkMaskGamma.h"
#include "SkOrderedReadBuffer.h" #include "SkOrderedReadBuffer.h"
#include "SkOrderedWriteBuffer.h"
#include "SkPathEffect.h" #include "SkPathEffect.h"
#include "SkRasterizer.h" #include "SkRasterizer.h"
#include "SkRasterClip.h" #include "SkRasterClip.h"
@ -143,13 +144,19 @@ SkScalerContext* SkScalerContext::allocNextContext() const {
SkAutoTUnref<SkTypeface> aur(newFace); SkAutoTUnref<SkTypeface> aur(newFace);
uint32_t newFontID = newFace->uniqueID(); uint32_t newFontID = newFace->uniqueID();
SkAutoDescriptor ad(sizeof(fRec) + SkDescriptor::ComputeOverhead(1)); SkOrderedWriteBuffer androidBuffer(128);
fPaintOptionsAndroid.flatten(androidBuffer);
SkAutoDescriptor ad(sizeof(fRec) + androidBuffer.size() + SkDescriptor::ComputeOverhead(2));
SkDescriptor* desc = ad.getDesc(); SkDescriptor* desc = ad.getDesc();
desc->init(); desc->init();
SkScalerContext::Rec* newRec = SkScalerContext::Rec* newRec =
(SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag, (SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag,
sizeof(fRec), &fRec); sizeof(fRec), &fRec);
androidBuffer.writeToMemory(desc->addEntry(kAndroidOpts_SkDescriptorTag,
androidBuffer.size(), NULL));
newRec->fFontID = newFontID; newRec->fFontID = newFontID;
desc->computeChecksum(); desc->computeChecksum();

View File

@ -123,6 +123,7 @@ static void copyLine(uint32_t* dst, const unsigned char* src, const ColorMapObje
} }
} }
#if GIFLIB_MAJOR < 5
static void copyInterlaceGroup(SkBitmap* bm, const unsigned char*& src, static void copyInterlaceGroup(SkBitmap* bm, const unsigned char*& src,
const ColorMapObject* cmap, int transparent, int copyWidth, const ColorMapObject* cmap, int transparent, int copyWidth,
int copyHeight, const GifImageDesc& imageDesc, int rowStep, int copyHeight, const GifImageDesc& imageDesc, int rowStep,
@ -169,6 +170,7 @@ static void blitInterlace(SkBitmap* bm, const SavedImage* frame, const ColorMapO
copyInterlaceGroup(bm, src, cmap, transparent, copyWidth, copyHeight, frame->ImageDesc, 2, 1); copyInterlaceGroup(bm, src, cmap, transparent, copyWidth, copyHeight, frame->ImageDesc, 2, 1);
} }
#endif
static void blitNormal(SkBitmap* bm, const SavedImage* frame, const ColorMapObject* cmap, static void blitNormal(SkBitmap* bm, const SavedImage* frame, const ColorMapObject* cmap,
int transparent) int transparent)
@ -241,11 +243,15 @@ static void drawFrame(SkBitmap* bm, const SavedImage* frame, const ColorMapObjec
return; return;
} }
#if GIFLIB_MAJOR < 5
// before GIFLIB 5, de-interlacing wasn't done by library at load time
if (frame->ImageDesc.Interlace) { if (frame->ImageDesc.Interlace) {
blitInterlace(bm, frame, cmap, transparent); blitInterlace(bm, frame, cmap, transparent);
} else { return;
blitNormal(bm, frame, cmap, transparent);
} }
#endif
blitNormal(bm, frame, cmap, transparent);
} }
static bool checkIfWillBeCleared(const SavedImage* frame) static bool checkIfWillBeCleared(const SavedImage* frame)

View File

@ -593,7 +593,7 @@ SkTypeface* SkFontConfigInterfaceAndroid::nextLogicalTypeface(SkFontID currFontI
const SkTypeface* currTypeface = SkTypefaceCache::FindByID(currFontID); const SkTypeface* currTypeface = SkTypefaceCache::FindByID(currFontID);
// non-system fonts are not in the font cache so if we are asked to fallback // non-system fonts are not in the font cache so if we are asked to fallback
// for a non-system font we will start at the front of the chain. // for a non-system font we will start at the front of the chain.
if (NULL != currTypeface && currFontID == origFontID) { if (NULL != currTypeface && currFontID != origFontID) {
currFontRecID = ((FontConfigTypeface*)currTypeface)->getIdentity().fID; currFontRecID = ((FontConfigTypeface*)currTypeface)->getIdentity().fID;
SkASSERT(INVALID_FONT_REC_ID != currFontRecID); SkASSERT(INVALID_FONT_REC_ID != currFontRecID);
} }