PDF : Unused parameters cleanup

I removed unused parameters in the PDFs wherever it was trivial to do so. A few constructors had to change signature in the process to reflect the changes.
Review URL: https://codereview.appspot.com/7390056

git-svn-id: http://skia.googlecode.com/svn/trunk@7987 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
sugoi@google.com 2013-03-05 18:35:55 +00:00
parent a718c5e0e5
commit e2e8113baa
7 changed files with 25 additions and 30 deletions

View File

@ -1709,7 +1709,7 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& matrix,
return;
}
SkPDFImage* image = SkPDFImage::CreateImage(bitmap, subset, paint);
SkPDFImage* image = SkPDFImage::CreateImage(bitmap, subset);
if (!image) {
return;
}

View File

@ -579,6 +579,9 @@ static int get_subset_font_stream(const char* fontName,
*fontStream = subsetFontStream;
return fontSize;
}
#else
sk_ignore_unused_variable(fontName);
sk_ignore_unused_variable(subset);
#endif
// Fail over: just embed the whole font.
@ -812,7 +815,7 @@ SkPDFFont* SkPDFFont::GetFontResource(SkTypeface* typeface, uint16_t glyphID) {
return font; // Return the reference new SkPDFFont() created.
}
SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet* usage) {
SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) {
return NULL; // Default: no support.
}
@ -845,12 +848,13 @@ bool SkPDFFont::Find(uint32_t fontID, uint16_t glyphID, int* index) {
}
SkPDFFont::SkPDFFont(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface,
uint16_t glyphID, bool descendantFont)
SkPDFDict* relatedFontDescriptor)
: SkPDFDict("Font"),
fTypeface(typeface),
fFirstGlyphID(1),
fLastGlyphID(info ? info->fLastGlyphID : 0),
fFontInfo(info) {
fFontInfo(info),
fDescriptor(relatedFontDescriptor) {
SkSafeRef(typeface);
SkSafeRef(info);
if (info == NULL) {
@ -873,8 +877,7 @@ SkPDFFont* SkPDFFont::Create(SkAdvancedTypefaceMetrics* info,
NOT_IMPLEMENTED(true, true);
return new SkPDFType3Font(info,
typeface,
glyphID,
relatedFontDescriptor);
glyphID);
}
if (type == SkAdvancedTypefaceMetrics::kType1CID_Font ||
type == SkAdvancedTypefaceMetrics::kTrueType_Font) {
@ -892,7 +895,7 @@ SkPDFFont* SkPDFFont::Create(SkAdvancedTypefaceMetrics* info,
type == SkAdvancedTypefaceMetrics::kOther_Font ||
type == SkAdvancedTypefaceMetrics::kNotEmbeddable_Font);
return new SkPDFType3Font(info, typeface, glyphID, relatedFontDescriptor);
return new SkPDFType3Font(info, typeface, glyphID);
}
SkAdvancedTypefaceMetrics* SkPDFFont::fontInfo() {
@ -1014,7 +1017,7 @@ void SkPDFFont::populateToUnicodeTable(const SkPDFGlyphSet* subset) {
SkPDFType0Font::SkPDFType0Font(SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface)
: SkPDFFont(info, typeface, 0, false) {
: SkPDFFont(info, typeface, NULL) {
SkDEBUGCODE(fPopulated = false);
}
@ -1058,7 +1061,7 @@ bool SkPDFType0Font::populate(const SkPDFGlyphSet* subset) {
SkPDFCIDFont::SkPDFCIDFont(SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface, const SkPDFGlyphSet* subset)
: SkPDFFont(info, typeface, 0, true) {
: SkPDFFont(info, typeface, NULL) {
populate(subset);
}
@ -1204,7 +1207,7 @@ SkPDFType1Font::SkPDFType1Font(SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface,
uint16_t glyphID,
SkPDFDict* relatedFontDescriptor)
: SkPDFFont(info, typeface, glyphID, false) {
: SkPDFFont(info, typeface, relatedFontDescriptor) {
populate(glyphID);
}
@ -1329,9 +1332,8 @@ void SkPDFType1Font::addWidthInfoFromRange(
SkPDFType3Font::SkPDFType3Font(SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface,
uint16_t glyphID,
SkPDFDict* relatedFontDescriptor)
: SkPDFFont(info, typeface, glyphID, false) {
uint16_t glyphID)
: SkPDFFont(info, typeface, NULL) {
populate(glyphID);
}

View File

@ -133,7 +133,7 @@ public:
protected:
// Common constructor to handle common members.
SkPDFFont(SkAdvancedTypefaceMetrics* fontInfo, SkTypeface* typeface,
uint16_t glyphID, bool descendantFont);
SkPDFDict* relatedFontDescriptor);
// Accessors for subclass.
SkAdvancedTypefaceMetrics* fontInfo();
@ -164,7 +164,7 @@ protected:
// Create instances of derived types based on fontInfo.
static SkPDFFont* Create(SkAdvancedTypefaceMetrics* fontInfo,
SkTypeface* typeface, uint16_t glyphID,
SkPDFDict* fontDescriptor);
SkPDFDict* relatedFontDescriptor);
static bool Find(uint32_t fontID, uint16_t glyphID, int* index);

View File

@ -75,8 +75,7 @@ public:
private:
friend class SkPDFFont; // to access the constructor
SkPDFType3Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface,
uint16_t glyphID, SkPDFDict* relatedFontDescriptor);
SkPDFType3Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, uint16_t glyphID);
bool populate(int16_t glyphID);
};

View File

@ -12,7 +12,6 @@
#include "SkBitmap.h"
#include "SkColor.h"
#include "SkColorPriv.h"
#include "SkPaint.h"
#include "SkPackBits.h"
#include "SkPDFCatalog.h"
#include "SkRect.h"
@ -250,8 +249,7 @@ SkPDFArray* makeIndexedColorSpace(SkColorTable* table) {
// static
SkPDFImage* SkPDFImage::CreateImage(const SkBitmap& bitmap,
const SkIRect& srcRect,
const SkPaint& paint) {
const SkIRect& srcRect) {
if (bitmap.getConfig() == SkBitmap::kNo_Config) {
return NULL;
}
@ -267,11 +265,10 @@ SkPDFImage* SkPDFImage::CreateImage(const SkBitmap& bitmap,
}
SkPDFImage* image =
new SkPDFImage(imageData, bitmap, srcRect, false, paint);
new SkPDFImage(imageData, bitmap, srcRect, false);
if (alphaData != NULL) {
image->addSMask(new SkPDFImage(alphaData, bitmap, srcRect, true,
paint))->unref();
image->addSMask(new SkPDFImage(alphaData, bitmap, srcRect, true))->unref();
}
return image;
}
@ -292,8 +289,7 @@ void SkPDFImage::getResources(SkTDArray<SkPDFObject*>* resourceList) {
}
SkPDFImage::SkPDFImage(SkStream* imageData, const SkBitmap& bitmap,
const SkIRect& srcRect, bool doingAlpha,
const SkPaint& paint) {
const SkIRect& srcRect, bool doingAlpha) {
this->setData(imageData);
SkBitmap::Config config = bitmap.getConfig();
bool alphaOnly = (config == SkBitmap::kA1_Config ||

View File

@ -15,7 +15,6 @@
#include "SkRefCnt.h"
class SkBitmap;
class SkPaint;
class SkPDFCatalog;
struct SkIRect;
@ -37,8 +36,7 @@ public:
* the given parameters.
*/
static SkPDFImage* CreateImage(const SkBitmap& bitmap,
const SkIRect& srcRect,
const SkPaint& paint);
const SkIRect& srcRect);
virtual ~SkPDFImage();
@ -64,7 +62,7 @@ private:
* @param paint Used to calculate alpha, masks, etc.
*/
SkPDFImage(SkStream* imageData, const SkBitmap& bitmap,
const SkIRect& srcRect, bool alpha, const SkPaint& paint);
const SkIRect& srcRect, bool alpha);
};
#endif

View File

@ -114,7 +114,7 @@ void SkPDFUtils::EmitPath(const SkPath& path, SkPaint::Style paintStyle,
if (paintStyle != SkPaint::kFill_Style) {
fillState = kNonSingleLine_SkipFillState;
}
SkPoint lastMovePt;
SkPoint lastMovePt = SkPoint::Make(0,0);
SkDynamicMemoryWStream currentSegment;
SkPoint args[4];
SkPath::Iter iter(path, false);