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

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

Issue 1432503003: Comments Style: s/skbug.com/bug.skia.org/ (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: include Created 5 years, 1 month 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 | « src/gpu/gl/GrGLCaps.cpp ('k') | src/ports/SkFontMgr_fontconfig.cpp » ('j') | 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 9
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 currentEntry()->fTextFill = state.fTextFill; 565 currentEntry()->fTextFill = state.fTextFill;
566 } 566 }
567 } 567 }
568 } 568 }
569 569
570 static bool not_supported_for_layers(const SkPaint& layerPaint) { 570 static bool not_supported_for_layers(const SkPaint& layerPaint) {
571 // PDF does not support image filters, so render them on CPU. 571 // PDF does not support image filters, so render them on CPU.
572 // Note that this rendering is done at "screen" resolution (100dpi), not 572 // Note that this rendering is done at "screen" resolution (100dpi), not
573 // printer resolution. 573 // printer resolution.
574 // TODO: It may be possible to express some filters natively using PDF 574 // TODO: It may be possible to express some filters natively using PDF
575 // to improve quality and file size (http://skbug.com/3043) 575 // to improve quality and file size (https://bug.skia.org/3043)
576 576
577 // TODO: should we return true if there is a colorfilter? 577 // TODO: should we return true if there is a colorfilter?
578 return layerPaint.getImageFilter() != nullptr; 578 return layerPaint.getImageFilter() != nullptr;
579 } 579 }
580 580
581 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) { 581 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) {
582 if (cinfo.fForImageFilter || 582 if (cinfo.fForImageFilter ||
583 (layerPaint && not_supported_for_layers(*layerPaint))) { 583 (layerPaint && not_supported_for_layers(*layerPaint))) {
584 return nullptr; 584 return nullptr;
585 } 585 }
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 break; 1267 break;
1268 default: 1268 default:
1269 SkFAIL("unknown text encoding"); 1269 SkFAIL("unknown text encoding");
1270 } 1270 }
1271 } 1271 }
1272 1272
1273 1273
1274 void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len, 1274 void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
1275 SkScalar x, SkScalar y, const SkPaint& srcPaint) { 1275 SkScalar x, SkScalar y, const SkPaint& srcPaint) {
1276 if (!SkPDFFont::CanEmbedTypeface(srcPaint.getTypeface(), fCanon)) { 1276 if (!SkPDFFont::CanEmbedTypeface(srcPaint.getTypeface(), fCanon)) {
1277 // http://skbug.com/3866 1277 // https://bug.skia.org/3866
1278 SkPath path; 1278 SkPath path;
1279 srcPaint.getTextPath(text, len, x, y, &path); 1279 srcPaint.getTextPath(text, len, x, y, &path);
1280 this->drawPath(d, path, srcPaint, &SkMatrix::I(), true); 1280 this->drawPath(d, path, srcPaint, &SkMatrix::I(), true);
1281 // Draw text transparently to make it copyable/searchable/accessable. 1281 // Draw text transparently to make it copyable/searchable/accessable.
1282 draw_transparent_text(this, d, text, len, x, y, srcPaint); 1282 draw_transparent_text(this, d, text, len, x, y, srcPaint);
1283 return; 1283 return;
1284 } 1284 }
1285 SkPaint paint = srcPaint; 1285 SkPaint paint = srcPaint;
1286 replace_srcmode_on_opaque_paint(&paint); 1286 replace_srcmode_on_opaque_paint(&paint);
1287 1287
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 SkPath shape; 2342 SkPath shape;
2343 shape.addRect(SkRect::Make(subset)); 2343 shape.addRect(SkRect::Make(subset));
2344 shape.transform(matrix); 2344 shape.transform(matrix);
2345 content.setShape(shape); 2345 content.setShape(shape);
2346 } 2346 }
2347 if (!content.needSource()) { 2347 if (!content.needSource()) {
2348 return; 2348 return;
2349 } 2349 }
2350 2350
2351 if (SkColorFilter* colorFilter = paint.getColorFilter()) { 2351 if (SkColorFilter* colorFilter = paint.getColorFilter()) {
2352 // TODO(http://skbug.com/4378): implement colorfilter on other 2352 // TODO(https://bug.skia.org/4378): implement colorfilter on other
2353 // draw calls. This code here works for all 2353 // draw calls. This code here works for all
2354 // drawBitmap*()/drawImage*() calls amd ImageFilters (which 2354 // drawBitmap*()/drawImage*() calls amd ImageFilters (which
2355 // rasterize a layer on this backend). Fortuanely, this seems 2355 // rasterize a layer on this backend). Fortuanely, this seems
2356 // to be how Chromium impements most color-filters. 2356 // to be how Chromium impements most color-filters.
2357 autoImageUnref.reset(color_filter(image, colorFilter)); 2357 autoImageUnref.reset(color_filter(image, colorFilter));
2358 image = autoImageUnref; 2358 image = autoImageUnref;
2359 // TODO(halcanary): de-dupe this by caching filtered images. 2359 // TODO(halcanary): de-dupe this by caching filtered images.
2360 // (maybe in the resource cache?) 2360 // (maybe in the resource cache?)
2361 } 2361 }
2362 SkAutoTUnref<SkPDFObject> pdfimage(SkSafeRef(fCanon->findPDFBitmap(image))); 2362 SkAutoTUnref<SkPDFObject> pdfimage(SkSafeRef(fCanon->findPDFBitmap(image)));
2363 if (!pdfimage) { 2363 if (!pdfimage) {
2364 pdfimage.reset(SkPDFCreateBitmapObject(image)); 2364 pdfimage.reset(SkPDFCreateBitmapObject(image));
2365 if (!pdfimage) { 2365 if (!pdfimage) {
2366 return; 2366 return;
2367 } 2367 }
2368 fCanon->addPDFBitmap(image->uniqueID(), pdfimage); 2368 fCanon->addPDFBitmap(image->uniqueID(), pdfimage);
2369 } 2369 }
2370 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), 2370 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
2371 &content.entry()->fContent); 2371 &content.entry()->fContent);
2372 } 2372 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698