Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6474054
git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/ports/SkFontDescriptor.cpp b/src/ports/SkFontDescriptor.cpp
index 34f4f17..7679d92 100644
--- a/src/ports/SkFontDescriptor.cpp
+++ b/src/ports/SkFontDescriptor.cpp
@@ -13,7 +13,7 @@
kFontFamilyName = 0x01,
kFullName = 0x04,
kPostscriptName = 0x06,
-
+
// These count backwards from 0xFF, so as not to collide with the SFNT
// defines for names in its 'name' table.
kFontFileName = 0xFE,
diff --git a/src/ports/SkFontDescriptor.h b/src/ports/SkFontDescriptor.h
index b226029..5febfd8 100644
--- a/src/ports/SkFontDescriptor.h
+++ b/src/ports/SkFontDescriptor.h
@@ -28,7 +28,7 @@
const char* getFullName() { return fFullName.c_str(); }
const char* getPostscriptName() { return fPostscriptName.c_str(); }
const char* getFontFileName() { return fFontFileName.c_str(); }
-
+
void setFamilyName(const char* name) { fFamilyName.set(name); }
void setFullName(const char* name) { fFullName.set(name); }
void setPostscriptName(const char* name) { fPostscriptName.set(name); }
diff --git a/src/ports/SkFontHost_FONTPATH.cpp b/src/ports/SkFontHost_FONTPATH.cpp
index 04e4934..69e73f5 100644
--- a/src/ports/SkFontHost_FONTPATH.cpp
+++ b/src/ports/SkFontHost_FONTPATH.cpp
@@ -14,14 +14,14 @@
#include <stdio.h>
/* define this if we can use mmap() to access fonts from the filesystem */
-#define SK_CAN_USE_MMAP
+#define SK_CAN_USE_MMAP
#ifndef SK_FONTPATH
#define SK_FONTPATH "the complete path for a font file"
#endif
struct FontFaceRec {
- const char* fFileName;
+ const char* fFileName;
uint8_t fFamilyIndex;
SkBool8 fBold;
SkBool8 fItalic;
@@ -39,7 +39,7 @@
int isBold, int isItalic)
{
SkASSERT(count > 0);
-
+
int i;
// look for an exact match
@@ -63,7 +63,7 @@
enum {
DEFAULT_FAMILY_INDEX,
-
+
FAMILY_INDEX_COUNT
};
@@ -236,7 +236,7 @@
SkTypeface::Style style)
{
const FontFamilyRec* family;
-
+
if (familyFace)
family = &gFamilies[
((FontFaceRec_Typeface*)familyFace)->fFace.fFamilyIndex];
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 550fae0..45ae7ec 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -610,7 +610,7 @@
if (rec->fTextSize > SkIntToScalar(1 << 14)) {
rec->fTextSize = SkIntToScalar(1 << 14);
}
-
+
if (!gLCDSupportValid) {
InitFreetype();
FT_Done_FreeType(gFTLibrary);
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 91f172b..332b8c4 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -89,7 +89,7 @@
SkTSwap(srcR, srcB);
}
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(*srcR++, tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(*srcR++, tableR),
sk_apply_lut_if<APPLY_PREBLEND>(*srcG++, tableG),
sk_apply_lut_if<APPLY_PREBLEND>(*srcB++, tableB));
}
@@ -98,14 +98,14 @@
const uint8_t* triple = src;
if (lcdIsBGR) {
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableR),
sk_apply_lut_if<APPLY_PREBLEND>(triple[1], tableG),
sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableB));
triple += 3;
}
} else {
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableR),
sk_apply_lut_if<APPLY_PREBLEND>(triple[1], tableG),
sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableB));
triple += 3;
@@ -302,7 +302,7 @@
if (SkMask::kA8_Format == glyph.fMaskFormat && maskPreBlend) {
uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
unsigned rowBytes = glyph.rowBytes();
-
+
for (int y = glyph.fHeight - 1; y >= 0; --y) {
for (int x = glyph.fWidth - 1; x >= 0; --x) {
dst[x] = tableG[dst[x]];
diff --git a/src/ports/SkFontHost_ascender.cpp b/src/ports/SkFontHost_ascender.cpp
index ccfedef..067d474 100644
--- a/src/ports/SkFontHost_ascender.cpp
+++ b/src/ports/SkFontHost_ascender.cpp
@@ -52,20 +52,20 @@
{
int size = aca_Get_FontHandleRec_Size();
fHandle = (aca_FontHandle)sk_malloc_throw(size);
-
+
// get the pointer to the font
-
+
fFontStream = new SkMMAPStream("/UcsGB2312-Hei-H.FDL");
fHintStream = new SkMMAPStream("/genv6-23.bin");
-
+
void* hints = sk_malloc_throw(fHintStream->getLength());
memcpy(hints, fHintStream->getMemoryBase(), fHintStream->getLength());
-
+
aca_Create_Font_Handle(fHandle,
(void*)fFontStream->getMemoryBase(), fFontStream->getLength(),
"fred",
hints, fHintStream->getLength());
-
+
// compute our factors from the record
SkMatrix m;
@@ -75,17 +75,17 @@
// now compute our scale factors
SkScalar sx = m.getScaleX();
SkScalar sy = m.getScaleY();
-
+
int ppemX = SkScalarRound(sx);
int ppemY = SkScalarRound(sy);
-
+
size = aca_Find_Font_Memory_Required(fHandle, ppemX, ppemY);
size *= 8; // Jeff suggests this :)
fWorkspace = sk_malloc_throw(size);
aca_Set_Font_Memory(fHandle, (uint8_t*)fWorkspace, size);
aca_GlyphAttribsRec rec;
-
+
memset(&rec, 0, sizeof(rec));
rec.xSize = ppemX;
rec.ySize = ppemY;
@@ -95,7 +95,7 @@
rec.doInterpolate = true;
rec.grayMode = 2;
aca_Set_Font_Attributes(fHandle, &rec, &size);
-
+
fGlyphWorkspace = sk_malloc_throw(size);
aca_Set_Glyph_Memory(fHandle, fGlyphWorkspace);
}
@@ -123,10 +123,10 @@
{
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
-
+
aca_GlyphImageRec rec;
aca_Vector topLeft;
-
+
int adv = aca_Get_Adv_Width(fHandle, glyph->getGlyphID());
if (aca_GLYPH_NOT_PRESENT == adv)
goto ERROR;
@@ -144,7 +144,7 @@
glyph->fAdvanceY = 0;
return;
}
-
+
glyph->fWidth = rec.width;
glyph->fHeight = rec.rows;
glyph->fRowBytes = rec.width;
@@ -158,13 +158,13 @@
{
aca_GlyphImageRec rec;
aca_Vector topLeft;
-
+
aca_Rasterize(glyph.getGlyphID(), fHandle, &rec, &topLeft);
-
+
const uint8_t* src = (const uint8_t*)rec.buffer;
uint8_t* dst = (uint8_t*)glyph.fImage;
int height = glyph.fHeight;
-
+
src += rec.y0 * rec.pitch + rec.x0;
while (--height >= 0)
{
@@ -179,7 +179,7 @@
void SkScalerContext_Ascender::generatePath(const SkGlyph& glyph, SkPath* path)
{
SkRect r;
-
+
r.set(0, 0, SkIntToScalar(4), SkIntToScalar(4));
path->reset();
path->addRect(r);
diff --git a/src/ports/SkFontHost_freetype_mac.cpp b/src/ports/SkFontHost_freetype_mac.cpp
index 8b1272a..652fb46 100644
--- a/src/ports/SkFontHost_freetype_mac.cpp
+++ b/src/ports/SkFontHost_freetype_mac.cpp
@@ -22,7 +22,7 @@
fStream->unref();
}
- SkStream* fStream;
+ SkStream* fStream;
};
static FTMacTypeface* create_from_path(const char path[]) {
@@ -42,7 +42,7 @@
if (NULL == gDef) {
gDef = create_from_path(FONT_PATH);
}
-
+
gDef->ref();
return gDef;
}
diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp
index 91fb92c..52ac1cf 100644
--- a/src/ports/SkFontHost_mac_coretext.cpp
+++ b/src/ports/SkFontHost_mac_coretext.cpp
@@ -46,7 +46,7 @@
public:
AutoCFRelease(CFTypeRef obj) : fObj(obj) {}
~AutoCFRelease() { CFSafeRelease(fObj); }
-
+
private:
CFTypeRef fObj;
};
@@ -180,7 +180,7 @@
static const char FONT_DEFAULT_NAME[] = "Lucida Sans";
-// see Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal
+// see Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal
// for original source
static int readVersion() {
struct utsname info;
@@ -303,7 +303,7 @@
CGRGBPixel* getCG(const SkScalerContext_Mac& context, const SkGlyph& glyph,
CGGlyph glyphID, size_t* rowBytesPtr);
-
+
private:
enum {
kSize = 32 * 32 * sizeof(CGRGBPixel)
@@ -352,8 +352,8 @@
class AutoCFDataRelease {
public:
AutoCFDataRelease(CFDataRef obj) : fObj(obj) {}
- const uint16_t* getShortPtr() {
- return fObj ? (const uint16_t*) CFDataGetBytePtr(fObj) : NULL;
+ const uint16_t* getShortPtr() {
+ return fObj ? (const uint16_t*) CFDataGetBytePtr(fObj) : NULL;
}
~AutoCFDataRelease() { CFSafeRelease(fObj); }
private:
@@ -367,7 +367,7 @@
id &= 0x3FFFFFFF; // make top two bits 00
return id;
}
- // CTFontGetPlatformFont returns NULL if the font is local
+ // CTFontGetPlatformFont returns NULL if the font is local
// (e.g., was created by a CSS3 @font-face rule).
CGFontRef cgFont = CTFontCopyGraphicsFont(fontRef, NULL);
AutoCFDataRelease headRef(CGFontCopyTableForTag(cgFont, 'head'));
@@ -777,11 +777,11 @@
CGContextSetAllowsFontSubpixelPositioning(fCG, context.fDoSubPosition);
CGContextSetShouldSubpixelPositionFonts(fCG, context.fDoSubPosition);
-
+
// Draw white on black to create mask.
// TODO: Draw black on white and invert, CG has a special case codepath.
CGContextSetGrayFillColor(fCG, 1.0f, 1.0f);
-
+
// force our checks below to happen
fDoAA = !doAA;
fDoLCD = !doLCD;
@@ -848,9 +848,9 @@
* field. The choice of long or short offsets is dependent on the maximum
* possible offset distance.
*
- * 'loca' short version: The actual local offset divided by 2 is stored.
+ * 'loca' short version: The actual local offset divided by 2 is stored.
* 'loca' long version: The actual local offset is stored.
- *
+ *
* The result is a offset into a table of 2 byte (16 bit) entries.
*/
static uint32_t getLocaTableEntry(const uint16_t*& locaPtr, int locaFormat) {
@@ -982,7 +982,7 @@
if (!isSnowLeopard()) {
// Lion and Leopard respect the vertical font metrics.
CTFontGetBoundingRectsForGlyphs(fCTVerticalFont,
- kCTFontVerticalOrientation,
+ kCTFontVerticalOrientation,
&cgGlyph, &theBounds, 1);
} else {
// Snow Leopard and earlier respect the vertical font metrics for
@@ -1013,7 +1013,7 @@
CGPathRelease(path);
}
}
-
+
glyph->zeroMetrics();
glyph->fAdvanceX = SkFloatToFixed(theAdvance.width);
glyph->fAdvanceY = -SkFloatToFixed(theAdvance.height);
@@ -1021,7 +1021,7 @@
if (CGRectIsEmpty_inline(theBounds)) {
return;
}
-
+
if (isLeopard() && !fVertical) {
// Leopard does not consider the matrix skew in its bounds.
// Run the bounding rectangle through the skew matrix to determine
@@ -1048,7 +1048,7 @@
// Get the metrics
bool lionAdjustedMetrics = false;
if (isLion() || isMountainLion()) {
- if (cgGlyph < fGlyphCount && cgGlyph >= getAdjustStart()
+ if (cgGlyph < fGlyphCount && cgGlyph >= getAdjustStart()
&& generateBBoxes()) {
lionAdjustedMetrics = true;
SkRect adjust;
@@ -1131,7 +1131,7 @@
const int width = glyph.fWidth;
size_t dstRB = glyph.rowBytes();
uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
-
+
for (int y = 0; y < glyph.fHeight; y++) {
for (int i = 0; i < width; ++i) {
dst[i] = rgb_to_a8<APPLY_PREBLEND>(cgPixels[i], table8);
@@ -1156,7 +1156,7 @@
const int width = glyph.fWidth;
size_t dstRB = glyph.rowBytes();
uint16_t* SK_RESTRICT dst = (uint16_t*)glyph.fImage;
-
+
for (int y = 0; y < glyph.fHeight; y++) {
for (int i = 0; i < width; i++) {
dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, tableB);
@@ -1203,7 +1203,7 @@
if (cgPixels == NULL) {
return;
}
-
+
//TODO: see if drawing black on white and inverting is faster (at least in
//lcd case) as core graphics appears to have special case code for drawing
//black text.
@@ -1229,7 +1229,7 @@
addr = SkTAddByteOffset(addr, cgRowBytes);
}
}
-
+
// Must be careful not to use these if maskPreBlend == NULL
const uint8_t* tableR = NULL;
const uint8_t* tableG = NULL;
@@ -1239,7 +1239,7 @@
tableG = maskPreBlend->fG;
tableB = maskPreBlend->fB;
}
-
+
// Convert glyph to mask
switch (glyph.fMaskFormat) {
case SkMask::kLCD32_Format: {
@@ -1322,7 +1322,7 @@
// need to release font when we're done
font = CTFontCreateCopyWithAttributes(fCTFont, 1, &xform, NULL);
}
-
+
CGGlyph cgGlyph = (CGGlyph)glyph.getGlyphID(fBaseGlyphCount);
CGPathRef cgPath = CTFontCreatePathForGlyph(font, cgGlyph, NULL);
@@ -1423,7 +1423,7 @@
public:
AutoCGDataProviderRelease(CGDataProviderRef provider) : fProvider(provider) {}
~AutoCGDataProviderRelease() { CGDataProviderRelease(fProvider); }
-
+
private:
CGDataProviderRef fProvider;
};
@@ -1550,13 +1550,13 @@
ctFont = CTFontCreateCopyWithAttributes(ctFont, CTFontGetUnitsPerEm(ctFont),
NULL, NULL);
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
-
+
{
CFStringRef fontName = CTFontCopyPostScriptName(ctFont);
CFStringToSkString(fontName, &info->fFontName);
CFRelease(fontName);
}
-
+
info->fMultiMaster = false;
CFIndex glyphCount = CTFontGetGlyphCount(ctFont);
info->fLastGlyphID = SkToU16(glyphCount - 1);
@@ -1571,7 +1571,7 @@
// If it's not a truetype font, mark it as 'other'. Assume that TrueType
// fonts always have both glyf and loca tables. At the least, this is what
// sfntly needs to subset the font. CTFontCopyAttribute() does not always
- // succeed in determining this directly.
+ // succeed in determining this directly.
if (!GetTableSize(fontID, 'glyf') || !GetTableSize(fontID, 'loca')) {
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
info->fItalicAngle = 0;
@@ -1768,7 +1768,7 @@
desc.setPostscriptName(get_str(CTFontCopyPostScriptName(ctFont), &tmpStr));
desc.serialize(stream);
-
+
// by convention, we also write out the actual sfnt data, preceeded by
// a packed-length. For now we skip that, so we just write the zero.
stream->writePackedUInt(0);
@@ -1815,7 +1815,7 @@
h = SkPaint::kNormal_Hinting;
}
rec->setHinting(h);
-
+
bool lcdSupport = supports_LCD();
if (isLCDFormat(rec->fMaskFormat)) {
if (lcdSupport) {
@@ -1825,7 +1825,7 @@
rec->fMaskFormat = SkMask::kA8_Format;
}
}
-
+
if (lcdSupport) {
//CoreGraphics dialates smoothed text as needed.
rec->setContrast(0);
@@ -1845,7 +1845,7 @@
if (NULL == cfArray) {
return 0;
}
-
+
AutoCFRelease ar(cfArray);
return CFArrayGetCount(cfArray);
}
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 7ea3d49..b9f1cdc 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -1514,7 +1514,7 @@
The following need not be any standard base64 encoding.
The encoded value is never decoded.
*/
-static const char postscript_safe_base64_encode[] =
+static const char postscript_safe_base64_encode[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-_=";
@@ -1576,7 +1576,7 @@
if (FAILED(create_unique_font_name(familyName, familyNameSize))) {
return NULL;
}
-
+
// Change the name of the font.
SkAutoTUnref<SkData> rewrittenFontData(SkOTUtils::RenameFont(stream, familyName, familyNameSize-1));
if (NULL == rewrittenFontData.get()) {
diff --git a/src/ports/SkFontHost_win_dw.cpp b/src/ports/SkFontHost_win_dw.cpp
index c3a13a0..288ee4c 100644
--- a/src/ports/SkFontHost_win_dw.cpp
+++ b/src/ports/SkFontHost_win_dw.cpp
@@ -90,7 +90,7 @@
GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory")
)
;
-
+
if (!dWriteCreateFactoryProc) {
return E_UNEXPECTED;
}
@@ -99,7 +99,7 @@
__uuidof(IDWriteFactory),
reinterpret_cast<IUnknown**>(&gDWriteFactory)),
"Could not create DirectWrite factory.");
-
+
*factory = gDWriteFactory;
return S_OK;
}
@@ -162,7 +162,7 @@
0.0f, // baselineOriginY,
&glyphRunAnalysis),
"Could not create glyph run analysis.");
-
+
//NOTE: this assumes that the glyph has already been measured
//with an exact same glyph run analysis.
RECT bbox;
@@ -296,7 +296,7 @@
SkDEBUGF(("The hard coded font family does not exist."));
return E_UNEXPECTED;
}
-
+
SkTScopedComPtr<IDWriteFontFamily> fontFamily;
HRM(sysFonts->GetFontFamily(index, &fontFamily),
"Could not load the requested font family.");
@@ -518,7 +518,7 @@
//DirectWrite does not provide this information.
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
-
+
glyph->fAdvanceX = 0;
glyph->fAdvanceY = 0;
@@ -533,7 +533,7 @@
SkScalar advanceX = SkScalarMulDiv(fRec.fTextSize,
SkIntToScalar(gm.advanceWidth),
SkIntToScalar(dwfm.designUnitsPerEm));
-
+
if (!(fRec.fFlags & kSubpixelPositioning_Flag)) {
advanceX = SkScalarRoundToScalar(advanceX);
}
@@ -600,7 +600,7 @@
0.0f, // baselineOriginY,
&glyphRunAnalysis),
"Could not create glyph run analysis.");
-
+
RECT bbox;
HRVM(glyphRunAnalysis->GetAlphaTextureBounds(textureType, &bbox),
"Could not get texture bounds.");
@@ -1236,7 +1236,7 @@
float gamma = defaultRenderingParams->GetGamma();
rec->setDeviceGamma(SkFloatToScalar(gamma));
rec->setPaintGamma(SkFloatToScalar(gamma));
-
+
rec->setContrast(SkFloatToScalar(defaultRenderingParams->GetEnhancedContrast()));
}
}
@@ -1491,7 +1491,7 @@
}
}
*/
-
+
// If Restricted, the font may not be embedded in a document.
// If not Restricted, the font can be embedded.
// If PreviewPrint, the embedding is read-only.
diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp
index c0dfd39..e9235a8 100644
--- a/src/ports/SkGlobalInitialization_default.cpp
+++ b/src/ports/SkGlobalInitialization_default.cpp
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#include "SkTypes.h"
#if !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index 4e2bcc9..26f5744 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -31,7 +31,7 @@
size_t len = stream->getLength();
void* data = sk_malloc_throw(len);
stream->read(data, len);
-
+
return CGDataProviderCreateWithData(data, data, len, malloc_release_proc);
}
@@ -56,24 +56,24 @@
return false;
}
SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
-
+
CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, NULL);
if (NULL == image) {
return false;
}
SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image);
-
+
const int width = CGImageGetWidth(image);
const int height = CGImageGetHeight(image);
bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
}
-
+
if (!this->allocPixelRef(bm, NULL)) {
return false;
}
-
+
bm->lockPixels();
bm->eraseColor(0);
@@ -127,7 +127,7 @@
return NULL;
}
SkAutoTCallVProc<const void, CFRelease> arconsumer(consumer);
-
+
return CGImageDestinationCreateWithDataConsumer(consumer, type, 1, NULL);
}
@@ -137,7 +137,7 @@
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality);
-
+
private:
Type fType;
};
@@ -159,7 +159,7 @@
default:
return false;
}
-
+
CGImageDestinationRef dst = SkStreamToImageDestination(stream, type);
if (NULL == dst) {
return false;
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index a69ed4a..79d107a 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -29,9 +29,9 @@
if (!scopedCo.succeeded()) {
return false;
}
-
+
HRESULT hr = S_OK;
-
+
//Create Windows Imaging Component ImagingFactory.
SkTScopedComPtr<IWICImagingFactory> piImagingFactory;
if (SUCCEEDED(hr)) {
@@ -42,19 +42,19 @@
, IID_PPV_ARGS(&piImagingFactory)
);
}
-
+
//Convert SkStream to IStream.
SkTScopedComPtr<IStream> piStream;
if (SUCCEEDED(hr)) {
hr = SkIStream::CreateFromSkStream(stream, false, &piStream);
}
-
+
//Make sure we're at the beginning of the stream.
if (SUCCEEDED(hr)) {
LARGE_INTEGER liBeginning = { 0 };
hr = piStream->Seek(liBeginning, STREAM_SEEK_SET, NULL);
}
-
+
//Create the decoder from the stream content.
SkTScopedComPtr<IWICBitmapDecoder> piBitmapDecoder;
if (SUCCEEDED(hr)) {
@@ -65,13 +65,13 @@
, &piBitmapDecoder //Pointer to the decoder
);
}
-
+
//Get the first frame from the decoder.
SkTScopedComPtr<IWICBitmapFrameDecode> piBitmapFrameDecode;
if (SUCCEEDED(hr)) {
hr = piBitmapDecoder->GetFrame(0, &piBitmapFrameDecode);
}
-
+
//Get the BitmapSource interface of the frame.
SkTScopedComPtr<IWICBitmapSource> piBitmapSourceOriginal;
if (SUCCEEDED(hr)) {
@@ -79,14 +79,14 @@
IID_PPV_ARGS(&piBitmapSourceOriginal)
);
}
-
+
//Get the size of the bitmap.
UINT width;
UINT height;
if (SUCCEEDED(hr)) {
hr = piBitmapSourceOriginal->GetSize(&width, &height);
}
-
+
//Exit early if we're only looking for the bitmap bounds.
if (SUCCEEDED(hr)) {
bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
@@ -97,13 +97,13 @@
return false;
}
}
-
+
//Create a format converter.
SkTScopedComPtr<IWICFormatConverter> piFormatConverter;
if (SUCCEEDED(hr)) {
hr = piImagingFactory->CreateFormatConverter(&piFormatConverter);
}
-
+
if (SUCCEEDED(hr)) {
hr = piFormatConverter->Initialize(
piBitmapSourceOriginal.get() //Input bitmap to convert
@@ -114,7 +114,7 @@
, WICBitmapPaletteTypeCustom //Palette translation type
);
}
-
+
//Get the BitmapSource interface of the format converter.
SkTScopedComPtr<IWICBitmapSource> piBitmapSourceConverted;
if (SUCCEEDED(hr)) {
@@ -122,7 +122,7 @@
IID_PPV_ARGS(&piBitmapSourceConverted)
);
}
-
+
//Copy the pixels into the bitmap.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bm);
@@ -135,7 +135,7 @@
reinterpret_cast<BYTE *>(bm->getPixels())
);
}
-
+
return SUCCEEDED(hr);
}
@@ -197,9 +197,9 @@
if (!scopedCo.succeeded()) {
return false;
}
-
+
HRESULT hr = S_OK;
-
+
//Create Windows Imaging Component ImagingFactory.
SkTScopedComPtr<IWICImagingFactory> piImagingFactory;
if (SUCCEEDED(hr)) {
@@ -210,41 +210,41 @@
, IID_PPV_ARGS(&piImagingFactory)
);
}
-
+
//Convert the SkWStream to an IStream.
SkTScopedComPtr<IStream> piStream;
if (SUCCEEDED(hr)) {
hr = SkWIStream::CreateFromSkWStream(stream, &piStream);
}
-
+
//Create an encode of the appropriate type.
SkTScopedComPtr<IWICBitmapEncoder> piEncoder;
if (SUCCEEDED(hr)) {
hr = piImagingFactory->CreateEncoder(type, NULL, &piEncoder);
}
-
+
if (SUCCEEDED(hr)) {
hr = piEncoder->Initialize(piStream.get(), WICBitmapEncoderNoCache);
}
-
+
//Create a the frame.
SkTScopedComPtr<IWICBitmapFrameEncode> piBitmapFrameEncode;
SkTScopedComPtr<IPropertyBag2> piPropertybag;
if (SUCCEEDED(hr)) {
hr = piEncoder->CreateNewFrame(&piBitmapFrameEncode, &piPropertybag);
}
-
+
if (SUCCEEDED(hr)) {
PROPBAG2 name = { 0 };
name.dwType = PROPBAG2_TYPE_DATA;
name.vt = VT_R4;
name.pstrName = L"ImageQuality";
-
+
VARIANT value;
VariantInit(&value);
value.vt = VT_R4;
value.fltVal = (FLOAT)(quality / 100.0);
-
+
//Ignore result code.
// This returns E_FAIL if the named property is not in the bag.
//TODO(bungeman) enumerate the properties,
@@ -254,14 +254,14 @@
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->Initialize(piPropertybag.get());
}
-
+
//Set the size of the frame.
const UINT width = bitmap->width();
const UINT height = bitmap->height();
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->SetSize(width, height);
}
-
+
//Set the pixel format of the frame.
const WICPixelFormatGUID formatDesired = GUID_WICPixelFormat32bppBGRA;
WICPixelFormatGUID formatGUID = formatDesired;
@@ -272,7 +272,7 @@
//Be sure the image format is the one requested.
hr = IsEqualGUID(formatGUID, formatDesired) ? S_OK : E_FAIL;
}
-
+
//Write the pixels into the frame.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bitmap);
@@ -282,15 +282,15 @@
, bitmap->rowBytes()*height
, reinterpret_cast<BYTE*>(bitmap->getPixels()));
}
-
+
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->Commit();
}
-
+
if (SUCCEEDED(hr)) {
hr = piEncoder->Commit();
}
-
+
return SUCCEEDED(hr);
}
diff --git a/src/ports/SkImageRef_ashmem.cpp b/src/ports/SkImageRef_ashmem.cpp
index 81f24dd..01b950e 100644
--- a/src/ports/SkImageRef_ashmem.cpp
+++ b/src/ports/SkImageRef_ashmem.cpp
@@ -34,14 +34,14 @@
SkBitmap::Config config,
int sampleSize)
: SkImageRef(stream, config, sampleSize) {
-
+
fRec.fFD = -1;
fRec.fAddr = NULL;
fRec.fSize = 0;
fRec.fPinned = false;
-
+
fCT = NULL;
-
+
this->useDefaultMutex(); // we don't need/want the shared imageref mutex
}
@@ -80,7 +80,7 @@
if (-1 == fd) {
SkASSERT(NULL == addr);
SkASSERT(0 == fRec->fSize);
-
+
fd = ashmem_create_region(fName, size);
#ifdef DUMP_ASHMEM_LIFECYCLE
SkDebugf("=== ashmem_create_region %s size=%d fd=%d\n", fName, size, fd);
@@ -90,7 +90,7 @@
fName, size);
return false;
}
-
+
int err = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
if (err) {
SkDebugf("------ ashmem_set_prot_region(%d) failed %d\n",
@@ -98,7 +98,7 @@
close(fd);
return false;
}
-
+
addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (-1 == (long)addr) {
SkDebugf("---------- mmap failed for imageref_ashmem size=%d\n",
@@ -106,7 +106,7 @@
close(fd);
return false;
}
-
+
fRec->fFD = fd;
fRec->fAddr = addr;
fRec->fSize = size;
@@ -120,7 +120,7 @@
fRec->fPinned = true;
return true;
}
-
+
private:
// we just point to our caller's memory, these are not copies
SkAshmemRec* fRec;
@@ -130,13 +130,13 @@
bool SkImageRef_ashmem::onDecode(SkImageDecoder* codec, SkStream* stream,
SkBitmap* bitmap, SkBitmap::Config config,
SkImageDecoder::Mode mode) {
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return this->INHERITED::onDecode(codec, stream, bitmap, config, mode);
}
AshmemAllocator alloc(&fRec, this->getURI());
-
+
codec->setAllocator(&alloc);
bool success = this->INHERITED::onDecode(codec, stream, bitmap, config,
mode);
@@ -192,21 +192,21 @@
} else {
// no FD, will create an ashmem region in allocator
}
-
+
return this->INHERITED::onLockPixels(ct);
}
void SkImageRef_ashmem::onUnlockPixels() {
this->INHERITED::onUnlockPixels();
-
+
if (-1 != fRec.fFD) {
SkASSERT(fRec.fAddr);
SkASSERT(fRec.fPinned);
-
+
ashmem_unpin_region(fRec.fFD, 0, 0);
fRec.fPinned = false;
}
-
+
// we clear this with or without an error, since we've either closed or
// unpinned the region
fBitmap.setPixels(NULL, NULL);
diff --git a/src/ports/SkImageRef_ashmem.h b/src/ports/SkImageRef_ashmem.h
index 5b4e814..f98507a 100644
--- a/src/ports/SkImageRef_ashmem.h
+++ b/src/ports/SkImageRef_ashmem.h
@@ -21,7 +21,7 @@
public:
SkImageRef_ashmem(SkStream*, SkBitmap::Config, int sampleSize = 1);
virtual ~SkImageRef_ashmem();
-
+
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_ashmem)
protected:
@@ -31,10 +31,10 @@
virtual bool onDecode(SkImageDecoder* codec, SkStream* stream,
SkBitmap* bitmap, SkBitmap::Config config,
SkImageDecoder::Mode mode);
-
+
virtual void* onLockPixels(SkColorTable**);
virtual void onUnlockPixels();
-
+
private:
void closeFD();
diff --git a/src/ports/SkThread_pthread.cpp b/src/ports/SkThread_pthread.cpp
index ad243b9..b430dd9 100644
--- a/src/ports/SkThread_pthread.cpp
+++ b/src/ports/SkThread_pthread.cpp
@@ -15,7 +15,7 @@
/**
We prefer the GCC intrinsic implementation of the atomic operations over the
- SkMutex-based implementation. The SkMutex version suffers from static
+ SkMutex-based implementation. The SkMutex version suffers from static
destructor ordering problems.
Note clang also defines the GCC version macros and implements the intrinsics.
TODO: Verify that gcc-style __sync_* intrinsics work on ARM
@@ -82,7 +82,7 @@
int32_t sk_atomic_add(int32_t* addr, int32_t inc)
{
SkAutoMutexAcquire ac(gAtomicMutex);
-
+
int32_t value = *addr;
*addr = value + inc;
return value;
@@ -166,7 +166,7 @@
status = pthread_mutexattr_init(&attr);
print_pthread_error(status);
SkASSERT(0 == status);
-
+
status = pthread_mutex_init((pthread_mutex_t*)fStorage, &attr);
print_pthread_error(status);
SkASSERT(0 == status);
diff --git a/src/ports/SkXMLParser_expat.cpp b/src/ports/SkXMLParser_expat.cpp
index c78dc35..8c1c2bf 100644
--- a/src/ports/SkXMLParser_expat.cpp
+++ b/src/ports/SkXMLParser_expat.cpp
@@ -28,7 +28,7 @@
inline const char* ConvertUnicodeToChar(const short* ch16, size_t len, SkAutoMalloc& ch8Malloc) {
char* ch8 = (char*) ch8Malloc.get();
int index;
- for (index = 0; index < len; index++)
+ for (index = 0; index < len; index++)
ch8[index] = (char) ch16[index];
ch8[index] = '\0';
return ch8;
diff --git a/src/ports/SkXMLParser_tinyxml.cpp b/src/ports/SkXMLParser_tinyxml.cpp
index 2e308aa..de1fbe5 100644
--- a/src/ports/SkXMLParser_tinyxml.cpp
+++ b/src/ports/SkXMLParser_tinyxml.cpp
@@ -22,12 +22,12 @@
while (attr)
{
//printf("walk_elem_attr(%s=\"%s\") ", attr->Name(), attr->Value());
-
+
parser->addAttribute(attr->Name(), attr->Value());
attr = attr->Next();
}
//printf("\n");
-
+
const TiXmlNode* node = elem->FirstChild();
while (node)
{
@@ -37,7 +37,7 @@
parser->text(node->Value(), strlen(node->Value()));
node = node->NextSibling();
}
-
+
parser->endElement(elem->Value());
}
@@ -51,7 +51,7 @@
printf("tinyxml error: <%s> row[%d] col[%d]\n", doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol());
return false;
}
-
+
walk_elem(parser, doc.RootElement());
return true;
}
@@ -59,13 +59,13 @@
bool SkXMLParser::parse(SkStream& stream)
{
size_t size = stream.read(NULL, 0);
-
+
SkAutoMalloc buffer(size + 1);
char* buf = (char*)buffer.get();
-
+
stream.read(buf, size);
buf[size] = 0;
-
+
return load_buf(this, buf);
}
@@ -73,10 +73,10 @@
{
SkAutoMalloc buffer(len + 1);
char* buf = (char*)buffer.get();
-
+
memcpy(buf, doc, len);
buf[len] = 0;
-
+
return load_buf(this, buf);
}
diff --git a/src/ports/SkXMLPullParser_expat.cpp b/src/ports/SkXMLPullParser_expat.cpp
index 825ca68..5fcdff3 100644
--- a/src/ports/SkXMLPullParser_expat.cpp
+++ b/src/ports/SkXMLPullParser_expat.cpp
@@ -18,8 +18,8 @@
{
SkASSERT(src);
char* dst = (char*)chunk.alloc(len + 1, SkChunkAlloc::kThrow_AllocFailType);
-
- memcpy(dst, src, len);
+
+ memcpy(dst, src, len);
dst[len] = 0;
return dst;
}
@@ -37,11 +37,11 @@
struct Data {
Data() : fAlloc(2048), fState(NORMAL) {}
-
+
XML_Parser fParser;
SkXMLPullParser::Curr* fCurr;
SkChunkAlloc fAlloc;
-
+
enum State {
NORMAL,
MISSED_START_TAG,
@@ -58,7 +58,7 @@
SkChunkAlloc& alloc = p->fAlloc;
c->fName = dupstr(alloc, el, strlen(el));
-
+
int n = count_pairs(attr);
SkXMLPullParser::AttrInfo* info = (SkXMLPullParser::AttrInfo*)alloc.alloc(n * sizeof(SkXMLPullParser::AttrInfo),
SkChunkAlloc::kThrow_AllocFailType);
@@ -88,7 +88,7 @@
so we set a flag to notify them of the missed start_tag
*/
p->fState = Data::MISSED_START_TAG;
-
+
SkASSERT(c->fName != NULL);
SkASSERT(strcmp(c->fName, el) == 0);
}
@@ -134,7 +134,7 @@
XML_Error code = XML_GetErrorCode(parser);
int lineNumber = XML_GetCurrentLineNumber(parser);
const char* msg = XML_ErrorString(code);
-
+
printf("-------- XML error [%d] on line %d, %s\n", code, lineNumber, msg);
}
@@ -183,7 +183,7 @@
XML_Status status;
status = XML_ResumeParser(p);
-
+
CHECK_STATUS:
switch (status) {
case XML_STATUS_OK:
@@ -204,7 +204,7 @@
// return a start_tag, and clear the flag so we return end_tag next
SkASSERT(SkXMLPullParser::END_TAG == fCurr.fEventType);
fImpl->fData.fState = Data::RETURN_END_TAG;
- fImpl->fData.fEndTag = fCurr.fName; // save this pointer
+ fImpl->fData.fEndTag = fCurr.fName; // save this pointer
return SkXMLPullParser::START_TAG;
}
break;