| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 SkTDArray<SkPDFObject*> fResources; | 437 SkTDArray<SkPDFObject*> fResources; |
| 438 SkAutoTDelete<const SkPDFShader::State> fState; | 438 SkAutoTDelete<const SkPDFShader::State> fState; |
| 439 | 439 |
| 440 SkPDFStream* makePSFunction(const SkString& psCode, SkPDFArray* domain); | 440 SkPDFStream* makePSFunction(const SkString& psCode, SkPDFArray* domain); |
| 441 }; | 441 }; |
| 442 | 442 |
| 443 class SkPDFImageShader : public SkPDFStream, public SkPDFShader { | 443 class SkPDFImageShader : public SkPDFStream, public SkPDFShader { |
| 444 public: | 444 public: |
| 445 explicit SkPDFImageShader(SkPDFShader::State* state); | 445 explicit SkPDFImageShader(SkPDFShader::State* state); |
| 446 virtual ~SkPDFImageShader() { | 446 virtual ~SkPDFImageShader() { |
| 447 RemoveShader(this); | 447 if (isValid()) { |
| 448 RemoveShader(this); |
| 449 } |
| 448 fResources.unrefAll(); | 450 fResources.unrefAll(); |
| 449 } | 451 } |
| 450 | 452 |
| 451 virtual bool isValid() { return size() > 0; } | 453 virtual bool isValid() { return size() > 0; } |
| 452 | 454 |
| 453 void getResources(const SkTSet<SkPDFObject*>& knownResourceObjects, | 455 void getResources(const SkTSet<SkPDFObject*>& knownResourceObjects, |
| 454 SkTSet<SkPDFObject*>* newResourceObjects) { | 456 SkTSet<SkPDFObject*>* newResourceObjects) { |
| 455 GetResourcesHelper(&fResources.toArray(), | 457 GetResourcesHelper(&fResources.toArray(), |
| 456 knownResourceObjects, | 458 knownResourceObjects, |
| 457 newResourceObjects); | 459 newResourceObjects); |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 fPixelGeneration = fImage.getGenerationID(); | 957 fPixelGeneration = fImage.getGenerationID(); |
| 956 } else { | 958 } else { |
| 957 fColorData.set(sk_malloc_throw( | 959 fColorData.set(sk_malloc_throw( |
| 958 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); | 960 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); |
| 959 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); | 961 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); |
| 960 fInfo.fColorOffsets = | 962 fInfo.fColorOffsets = |
| 961 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); | 963 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); |
| 962 shader.asAGradient(&fInfo); | 964 shader.asAGradient(&fInfo); |
| 963 } | 965 } |
| 964 } | 966 } |
| OLD | NEW |