Bug 1340627 - part 4 - fix thebes for Skia m59. r=mchang

MozReview-Commit-ID: JDlSyKeT389
This commit is contained in:
Lee Salzman 2017-05-09 22:31:07 -04:00
Родитель 836ee7f95b
Коммит 8c776dd5bc
2 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -67,7 +67,7 @@ PrintTargetSkPDF::BeginPrinting(const nsAString& aTitle,
nsresult nsresult
PrintTargetSkPDF::BeginPage() PrintTargetSkPDF::BeginPage()
{ {
mPageCanvas = sk_ref_sp(mPDFDoc->beginPage(mSize.width, mSize.height)); mPageCanvas = mPDFDoc->beginPage(mSize.width, mSize.height);
return !mPageCanvas ? NS_ERROR_FAILURE : PrintTarget::BeginPage(); return !mPageCanvas ? NS_ERROR_FAILURE : PrintTarget::BeginPage();
} }
@ -113,7 +113,7 @@ PrintTargetSkPDF::MakeDrawTarget(const IntSize& aSize,
if (!mPageCanvas) { if (!mPageCanvas) {
return nullptr; return nullptr;
} }
mPageDT = Factory::CreateDrawTargetWithSkCanvas(mPageCanvas.get()); mPageDT = Factory::CreateDrawTargetWithSkCanvas(mPageCanvas);
if (!mPageDT) { if (!mPageDT) {
mPageCanvas = nullptr; mPageCanvas = nullptr;
return nullptr; return nullptr;
@ -133,12 +133,12 @@ PrintTargetSkPDF::GetReferenceDrawTarget(DrawEventRecorder* aRecorder)
if (!mRefPDFDoc) { if (!mRefPDFDoc) {
return nullptr; return nullptr;
} }
mRefCanvas = sk_ref_sp(mRefPDFDoc->beginPage(mSize.width, mSize.height)); mRefCanvas = mRefPDFDoc->beginPage(mSize.width, mSize.height);
if (!mRefCanvas) { if (!mRefCanvas) {
return nullptr; return nullptr;
} }
RefPtr<DrawTarget> dt = RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetWithSkCanvas(mRefCanvas.get()); Factory::CreateDrawTargetWithSkCanvas(mRefCanvas);
if (!dt) { if (!dt) {
return nullptr; return nullptr;
} }

Просмотреть файл

@ -59,12 +59,14 @@ private:
UniquePtr<SkWStream> mOStream; UniquePtr<SkWStream> mOStream;
// The current page's SkCanvas and its wrapping DrawTarget: // The current page's SkCanvas and its wrapping DrawTarget:
sk_sp<SkCanvas> mPageCanvas; // Canvas is owned by mPDFDoc, which handles its deletion.
SkCanvas* mPageCanvas;
RefPtr<DrawTarget> mPageDT; RefPtr<DrawTarget> mPageDT;
// Members needed to provide a reference DrawTarget: // Members needed to provide a reference DrawTarget:
sk_sp<SkDocument> mRefPDFDoc; sk_sp<SkDocument> mRefPDFDoc;
sk_sp<SkCanvas> mRefCanvas; // Canvas owned by mRefPDFDoc, which handles its deletion.
SkCanvas* mRefCanvas;
SkDynamicMemoryWStream mRefOStream; SkDynamicMemoryWStream mRefOStream;
}; };