| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkPDFDevice.h" | 8 #include "SkPDFDevice.h" |
| 9 | 9 |
| 10 #include "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
| (...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 // a pattern the size of the current clip. | 1943 // a pattern the size of the current clip. |
| 1944 SkIRect bounds = clipRegion.getBounds(); | 1944 SkIRect bounds = clipRegion.getBounds(); |
| 1945 | 1945 |
| 1946 // We need to apply the initial transform to bounds in order to get | 1946 // We need to apply the initial transform to bounds in order to get |
| 1947 // bounds in a consistent coordinate system. | 1947 // bounds in a consistent coordinate system. |
| 1948 SkRect boundsTemp; | 1948 SkRect boundsTemp; |
| 1949 boundsTemp.set(bounds); | 1949 boundsTemp.set(bounds); |
| 1950 fInitialTransform.mapRect(&boundsTemp); | 1950 fInitialTransform.mapRect(&boundsTemp); |
| 1951 boundsTemp.roundOut(&bounds); | 1951 boundsTemp.roundOut(&bounds); |
| 1952 | 1952 |
| 1953 pdfShader.reset(SkPDFShader::GetPDFShader(*shader, transform, bounds)); | 1953 pdfShader.reset(SkPDFShader::GetPDFShader(*shader, transform, bounds, |
| 1954 SkIntToScalar(fRasterDpi) / DPI_FOR_RASTER_SCALE_ONE)); |
| 1954 | 1955 |
| 1955 if (pdfShader.get()) { | 1956 if (pdfShader.get()) { |
| 1956 // pdfShader has been canonicalized so we can directly compare | 1957 // pdfShader has been canonicalized so we can directly compare |
| 1957 // pointers. | 1958 // pointers. |
| 1958 int resourceIndex = fShaderResources.find(pdfShader.get()); | 1959 int resourceIndex = fShaderResources.find(pdfShader.get()); |
| 1959 if (resourceIndex < 0) { | 1960 if (resourceIndex < 0) { |
| 1960 resourceIndex = fShaderResources.count(); | 1961 resourceIndex = fShaderResources.count(); |
| 1961 fShaderResources.push(pdfShader.get()); | 1962 fShaderResources.push(pdfShader.get()); |
| 1962 pdfShader.get()->ref(); | 1963 pdfShader.get()->ref(); |
| 1963 } | 1964 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 SkAutoTUnref<SkPDFObject> image( | 2189 SkAutoTUnref<SkPDFObject> image( |
| 2189 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); | 2190 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); |
| 2190 if (!image) { | 2191 if (!image) { |
| 2191 return; | 2192 return; |
| 2192 } | 2193 } |
| 2193 | 2194 |
| 2194 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2195 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
| 2195 &content.entry()->fContent); | 2196 &content.entry()->fContent); |
| 2196 } | 2197 } |
| 2197 | 2198 |
| OLD | NEW |