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

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

Issue 2185803003: SkPdf: SkPDFFormXObject de-class-ified. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-07-27 (Wednesday) 17:00:53 EDT Created 4 years, 4 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
« no previous file with comments | « src/pdf/SkPDFGraphicState.cpp ('k') | 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 * 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
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
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 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFGraphicState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698