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

Side by Side Diff: src/pdf/SkPDFDevice.cpp

Issue 2261003003: store info in basedevice, change getter to non-virtual const& (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
9 #include "SkAnnotationKeys.h" 9 #include "SkAnnotationKeys.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 552 }
553 fContentEntry = fDevice->setUpContentEntry(clipStack, clipRegion, 553 fContentEntry = fDevice->setUpContentEntry(clipStack, clipRegion,
554 matrix, paint, hasText, 554 matrix, paint, hasText,
555 &fDstFormXObject); 555 &fDstFormXObject);
556 } 556 }
557 }; 557 };
558 558
559 //////////////////////////////////////////////////////////////////////////////// 559 ////////////////////////////////////////////////////////////////////////////////
560 560
561 SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFDocument* do c, bool flip) 561 SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFDocument* do c, bool flip)
562 : INHERITED(SkSurfaceProps(0, kUnknown_SkPixelGeometry)) 562 : INHERITED(SkImageInfo::MakeUnknown(pageSize.width(), pageSize.height()),
563 SkSurfaceProps(0, kUnknown_SkPixelGeometry))
563 , fPageSize(pageSize) 564 , fPageSize(pageSize)
564 , fContentSize(pageSize) 565 , fContentSize(pageSize)
565 , fExistingClipRegion(SkIRect::MakeSize(pageSize)) 566 , fExistingClipRegion(SkIRect::MakeSize(pageSize))
566 , fRasterDpi(rasterDpi) 567 , fRasterDpi(rasterDpi)
567 , fDocument(doc) { 568 , fDocument(doc) {
568 SkASSERT(pageSize.width() > 0); 569 SkASSERT(pageSize.width() > 0);
569 SkASSERT(pageSize.height() > 0); 570 SkASSERT(pageSize.height() > 0);
570 571
571 if (flip) { 572 if (flip) {
572 // Skia generally uses the top left as the origin but PDF 573 // Skia generally uses the top left as the origin but PDF
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } 1288 }
1288 if (!content.needSource()) { 1289 if (!content.needSource()) {
1289 return; 1290 return;
1290 } 1291 }
1291 1292
1292 sk_sp<SkPDFObject> xObject = pdfDevice->makeFormXObjectFromDevice(); 1293 sk_sp<SkPDFObject> xObject = pdfDevice->makeFormXObjectFromDevice();
1293 SkPDFUtils::DrawFormXObject(this->addXObjectResource(xObject.get()), 1294 SkPDFUtils::DrawFormXObject(this->addXObjectResource(xObject.get()),
1294 &content.entry()->fContent); 1295 &content.entry()->fContent);
1295 } 1296 }
1296 1297
1297 SkImageInfo SkPDFDevice::imageInfo() const {
1298 SkImageInfo info = SkImageInfo::MakeUnknown(fPageSize.width(), fPageSize.hei ght());
1299 return info;
1300 }
1301
1302 sk_sp<SkSurface> SkPDFDevice::makeSurface(const SkImageInfo& info, const SkSurfa ceProps& props) { 1298 sk_sp<SkSurface> SkPDFDevice::makeSurface(const SkImageInfo& info, const SkSurfa ceProps& props) {
1303 return SkSurface::MakeRaster(info, &props); 1299 return SkSurface::MakeRaster(info, &props);
1304 } 1300 }
1305 1301
1306 1302
1307 sk_sp<SkPDFDict> SkPDFDevice::makeResourceDict() const { 1303 sk_sp<SkPDFDict> SkPDFDevice::makeResourceDict() const {
1308 SkTDArray<SkPDFObject*> fonts; 1304 SkTDArray<SkPDFObject*> fonts;
1309 fonts.setReserve(fFontResources.count()); 1305 fonts.setReserve(fFontResources.count());
1310 for (SkPDFFont* font : fFontResources) { 1306 for (SkPDFFont* font : fFontResources) {
1311 fonts.push(font); 1307 fonts.push(font);
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 } 2151 }
2156 2152
2157 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { 2153 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) {
2158 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()), 2154 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()),
2159 image->makeNonTextureImage()); 2155 image->makeNonTextureImage());
2160 } 2156 }
2161 2157
2162 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { 2158 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() {
2163 return nullptr; 2159 return nullptr;
2164 } 2160 }
OLDNEW
« include/core/SkDevice.h ('K') | « src/pdf/SkPDFDevice.h ('k') | src/svg/SkSVGDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698