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

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

Issue 1772493002: SkPDF: AutoTUnref<T> changes in use (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « src/pdf/SkPDFResourceDict.cpp ('k') | src/pdf/SkPDFTypes.h » ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPDFShader.h" 10 #include "SkPDFShader.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 bbox.set(state.fBBox); 586 bbox.set(state.fBBox);
587 587
588 SkAutoTDelete<SkPDFShader::State> alphaToLuminosityState( 588 SkAutoTDelete<SkPDFShader::State> alphaToLuminosityState(
589 state.CreateAlphaToLuminosityState()); 589 state.CreateAlphaToLuminosityState());
590 SkAutoTUnref<SkPDFObject> luminosityShader( 590 SkAutoTUnref<SkPDFObject> luminosityShader(
591 get_pdf_shader_by_state(canon, dpi, &alphaToLuminosityState)); 591 get_pdf_shader_by_state(canon, dpi, &alphaToLuminosityState));
592 592
593 SkAutoTDelete<SkStream> alphaStream(create_pattern_fill_content(-1, bbox)); 593 SkAutoTDelete<SkStream> alphaStream(create_pattern_fill_content(-1, bbox));
594 594
595 SkAutoTUnref<SkPDFDict> 595 SkAutoTUnref<SkPDFDict>
596 resources(get_gradient_resource_dict(luminosityShader, nullptr)); 596 resources(get_gradient_resource_dict(luminosityShader.get(), nullptr));
597 597
598 SkAutoTUnref<SkPDFFormXObject> alphaMask( 598 SkAutoTUnref<SkPDFFormXObject> alphaMask(
599 new SkPDFFormXObject(alphaStream.get(), bbox, resources.get())); 599 new SkPDFFormXObject(alphaStream.get(), bbox, resources.get()));
600 600
601 return SkPDFGraphicState::GetSMaskGraphicState( 601 return SkPDFGraphicState::GetSMaskGraphicState(
602 alphaMask.get(), false, 602 alphaMask.get(), false,
603 SkPDFGraphicState::kLuminosity_SMaskMode); 603 SkPDFGraphicState::kLuminosity_SMaskMode);
604 } 604 }
605 605
606 SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create( 606 SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create(
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 functionCode = codeFunction(*info, perspectiveInverseOnly); 799 functionCode = codeFunction(*info, perspectiveInverseOnly);
800 } 800 }
801 801
802 SkAutoTUnref<SkPDFDict> pdfShader(new SkPDFDict); 802 SkAutoTUnref<SkPDFDict> pdfShader(new SkPDFDict);
803 pdfShader->insertInt("ShadingType", 1); 803 pdfShader->insertInt("ShadingType", 1);
804 pdfShader->insertName("ColorSpace", "DeviceRGB"); 804 pdfShader->insertName("ColorSpace", "DeviceRGB");
805 pdfShader->insertObject("Domain", SkRef(domain.get())); 805 pdfShader->insertObject("Domain", SkRef(domain.get()));
806 806
807 SkAutoTUnref<SkPDFStream> function( 807 SkAutoTUnref<SkPDFStream> function(
808 make_ps_function(functionCode, domain.get())); 808 make_ps_function(functionCode, domain.get()));
809 pdfShader->insertObjRef("Function", function.detach()); 809 pdfShader->insertObjRef("Function", function.release());
810 810
811 SkPDFFunctionShader* pdfFunctionShader = new SkPDFFunctionShader(autoState-> detach()); 811 SkAutoTUnref<SkPDFFunctionShader> pdfFunctionShader(new SkPDFFunctionShader( autoState->detach()));
812 812
813 pdfFunctionShader->insertInt("PatternType", 2); 813 pdfFunctionShader->insertInt("PatternType", 2);
814 pdfFunctionShader->insertObject("Matrix", 814 pdfFunctionShader->insertObject("Matrix",
815 SkPDFUtils::MatrixToArray(finalMatrix)); 815 SkPDFUtils::MatrixToArray(finalMatrix));
816 pdfFunctionShader->insertObject("Shading", pdfShader.detach()); 816 pdfFunctionShader->insertObject("Shading", pdfShader.release());
817 817
818 canon->addFunctionShader(pdfFunctionShader); 818 canon->addFunctionShader(pdfFunctionShader.get());
819 return pdfFunctionShader; 819 return pdfFunctionShader.release();
820 } 820 }
821 821
822 SkPDFImageShader* SkPDFImageShader::Create( 822 SkPDFImageShader* SkPDFImageShader::Create(
823 SkPDFCanon* canon, 823 SkPDFCanon* canon,
824 SkScalar dpi, 824 SkScalar dpi,
825 SkAutoTDelete<SkPDFShader::State>* autoState) { 825 SkAutoTDelete<SkPDFShader::State>* autoState) {
826 const SkPDFShader::State& state = **autoState; 826 const SkPDFShader::State& state = **autoState;
827 827
828 state.fImage.lockPixels(); 828 state.fImage.lockPixels();
829 829
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 return false; 1224 return false;
1225 } 1225 }
1226 1226
1227 void SkPDFShader::State::AllocateGradientInfoStorage() { 1227 void SkPDFShader::State::AllocateGradientInfoStorage() {
1228 fColorData.set(sk_malloc_throw( 1228 fColorData.set(sk_malloc_throw(
1229 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); 1229 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar))));
1230 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); 1230 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get());
1231 fInfo.fColorOffsets = 1231 fInfo.fColorOffsets =
1232 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); 1232 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount);
1233 } 1233 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFResourceDict.cpp ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698