OLD | NEW |
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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 setData(content.get()); | 1153 setData(content.get()); |
1154 SkPDFResourceDict* resourceDict = pattern.getResourceDict(); | 1154 SkPDFResourceDict* resourceDict = pattern.getResourceDict(); |
1155 resourceDict->getReferencedResources(fResources, &fResources, false); | 1155 resourceDict->getReferencedResources(fResources, &fResources, false); |
1156 | 1156 |
1157 populate_tiling_pattern_dict(this, patternBBox, | 1157 populate_tiling_pattern_dict(this, patternBBox, |
1158 pattern.getResourceDict(), finalMatrix); | 1158 pattern.getResourceDict(), finalMatrix); |
1159 | 1159 |
1160 fState.get()->fImage.unlockPixels(); | 1160 fState.get()->fImage.unlockPixels(); |
1161 } | 1161 } |
1162 | 1162 |
1163 SkPDFStream* SkPDFFunctionShader::makePSFunction(const SkString& psCode, | 1163 SkPDFStream* SkPDFFunctionShader::makePSFunction(const SkString& psCode, SkPDFAr
ray* domain) { |
1164 SkPDFArray* domain) { | 1164 SkAutoDataUnref funcData(SkData::NewWithCopy(psCode.c_str(), psCode.size()))
; |
1165 SkAutoDataUnref funcData(SkData::NewWithCopy(psCode.c_str(), | |
1166 psCode.size())); | |
1167 SkPDFStream* result = new SkPDFStream(funcData.get()); | 1165 SkPDFStream* result = new SkPDFStream(funcData.get()); |
1168 result->insertInt("FunctionType", 4); | 1166 result->insertInt("FunctionType", 4); |
1169 result->insert("Domain", domain); | 1167 result->insert("Domain", domain); |
1170 result->insert("Range", RangeObject()); | 1168 result->insert("Range", RangeObject()); |
1171 return result; | 1169 return result; |
1172 } | 1170 } |
1173 | 1171 |
1174 SkPDFShader::ShaderCanonicalEntry::ShaderCanonicalEntry(SkPDFObject* pdfShader, | 1172 SkPDFShader::ShaderCanonicalEntry::ShaderCanonicalEntry(SkPDFObject* pdfShader,
const State* state) |
1175 const State* state) | 1173 : fPDFShader(pdfShader) |
1176 : fPDFShader(pdfShader), | 1174 , fState(state) |
1177 fState(state) { | 1175 {} |
1178 } | |
1179 | 1176 |
1180 bool SkPDFShader::ShaderCanonicalEntry::operator==( | 1177 bool SkPDFShader::ShaderCanonicalEntry::operator==(const ShaderCanonicalEntry& b
) const { |
1181 const ShaderCanonicalEntry& b) const { | |
1182 return fPDFShader == b.fPDFShader || | 1178 return fPDFShader == b.fPDFShader || |
1183 (fState != NULL && b.fState != NULL && *fState == *b.fState); | 1179 (fState != NULL && b.fState != NULL && *fState == *b.fState); |
1184 } | 1180 } |
1185 | 1181 |
1186 bool SkPDFShader::State::operator==(const SkPDFShader::State& b) const { | 1182 bool SkPDFShader::State::operator==(const SkPDFShader::State& b) const { |
1187 if (fType != b.fType || | 1183 if (fType != b.fType || |
1188 fCanvasTransform != b.fCanvasTransform || | 1184 fCanvasTransform != b.fCanvasTransform || |
1189 fShaderTransform != b.fShaderTransform || | 1185 fShaderTransform != b.fShaderTransform || |
1190 fBBox != b.fBBox) { | 1186 fBBox != b.fBBox) { |
1191 return false; | 1187 return false; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 return false; | 1333 return false; |
1338 } | 1334 } |
1339 | 1335 |
1340 void SkPDFShader::State::AllocateGradientInfoStorage() { | 1336 void SkPDFShader::State::AllocateGradientInfoStorage() { |
1341 fColorData.set(sk_malloc_throw( | 1337 fColorData.set(sk_malloc_throw( |
1342 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); | 1338 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); |
1343 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); | 1339 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); |
1344 fInfo.fColorOffsets = | 1340 fInfo.fColorOffsets = |
1345 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); | 1341 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); |
1346 } | 1342 } |
OLD | NEW |