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

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

Issue 2268313002: SkPDF: SK_PDF_NEVER_RELY_ON_ADVANCE (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-08-23 (Tuesday) 09:10:31 EDT Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 #include "SkRRect.h" 30 #include "SkRRect.h"
31 #include "SkString.h" 31 #include "SkString.h"
32 #include "SkSurface.h" 32 #include "SkSurface.h"
33 #include "SkTextFormatParams.h" 33 #include "SkTextFormatParams.h"
34 #include "SkTemplates.h" 34 #include "SkTemplates.h"
35 #include "SkTypefacePriv.h" 35 #include "SkTypefacePriv.h"
36 #include "SkXfermodeInterpretation.h" 36 #include "SkXfermodeInterpretation.h"
37 37
38 #define DPI_FOR_RASTER_SCALE_ONE 72 38 #define DPI_FOR_RASTER_SCALE_ONE 72
39 39
40 #if !defined(SK_PDF_NEVER_RELY_ON_ADVANCE) && defined(SK_BUILD_FOR_WIN)
41 #define SK_PDF_NEVER_RELY_ON_ADVANCE
42 #endif
43
40 // Utility functions 44 // Utility functions
41 45
42 // If the paint will definitely draw opaquely, replace kSrc_Mode with 46 // If the paint will definitely draw opaquely, replace kSrc_Mode with
43 // kSrcOver_Mode. http://crbug.com/473572 47 // kSrcOver_Mode. http://crbug.com/473572
44 static void replace_srcmode_on_opaque_paint(SkPaint* paint) { 48 static void replace_srcmode_on_opaque_paint(SkPaint* paint) {
45 if (kSrcOver_SkXfermodeInterpretation 49 if (kSrcOver_SkXfermodeInterpretation
46 == SkInterpretXfermode(*paint, false)) { 50 == SkInterpretXfermode(*paint, false)) {
47 paint->setXfermode(nullptr); 51 paint->setXfermode(nullptr);
48 } 52 }
49 } 53 }
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 fWideChars = wideChars; 992 fWideChars = wideChars;
989 } 993 }
990 } 994 }
991 void writeGlyph(SkScalar x, 995 void writeGlyph(SkScalar x,
992 SkScalar y, 996 SkScalar y,
993 SkScalar advanceWidth, 997 SkScalar advanceWidth,
994 uint16_t glyph) { 998 uint16_t glyph) {
995 if (!fDefaultPositioning) { 999 if (!fDefaultPositioning) {
996 SkScalar xPosition = x - fCurrentMatrixX; 1000 SkScalar xPosition = x - fCurrentMatrixX;
997 SkScalar yPosition = y - fCurrentMatrixY; 1001 SkScalar yPosition = y - fCurrentMatrixY;
998 if (xPosition != fXAdvance || yPosition != 0) { 1002 bool alwaysPosition = false;
1003 #ifdef SK_PDF_NEVER_RELY_ON_ADVANCE
1004 alwaysPosition = true;
1005 #endif
1006 if (alwaysPosition || xPosition != fXAdvance || yPosition != 0) {
999 this->flush(); 1007 this->flush();
1000 SkPDFUtils::AppendScalar(xPosition, fContent); 1008 SkPDFUtils::AppendScalar(xPosition, fContent);
1001 fContent->writeText(" "); 1009 fContent->writeText(" ");
1002 SkPDFUtils::AppendScalar(-yPosition, fContent); 1010 SkPDFUtils::AppendScalar(-yPosition, fContent);
1003 fContent->writeText(" Td "); 1011 fContent->writeText(" Td ");
1004 fCurrentMatrixX = x; 1012 fCurrentMatrixX = x;
1005 fCurrentMatrixY = y; 1013 fCurrentMatrixY = y;
1006 fXAdvance = 0; 1014 fXAdvance = 0;
1007 } 1015 }
1008 fXAdvance += advanceWidth; 1016 fXAdvance += advanceWidth;
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 } 2159 }
2152 2160
2153 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { 2161 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) {
2154 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()), 2162 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()),
2155 image->makeNonTextureImage()); 2163 image->makeNonTextureImage());
2156 } 2164 }
2157 2165
2158 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { 2166 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() {
2159 return nullptr; 2167 return nullptr;
2160 } 2168 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698