Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 944643002: PDF: Now threadsafe! (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: TODO=DONE Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | src/pdf/SkPDFFont.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.cpp
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 7c0aaa280e75b6eade1e3cecf6a332ac12fd36db..90f0a4a7c8a448b7280510c24507164c1e811e92 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -737,7 +737,7 @@ void SkPDFDevice::init() {
fLastMarginContentEntry = NULL;
fDrawingArea = kContent_DrawingArea;
if (fFontGlyphUsage.get() == NULL) {
- fFontGlyphUsage.reset(new SkPDFGlyphSetMap());
+ fFontGlyphUsage.reset(SkNEW(SkPDFGlyphSetMap));
}
}
@@ -1896,8 +1896,10 @@ void SkPDFDevice::populateGraphicStateEntryFromPaint(
fInitialTransform.mapRect(&boundsTemp);
boundsTemp.roundOut(&bounds);
- pdfShader.reset(SkPDFShader::GetPDFShader(*shader, transform, bounds,
- SkIntToScalar(fRasterDpi) / DPI_FOR_RASTER_SCALE_ONE));
+ SkScalar rasterScale =
+ SkIntToScalar(fRasterDpi) / DPI_FOR_RASTER_SCALE_ONE;
+ pdfShader.reset(SkPDFShader::GetPDFShader(
+ fCanon, fRasterDpi, *shader, transform, bounds, rasterScale));
if (pdfShader.get()) {
// pdfShader has been canonicalized so we can directly compare
@@ -1928,12 +1930,12 @@ void SkPDFDevice::populateGraphicStateEntryFromPaint(
SkAutoTUnref<SkPDFGraphicState> newGraphicState;
if (color == paint.getColor()) {
newGraphicState.reset(
- SkPDFGraphicState::GetGraphicStateForPaint(paint));
+ SkPDFGraphicState::GetGraphicStateForPaint(fCanon, paint));
} else {
SkPaint newPaint = paint;
newPaint.setColor(color);
newGraphicState.reset(
- SkPDFGraphicState::GetGraphicStateForPaint(newPaint));
+ SkPDFGraphicState::GetGraphicStateForPaint(fCanon, newPaint));
}
int resourceIndex = addGraphicStateResource(newGraphicState.get());
entry->fGraphicStateIndex = resourceIndex;
@@ -1989,8 +1991,8 @@ void SkPDFDevice::updateFont(const SkPaint& paint, uint16_t glyphID,
}
int SkPDFDevice::getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID) {
- SkAutoTUnref<SkPDFFont> newFont(SkPDFFont::GetFontResource(typeface,
- glyphID));
+ SkAutoTUnref<SkPDFFont> newFont(
+ SkPDFFont::GetFontResource(fCanon, typeface, glyphID));
int resourceIndex = fFontResources.find(newFont.get());
if (resourceIndex < 0) {
resourceIndex = fFontResources.count();
@@ -2133,7 +2135,7 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
}
SkAutoTUnref<SkPDFObject> image(
- SkPDFCreateImageObject(*bitmap, subset));
+ SkPDFCreateImageObject(fCanon, *bitmap, subset));
if (!image) {
return;
}
@@ -2141,4 +2143,3 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
&content.entry()->fContent);
}
-
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | src/pdf/SkPDFFont.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698