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

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

Issue 723743002: move to modify onCreateDevice virtual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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/SkGpuDevice.cpp ('k') | src/utils/SkDeferredCanvas.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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 enum_must_match_value); 560 enum_must_match_value);
561 SK_COMPILE_ASSERT(SkPaint::kStrokeAndFill_Style == 2, 561 SK_COMPILE_ASSERT(SkPaint::kStrokeAndFill_Style == 2,
562 enum_must_match_value); 562 enum_must_match_value);
563 fContentStream->writeDecAsText(state.fTextFill); 563 fContentStream->writeDecAsText(state.fTextFill);
564 fContentStream->writeText(" Tr\n"); 564 fContentStream->writeText(" Tr\n");
565 currentEntry()->fTextFill = state.fTextFill; 565 currentEntry()->fTextFill = state.fTextFill;
566 } 566 }
567 } 567 }
568 } 568 }
569 569
570 SkBaseDevice* SkPDFDevice::onCreateDevice(const SkImageInfo& info, Usage usage) { 570 SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) {
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 // FIXME: It may be possible to express some filters natively using PDF 574 // FIXME: 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 (http://skbug.com/3043)
576 if (kImageFilter_Usage == usage) { 576 if (kImageFilter_Usage == cinfo.fUsage) {
577 return SkBitmapDevice::Create(info); 577 return SkBitmapDevice::Create(cinfo.fInfo);
578 } 578 }
579 579
580 SkMatrix initialTransform; 580 SkMatrix initialTransform;
581 initialTransform.reset(); 581 initialTransform.reset();
582 SkISize size = SkISize::Make(info.width(), info.height()); 582 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
583 return SkNEW_ARGS(SkPDFDevice, (size, size, initialTransform)); 583 return SkNEW_ARGS(SkPDFDevice, (size, size, initialTransform));
584 } 584 }
585 585
586 586
587 struct ContentEntry { 587 struct ContentEntry {
588 GraphicStateEntry fState; 588 GraphicStateEntry fState;
589 SkDynamicMemoryWStream fContent; 589 SkDynamicMemoryWStream fContent;
590 SkAutoTDelete<ContentEntry> fNext; 590 SkAutoTDelete<ContentEntry> fNext;
591 591
592 // If the stack is too deep we could get Stack Overflow. 592 // If the stack is too deep we could get Stack Overflow.
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 SkAutoTUnref<SkPDFObject> image( 2203 SkAutoTUnref<SkPDFObject> image(
2204 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); 2204 SkPDFCreateImageObject(*bitmap, subset, fEncoder));
2205 if (!image) { 2205 if (!image) {
2206 return; 2206 return;
2207 } 2207 }
2208 2208
2209 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2209 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2210 &content.entry()->fContent); 2210 &content.entry()->fContent);
2211 } 2211 }
2212 2212
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698