aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFDevice.cpp
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-23 21:13:30 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-23 21:13:30 +0000
commit31dcee7b84ac8a50fe8269a39ac0431b01da48d1 (patch)
tree255ed941c795fdf6479562417119c43f6a35c3bb /src/pdf/SkPDFDevice.cpp
parent6504cfdfc035f0a2cb854be9df352159873b9d62 (diff)
Revert "[PDF] Refactor SkPDFFont to enable font/cmap subsetting."
The PDF xref table is corrupt with this change. Revert until we figure it out. Review URL: http://codereview.appspot.com/4803049 git-svn-id: http://skia.googlecode.com/svn/trunk@1944 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r--src/pdf/SkPDFDevice.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index e2dfba6941..619d55d4c1 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -424,8 +424,8 @@ void GraphicStackState::updateDrawingState(const GraphicStateEntry& state) {
}
}
-SkDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
+SkDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
bool isOpaque,
Usage usage) {
SkMatrix initialTransform;
@@ -544,7 +544,7 @@ SkPDFDevice::SkPDFDevice(const SkISize& layerSize,
}
SkPDFDevice::~SkPDFDevice() {
- this->cleanUp(true);
+ this->cleanUp();
}
void SkPDFDevice::init() {
@@ -553,24 +553,18 @@ void SkPDFDevice::init() {
fLastContentEntry = NULL;
fMarginContentEntries.reset();
fLastMarginContentEntry = NULL;
- fDrawingArea = kContent_DrawingArea;
- if (fFontGlyphUsage == NULL) {
- fFontGlyphUsage.reset(new SkPDFGlyphSetMap());
- }
+ fDrawingArea = kContent_DrawingArea;
}
-void SkPDFDevice::cleanUp(bool clearFontUsage) {
+void SkPDFDevice::cleanUp() {
fGraphicStateResources.unrefAll();
fXObjectResources.unrefAll();
fFontResources.unrefAll();
fShaderResources.unrefAll();
- if (clearFontUsage) {
- fFontGlyphUsage->reset();
- }
}
void SkPDFDevice::clear(SkColor color) {
- this->cleanUp(true);
+ this->cleanUp();
this->init();
SkPaint paint;
@@ -831,8 +825,6 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
size_t availableGlyphs =
font->glyphsToPDFFontEncoding(glyphIDs + consumedGlyphCount,
numGlyphs - consumedGlyphCount);
- fFontGlyphUsage->noteGlyphUsage(font, glyphIDs + consumedGlyphCount,
- availableGlyphs);
SkString encodedString =
SkPDFString::FormatString(glyphIDs + consumedGlyphCount,
availableGlyphs, font->multiByteGlyphs());
@@ -901,7 +893,6 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
i--;
continue;
}
- fFontGlyphUsage->noteGlyphUsage(font, &encodedValue, 1);
SkScalar x = pos[i * scalarsPerPos];
SkScalar y = scalarsPerPos == 1 ? constY : pos[i * scalarsPerPos + 1];
align_text(glyphCacheProc, textPaint, glyphIDs + i, 1, &x, &y, NULL);
@@ -961,9 +952,6 @@ void SkPDFDevice::drawDevice(const SkDraw& d, SkDevice* device, int x, int y,
fXObjectResources.push(xobject); // Transfer reference.
SkPDFUtils::DrawFormXObject(fXObjectResources.count() - 1,
&content.entry()->fContent);
-
- // Merge glyph sets from the drawn device.
- fFontGlyphUsage->merge(pdfDevice->getFontGlyphUsage());
}
ContentEntry* SkPDFDevice::getLastContentEntry() {
@@ -1154,7 +1142,7 @@ SkData* SkPDFDevice::copyContentToData() const {
SkRect r = SkRect::MakeWH(this->width(), this->height());
emit_clip(NULL, &r, &data);
}
-
+
SkPDFDevice::copyContentEntriesToData(fContentEntries.get(), &data);
// potentially we could cache this SkData, and only rebuild it if we
@@ -1166,10 +1154,7 @@ void SkPDFDevice::createFormXObjectFromDevice(
SkRefPtr<SkPDFFormXObject>* xobject) {
*xobject = new SkPDFFormXObject(this);
(*xobject)->unref(); // SkRefPtr and new both took a reference.
- // We always draw the form xobjects that we create back into the device, so
- // we simply preserve the font usage instead of pulling it out and merging
- // it back in later.
- cleanUp(false); // Reset this device to have no content.
+ cleanUp(); // Reset this device to have no content.
init();
}