aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-17 20:37:37 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-17 20:37:37 +0000
commit8aa66b6f76f72b8e0a15323a932436ca462bf14d (patch)
tree8dc2954ae80aaf186fda26c0386fe92e90f83d73 /src/pdf
parentebad2d9e2003c76a7c496e25c79e371277961ee8 (diff)
Revert "[PDF] Handle failures of matrix inversion" while I investigate fixed point failures.
This reverts commit r3711 Review URL: https://codereview.appspot.com/6050049 git-svn-id: http://skia.googlecode.com/svn/trunk@3712 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkPDFDevice.cpp4
-rw-r--r--src/pdf/SkPDFFormXObject.cpp2
-rw-r--r--src/pdf/SkPDFShader.cpp35
-rw-r--r--src/pdf/SkPDFShader.h2
4 files changed, 12 insertions, 31 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 733a6128b9..7e85afdcde 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -491,8 +491,6 @@ static inline SkBitmap makeContentBitmap(const SkISize& contentSize,
drawingSize.set(SkIntToScalar(contentSize.fWidth),
SkIntToScalar(contentSize.fHeight));
if (!initialTransform->invert(&inverse)) {
- // This shouldn't happen, initial transform should be invertible.
- SkASSERT(false);
inverse.reset();
}
inverse.mapVectors(&drawingSize, 1);
@@ -605,7 +603,7 @@ void SkPDFDevice::internalDrawPaint(const SkPaint& paint,
totalTransform.preConcat(contentEntry->fState.fMatrix);
SkMatrix inverse;
if (!totalTransform.invert(&inverse)) {
- return;
+ inverse.reset();
}
inverse.mapRect(&bbox);
diff --git a/src/pdf/SkPDFFormXObject.cpp b/src/pdf/SkPDFFormXObject.cpp
index c32ea44c08..f368834938 100644
--- a/src/pdf/SkPDFFormXObject.cpp
+++ b/src/pdf/SkPDFFormXObject.cpp
@@ -37,8 +37,6 @@ SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) {
if (!device->initialTransform().isIdentity()) {
SkMatrix inverse;
if (!device->initialTransform().invert(&inverse)) {
- // The initial transform should be invertible.
- SkASSERT(false);
inverse.reset();
}
insert("Matrix", SkPDFUtils::MatrixToArray(inverse))->unref();
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 3d755ff7c0..3a559ba3d3 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -21,13 +21,12 @@
#include "SkThread.h"
#include "SkTypes.h"
-static bool transformBBox(const SkMatrix& matrix, SkRect* bbox) {
+static void transformBBox(const SkMatrix& matrix, SkRect* bbox) {
SkMatrix inverse;
if (!matrix.invert(&inverse)) {
- return false;
+ inverse.reset();
}
inverse.mapRect(bbox);
- return true;
}
static void unitToPointsMatrix(const SkPoint pts[2], SkMatrix* matrix) {
@@ -310,7 +309,7 @@ public:
fResources.unrefAll();
}
- virtual bool isValid() { return fResources.count() > 0; }
+ bool isValid() { return fResources.count() > 0; }
void getResources(SkTDArray<SkPDFObject*>* resourceList) {
GetResourcesHelper(&fResources, resourceList);
@@ -333,8 +332,6 @@ public:
fResources.unrefAll();
}
- virtual bool isValid() { return size() > 0; }
-
void getResources(SkTDArray<SkPDFObject*>* resourceList) {
GetResourcesHelper(&fResources, resourceList);
}
@@ -370,24 +367,18 @@ SkPDFObject* SkPDFShader::GetPDFShader(const SkShader& shader,
result->ref();
return result;
}
-
- bool valid = false;
// The PDFShader takes ownership of the shaderSate.
if (shaderState.get()->fType == SkShader::kNone_GradientType) {
- SkPDFImageShader* imageShader =
- new SkPDFImageShader(shaderState.detach());
- valid = imageShader->isValid();
- result = imageShader;
+ result = new SkPDFImageShader(shaderState.detach());
} else {
SkPDFFunctionShader* functionShader =
new SkPDFFunctionShader(shaderState.detach());
- valid = functionShader->isValid();
+ if (!functionShader->isValid()) {
+ delete functionShader;
+ return NULL;
+ }
result = functionShader;
}
- if (!valid) {
- delete result;
- return NULL;
- }
entry.fPDFShader = result;
CanonicalShaders().push(entry);
return result; // return the reference that came from new.
@@ -481,9 +472,7 @@ SkPDFFunctionShader::SkPDFFunctionShader(SkPDFShader::State* state)
finalMatrix.preConcat(fState.get()->fShaderTransform);
SkRect bbox;
bbox.set(fState.get()->fBBox);
- if (!transformBBox(finalMatrix, &bbox)) {
- return;
- }
+ transformBBox(finalMatrix, &bbox);
SkRefPtr<SkPDFArray> domain = new SkPDFArray;
domain->unref(); // SkRefPtr and new both took a reference.
@@ -501,7 +490,7 @@ SkPDFFunctionShader::SkPDFFunctionShader(SkPDFShader::State* state)
SkShader::GradientInfo twoPointRadialInfo = *info;
SkMatrix inverseMapperMatrix;
if (!mapperMatrix.invert(&inverseMapperMatrix)) {
- return;
+ inverseMapperMatrix.reset();
}
inverseMapperMatrix.mapPoints(twoPointRadialInfo.fPoint, 2);
twoPointRadialInfo.fRadius[0] =
@@ -536,9 +525,7 @@ SkPDFImageShader::SkPDFImageShader(SkPDFShader::State* state) : fState(state) {
finalMatrix.preConcat(fState.get()->fShaderTransform);
SkRect surfaceBBox;
surfaceBBox.set(fState.get()->fBBox);
- if (!transformBBox(finalMatrix, &surfaceBBox)) {
- return;
- }
+ transformBBox(finalMatrix, &surfaceBBox);
SkMatrix unflip;
unflip.setTranslate(0, SkScalarRoundToScalar(surfaceBBox.height()));
diff --git a/src/pdf/SkPDFShader.h b/src/pdf/SkPDFShader.h
index afa63e7631..439d83bbd5 100644
--- a/src/pdf/SkPDFShader.h
+++ b/src/pdf/SkPDFShader.h
@@ -60,8 +60,6 @@ protected:
static void RemoveShader(SkPDFObject* shader);
SkPDFShader();
-
- virtual bool isValid() = 0;
};
#endif