aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar sugoi@google.com <sugoi@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-05 18:35:55 +0000
committerGravatar sugoi@google.com <sugoi@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-05 18:35:55 +0000
commite2e8113baa69b5d1a0bae9652a095c1eb44b3a53 (patch)
tree3222ff6642b554fa851756840d1465bdee5d3ac9 /src
parenta718c5e0e56fb2d399273d068fcfedbef43ea90d (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/pdf/SkPDFDevice.cpp2
-rw-r--r--src/pdf/SkPDFFont.cpp26
-rw-r--r--src/pdf/SkPDFFont.h4
-rwxr-xr-xsrc/pdf/SkPDFFontImpl.h3
-rw-r--r--src/pdf/SkPDFImage.cpp12
-rw-r--r--src/pdf/SkPDFImage.h6
-rw-r--r--src/pdf/SkPDFUtils.cpp2
7 files changed, 25 insertions, 30 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index aabc6b3bcc..eae7ab73f0 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -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;
}
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 3d7902d240..a38510ceb0 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -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);
}
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index 847a2af4b5..cda2b5017f 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -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);
diff --git a/src/pdf/SkPDFFontImpl.h b/src/pdf/SkPDFFontImpl.h
index d298a38b76..4b49683a5a 100755
--- a/src/pdf/SkPDFFontImpl.h
+++ b/src/pdf/SkPDFFontImpl.h
@@ -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);
};
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index 1b93f6e045..3533a2c3c0 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 @@ 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 ||
diff --git a/src/pdf/SkPDFImage.h b/src/pdf/SkPDFImage.h
index 48b0157da9..a4203f62ae 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 @@ 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
diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp
index 8cd3a90dd8..90e2058d24 100644
--- a/src/pdf/SkPDFUtils.cpp
+++ b/src/pdf/SkPDFUtils.cpp
@@ -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);