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

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

Issue 19509005: If we fail to contruct the Pdf Image Shader, mark the object as busted, and dn't try to remove it f… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
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