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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 } | 1094 } |
1095 } | 1095 } |
1096 | 1096 |
1097 // Put the canvas into the pattern stream (fContent). | 1097 // Put the canvas into the pattern stream (fContent). |
1098 SkAutoTDelete<SkStreamAsset> content(patternDevice->content()); | 1098 SkAutoTDelete<SkStreamAsset> content(patternDevice->content()); |
1099 | 1099 |
1100 SkPDFImageShader* imageShader = | 1100 SkPDFImageShader* imageShader = |
1101 SkNEW_ARGS(SkPDFImageShader, (autoState->detach())); | 1101 SkNEW_ARGS(SkPDFImageShader, (autoState->detach())); |
1102 imageShader->setData(content.get()); | 1102 imageShader->setData(content.get()); |
1103 | 1103 |
| 1104 SkAutoTUnref<SkPDFResourceDict> resourceDict( |
| 1105 patternDevice->createResourceDict()); |
1104 populate_tiling_pattern_dict(imageShader, patternBBox, | 1106 populate_tiling_pattern_dict(imageShader, patternBBox, |
1105 patternDevice->getResourceDict(), finalMatrix); | 1107 resourceDict.get(), finalMatrix); |
1106 | 1108 |
1107 imageShader->fShaderState->fImage.unlockPixels(); | 1109 imageShader->fShaderState->fImage.unlockPixels(); |
1108 | 1110 |
1109 canon->addImageShader(imageShader); | 1111 canon->addImageShader(imageShader); |
1110 return imageShader; | 1112 return imageShader; |
1111 } | 1113 } |
1112 | 1114 |
1113 bool SkPDFShader::State::operator==(const SkPDFShader::State& b) const { | 1115 bool SkPDFShader::State::operator==(const SkPDFShader::State& b) const { |
1114 if (fType != b.fType || | 1116 if (fType != b.fType || |
1115 fCanvasTransform != b.fCanvasTransform || | 1117 fCanvasTransform != b.fCanvasTransform || |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 return false; | 1304 return false; |
1303 } | 1305 } |
1304 | 1306 |
1305 void SkPDFShader::State::AllocateGradientInfoStorage() { | 1307 void SkPDFShader::State::AllocateGradientInfoStorage() { |
1306 fColorData.set(sk_malloc_throw( | 1308 fColorData.set(sk_malloc_throw( |
1307 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); | 1309 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); |
1308 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); | 1310 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); |
1309 fInfo.fColorOffsets = | 1311 fInfo.fColorOffsets = |
1310 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); | 1312 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); |
1311 } | 1313 } |
OLD | NEW |