| 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 | 8 |
| 9 #include "SkPDFShader.h" | 9 #include "SkPDFShader.h" |
| 10 | 10 |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 std::unique_ptr<SkPDFShader::State> alphaToLuminosityState( | 696 std::unique_ptr<SkPDFShader::State> alphaToLuminosityState( |
| 697 state.CreateAlphaToLuminosityState()); | 697 state.CreateAlphaToLuminosityState()); |
| 698 sk_sp<SkPDFObject> luminosityShader( | 698 sk_sp<SkPDFObject> luminosityShader( |
| 699 get_pdf_shader_by_state(doc, dpi, &alphaToLuminosityState)); | 699 get_pdf_shader_by_state(doc, dpi, &alphaToLuminosityState)); |
| 700 | 700 |
| 701 std::unique_ptr<SkStreamAsset> alphaStream(create_pattern_fill_content(-1, b
box)); | 701 std::unique_ptr<SkStreamAsset> alphaStream(create_pattern_fill_content(-1, b
box)); |
| 702 | 702 |
| 703 auto resources = | 703 auto resources = |
| 704 get_gradient_resource_dict(luminosityShader.get(), nullptr); | 704 get_gradient_resource_dict(luminosityShader.get(), nullptr); |
| 705 | 705 |
| 706 sk_sp<SkPDFFormXObject> alphaMask( | 706 auto alphaMask = SkPDFMakeFormXObject(std::move(alphaStream), |
| 707 new SkPDFFormXObject(std::move(alphaStream), bbox, resources.get()))
; | 707 SkPDFUtils::RectToArray(bbox), |
| 708 | 708 std::move(resources), |
| 709 "DeviceRGB"); |
| 709 return SkPDFGraphicState::GetSMaskGraphicState( | 710 return SkPDFGraphicState::GetSMaskGraphicState( |
| 710 alphaMask.get(), false, | 711 alphaMask.get(), false, |
| 711 SkPDFGraphicState::kLuminosity_SMaskMode, doc->canon()); | 712 SkPDFGraphicState::kLuminosity_SMaskMode, doc->canon()); |
| 712 } | 713 } |
| 713 | 714 |
| 714 SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create( | 715 SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create( |
| 715 SkPDFDocument* doc, | 716 SkPDFDocument* doc, |
| 716 SkScalar dpi, | 717 SkScalar dpi, |
| 717 std::unique_ptr<SkPDFShader::State>* autoState) { | 718 std::unique_ptr<SkPDFShader::State>* autoState) { |
| 718 const SkPDFShader::State& state = **autoState; | 719 const SkPDFShader::State& state = **autoState; |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 return false; | 1409 return false; |
| 1409 } | 1410 } |
| 1410 | 1411 |
| 1411 void SkPDFShader::State::AllocateGradientInfoStorage() { | 1412 void SkPDFShader::State::AllocateGradientInfoStorage() { |
| 1412 fColorData.set(sk_malloc_throw( | 1413 fColorData.set(sk_malloc_throw( |
| 1413 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); | 1414 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); |
| 1414 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); | 1415 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); |
| 1415 fInfo.fColorOffsets = | 1416 fInfo.fColorOffsets = |
| 1416 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); | 1417 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); |
| 1417 } | 1418 } |
| OLD | NEW |