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
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index aabc6b3..eae7ab7 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1709,7 +1709,7 @@
return;
}
- SkPDFImage* image = SkPDFImage::CreateImage(bitmap, subset, paint);
+ SkPDFImage* image = SkPDFImage::CreateImage(bitmap, subset);
if (!image) {
return;
}
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 3d7902d..a38510c 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -579,6 +579,9 @@
*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 @@
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 @@
}
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 @@
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 @@
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 @@
SkPDFType0Font::SkPDFType0Font(SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface)
- : SkPDFFont(info, typeface, 0, false) {
+ : SkPDFFont(info, typeface, NULL) {
SkDEBUGCODE(fPopulated = false);
}
@@ -1058,7 +1061,7 @@
SkPDFCIDFont::SkPDFCIDFont(SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface, const SkPDFGlyphSet* subset)
- : SkPDFFont(info, typeface, 0, true) {
+ : SkPDFFont(info, typeface, NULL) {
populate(subset);
}
@@ -1204,7 +1207,7 @@
SkTypeface* typeface,
uint16_t glyphID,
SkPDFDict* relatedFontDescriptor)
- : SkPDFFont(info, typeface, glyphID, false) {
+ : SkPDFFont(info, typeface, relatedFontDescriptor) {
populate(glyphID);
}
@@ -1329,9 +1332,8 @@
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);
}
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index 847a2af..cda2b50 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -133,7 +133,7 @@
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 @@
// 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);
diff --git a/src/pdf/SkPDFFontImpl.h b/src/pdf/SkPDFFontImpl.h
index d298a38..4b49683 100755
--- a/src/pdf/SkPDFFontImpl.h
+++ b/src/pdf/SkPDFFontImpl.h
@@ -75,8 +75,7 @@
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);
};
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index 1b93f6e..3533a2c 100644
--- a/src/pdf/SkPDFImage.cpp
+++ b/src/pdf/SkPDFImage.cpp
@@ -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 @@
// 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* 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 @@
}
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 ||
diff --git a/src/pdf/SkPDFImage.h b/src/pdf/SkPDFImage.h
index 48b0157..a4203f6 100644
--- a/src/pdf/SkPDFImage.h
+++ b/src/pdf/SkPDFImage.h
@@ -15,7 +15,6 @@
#include "SkRefCnt.h"
class SkBitmap;
-class SkPaint;
class SkPDFCatalog;
struct SkIRect;
@@ -37,8 +36,7 @@
* the given parameters.
*/
static SkPDFImage* CreateImage(const SkBitmap& bitmap,
- const SkIRect& srcRect,
- const SkPaint& paint);
+ const SkIRect& srcRect);
virtual ~SkPDFImage();
@@ -64,7 +62,7 @@
* @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
diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp
index 8cd3a90..90e2058 100644
--- a/src/pdf/SkPDFUtils.cpp
+++ b/src/pdf/SkPDFUtils.cpp
@@ -114,7 +114,7 @@
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);