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

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

Issue 1006813010: SkPDF: Fix leak in SkPDFShader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « 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 /* 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 functionCode = codeFunction(twoPointRadialInfo, perspectiveInverseOnly); 870 functionCode = codeFunction(twoPointRadialInfo, perspectiveInverseOnly);
871 } else { 871 } else {
872 functionCode = codeFunction(*info, perspectiveInverseOnly); 872 functionCode = codeFunction(*info, perspectiveInverseOnly);
873 } 873 }
874 874
875 SkAutoTUnref<SkPDFDict> pdfShader(new SkPDFDict); 875 SkAutoTUnref<SkPDFDict> pdfShader(new SkPDFDict);
876 pdfShader->insertInt("ShadingType", 1); 876 pdfShader->insertInt("ShadingType", 1);
877 pdfShader->insertName("ColorSpace", "DeviceRGB"); 877 pdfShader->insertName("ColorSpace", "DeviceRGB");
878 pdfShader->insert("Domain", domain.get()); 878 pdfShader->insert("Domain", domain.get());
879 879
880 SkPDFStream* function = make_ps_function(functionCode, domain.get()); 880 SkAutoTUnref<SkPDFStream> function(
881 make_ps_function(functionCode, domain.get()));
881 pdfShader->insert("Function", new SkPDFObjRef(function))->unref(); 882 pdfShader->insert("Function", new SkPDFObjRef(function))->unref();
882 883
883 SkAutoTUnref<SkPDFArray> matrixArray( 884 SkAutoTUnref<SkPDFArray> matrixArray(
884 SkPDFUtils::MatrixToArray(finalMatrix)); 885 SkPDFUtils::MatrixToArray(finalMatrix));
885 886
886 SkPDFFunctionShader* pdfFunctionShader = 887 SkPDFFunctionShader* pdfFunctionShader =
887 SkNEW_ARGS(SkPDFFunctionShader, (autoState->detach())); 888 SkNEW_ARGS(SkPDFFunctionShader, (autoState->detach()));
888 889
889 pdfFunctionShader->insertInt("PatternType", 2); 890 pdfFunctionShader->insertInt("PatternType", 2);
890 pdfFunctionShader->insert("Matrix", matrixArray.get()); 891 pdfFunctionShader->insert("Matrix", matrixArray.get());
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 return false; 1302 return false;
1302 } 1303 }
1303 1304
1304 void SkPDFShader::State::AllocateGradientInfoStorage() { 1305 void SkPDFShader::State::AllocateGradientInfoStorage() {
1305 fColorData.set(sk_malloc_throw( 1306 fColorData.set(sk_malloc_throw(
1306 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); 1307 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar))));
1307 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); 1308 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get());
1308 fInfo.fColorOffsets = 1309 fInfo.fColorOffsets =
1309 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); 1310 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount);
1310 } 1311 }
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