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

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

Issue 2168483003: Deprecate SkDevice::accessBitmap method (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 5 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFDocument* do c, bool flip) 651 SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFDocument* do c, bool flip)
652 : INHERITED(SkSurfaceProps(0, kUnknown_SkPixelGeometry)) 652 : INHERITED(SkSurfaceProps(0, kUnknown_SkPixelGeometry))
653 , fPageSize(pageSize) 653 , fPageSize(pageSize)
654 , fContentSize(pageSize) 654 , fContentSize(pageSize)
655 , fExistingClipRegion(SkIRect::MakeSize(pageSize)) 655 , fExistingClipRegion(SkIRect::MakeSize(pageSize))
656 , fClipStack(nullptr) 656 , fClipStack(nullptr)
657 , fRasterDpi(rasterDpi) 657 , fRasterDpi(rasterDpi)
658 , fDocument(doc) { 658 , fDocument(doc) {
659 SkASSERT(pageSize.width() > 0); 659 SkASSERT(pageSize.width() > 0);
660 SkASSERT(pageSize.height() > 0); 660 SkASSERT(pageSize.height() > 0);
661 fLegacyBitmap.setInfo( 661
662 SkImageInfo::MakeUnknown(pageSize.width(), pageSize.height()));
663 if (flip) { 662 if (flip) {
664 // Skia generally uses the top left as the origin but PDF 663 // Skia generally uses the top left as the origin but PDF
665 // natively has the origin at the bottom left. This matrix 664 // natively has the origin at the bottom left. This matrix
666 // corrects for that. But that only needs to be done once, we 665 // corrects for that. But that only needs to be done once, we
667 // don't do it when layering. 666 // don't do it when layering.
668 fInitialTransform.setTranslate(0, SkIntToScalar(pageSize.fHeight)); 667 fInitialTransform.setTranslate(0, SkIntToScalar(pageSize.fHeight));
669 fInitialTransform.preScale(SK_Scalar1, -SK_Scalar1); 668 fInitialTransform.preScale(SK_Scalar1, -SK_Scalar1);
670 } else { 669 } else {
671 fInitialTransform.setIdentity(); 670 fInitialTransform.setIdentity();
672 } 671 }
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 if (!content.needSource()) { 1394 if (!content.needSource()) {
1396 return; 1395 return;
1397 } 1396 }
1398 1397
1399 auto xObject = sk_make_sp<SkPDFFormXObject>(pdfDevice); 1398 auto xObject = sk_make_sp<SkPDFFormXObject>(pdfDevice);
1400 SkPDFUtils::DrawFormXObject(this->addXObjectResource(xObject.get()), 1399 SkPDFUtils::DrawFormXObject(this->addXObjectResource(xObject.get()),
1401 &content.entry()->fContent); 1400 &content.entry()->fContent);
1402 } 1401 }
1403 1402
1404 SkImageInfo SkPDFDevice::imageInfo() const { 1403 SkImageInfo SkPDFDevice::imageInfo() const {
1405 return fLegacyBitmap.info(); 1404 SkImageInfo info = SkImageInfo::MakeUnknown(fPageSize.width(), fPageSize.hei ght());
1405 return info;
1406 } 1406 }
1407 1407
1408 void SkPDFDevice::onAttachToCanvas(SkCanvas* canvas) { 1408 void SkPDFDevice::onAttachToCanvas(SkCanvas* canvas) {
1409 INHERITED::onAttachToCanvas(canvas); 1409 INHERITED::onAttachToCanvas(canvas);
1410 1410
1411 // Canvas promises that this ptr is valid until onDetachFromCanvas is called 1411 // Canvas promises that this ptr is valid until onDetachFromCanvas is called
1412 fClipStack = canvas->getClipStack(); 1412 fClipStack = canvas->getClipStack();
1413 } 1413 }
1414 1414
1415 void SkPDFDevice::onDetachFromCanvas() { 1415 void SkPDFDevice::onDetachFromCanvas() {
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 } 2255 }
2256 2256
2257 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { 2257 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) {
2258 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()), 2258 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()),
2259 image->makeNonTextureImage()); 2259 image->makeNonTextureImage());
2260 } 2260 }
2261 2261
2262 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { 2262 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() {
2263 return nullptr; 2263 return nullptr;
2264 } 2264 }
OLDNEW
« src/gpu/SkGpuDevice.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