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

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

Issue 2273073002: SkPDF: vector canvases can't hint! (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
« 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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 // Validate user-input glyphs. 1124 // Validate user-input glyphs.
1125 SkGlyphID maxGlyphID = SkToU16(typefaceGlyphCount - 1); 1125 SkGlyphID maxGlyphID = SkToU16(typefaceGlyphCount - 1);
1126 for (int i = 0; i < glyphCount; ++i) { 1126 for (int i = 0; i < glyphCount; ++i) {
1127 glyphs[i] = SkTMin(maxGlyphID, glyphs[i]); 1127 glyphs[i] = SkTMin(maxGlyphID, glyphs[i]);
1128 } 1128 }
1129 } else { 1129 } else {
1130 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 1130 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
1131 } 1131 }
1132 1132
1133 bool defaultPositioning = (positioning == SkTextBlob::kDefault_Positioning); 1133 bool defaultPositioning = (positioning == SkTextBlob::kDefault_Positioning);
1134 paint.setHinting(SkPaint::kNo_Hinting);
1134 SkAutoGlyphCache glyphCache(paint, nullptr, nullptr); 1135 SkAutoGlyphCache glyphCache(paint, nullptr, nullptr);
1135 1136
1136 SkPaint::Align alignment = paint.getTextAlign(); 1137 SkPaint::Align alignment = paint.getTextAlign();
1137 if (defaultPositioning && alignment != SkPaint::kLeft_Align) { 1138 if (defaultPositioning && alignment != SkPaint::kLeft_Align) {
1138 SkScalar advance{0}; 1139 SkScalar advance{0};
1139 for (int i = 0; i < glyphCount; ++i) { 1140 for (int i = 0; i < glyphCount; ++i) {
1140 advance += glyphCache->getGlyphIDAdvance(glyphs[i]).fAdvanceX; 1141 advance += glyphCache->getGlyphIDAdvance(glyphs[i]).fAdvanceX;
1141 } 1142 }
1142 SkScalar m = alignment == SkPaint::kCenter_Align 1143 SkScalar m = alignment == SkPaint::kCenter_Align
1143 ? 0.5f * advance : advance; 1144 ? 0.5f * advance : advance;
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 } 2145 }
2145 2146
2146 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { 2147 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) {
2147 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()), 2148 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()),
2148 image->makeNonTextureImage()); 2149 image->makeNonTextureImage());
2149 } 2150 }
2150 2151
2151 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { 2152 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() {
2152 return nullptr; 2153 return nullptr;
2153 } 2154 }
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