| 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" |
| 11 | 11 |
| 12 #include "SkData.h" | 12 #include "SkData.h" |
| 13 #include "SkPDFCanon.h" | 13 #include "SkPDFCanon.h" |
| 14 #include "SkPDFCatalog.h" | 14 #include "SkPDFCatalog.h" |
| 15 #include "SkPDFDevice.h" | 15 #include "SkPDFDevice.h" |
| 16 #include "SkPDFFormXObject.h" | 16 #include "SkPDFFormXObject.h" |
| 17 #include "SkPDFGraphicState.h" | 17 #include "SkPDFGraphicState.h" |
| 18 #include "SkPDFResourceDict.h" | 18 #include "SkPDFResourceDict.h" |
| 19 #include "SkPDFUtils.h" | 19 #include "SkPDFUtils.h" |
| 20 #include "SkScalar.h" | 20 #include "SkScalar.h" |
| 21 #include "SkStream.h" | 21 #include "SkStream.h" |
| 22 #include "SkTemplates.h" | 22 #include "SkTemplates.h" |
| 23 #include "SkThread.h" | |
| 24 #include "SkTSet.h" | 23 #include "SkTSet.h" |
| 25 #include "SkTypes.h" | 24 #include "SkTypes.h" |
| 26 | 25 |
| 27 static bool inverse_transform_bbox(const SkMatrix& matrix, SkRect* bbox) { | 26 static bool inverse_transform_bbox(const SkMatrix& matrix, SkRect* bbox) { |
| 28 SkMatrix inverse; | 27 SkMatrix inverse; |
| 29 if (!matrix.invert(&inverse)) { | 28 if (!matrix.invert(&inverse)) { |
| 30 return false; | 29 return false; |
| 31 } | 30 } |
| 32 inverse.mapRect(bbox); | 31 inverse.mapRect(bbox); |
| 33 return true; | 32 return true; |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 } | 575 } |
| 577 } | 576 } |
| 578 | 577 |
| 579 // static | 578 // static |
| 580 SkPDFObject* SkPDFShader::GetPDFShader(SkPDFCanon* canon, | 579 SkPDFObject* SkPDFShader::GetPDFShader(SkPDFCanon* canon, |
| 581 SkScalar dpi, | 580 SkScalar dpi, |
| 582 const SkShader& shader, | 581 const SkShader& shader, |
| 583 const SkMatrix& matrix, | 582 const SkMatrix& matrix, |
| 584 const SkIRect& surfaceBBox, | 583 const SkIRect& surfaceBBox, |
| 585 SkScalar rasterScale) { | 584 SkScalar rasterScale) { |
| 586 // There is only one mutex becasue we don't know which one we'll need. | |
| 587 SkAutoTDelete<SkPDFShader::State> state( | 585 SkAutoTDelete<SkPDFShader::State> state( |
| 588 SkNEW_ARGS(State, (shader, matrix, surfaceBBox, rasterScale))); | 586 SkNEW_ARGS(State, (shader, matrix, surfaceBBox, rasterScale))); |
| 589 return get_pdf_shader_by_state(canon, dpi, &state); | 587 return get_pdf_shader_by_state(canon, dpi, &state); |
| 590 } | 588 } |
| 591 | 589 |
| 592 static SkPDFResourceDict* get_gradient_resource_dict( | 590 static SkPDFResourceDict* get_gradient_resource_dict( |
| 593 SkPDFObject* functionShader, | 591 SkPDFObject* functionShader, |
| 594 SkPDFObject* gState) { | 592 SkPDFObject* gState) { |
| 595 SkPDFResourceDict* dict = new SkPDFResourceDict(); | 593 SkPDFResourceDict* dict = new SkPDFResourceDict(); |
| 596 | 594 |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 return false; | 1317 return false; |
| 1320 } | 1318 } |
| 1321 | 1319 |
| 1322 void SkPDFShader::State::AllocateGradientInfoStorage() { | 1320 void SkPDFShader::State::AllocateGradientInfoStorage() { |
| 1323 fColorData.set(sk_malloc_throw( | 1321 fColorData.set(sk_malloc_throw( |
| 1324 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); | 1322 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); |
| 1325 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); | 1323 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); |
| 1326 fInfo.fColorOffsets = | 1324 fInfo.fColorOffsets = |
| 1327 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); | 1325 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); |
| 1328 } | 1326 } |
| OLD | NEW |