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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 445 |
446 private: | 446 private: |
447 State(const State& other); | 447 State(const State& other); |
448 State operator=(const State& rhs); | 448 State operator=(const State& rhs); |
449 void AllocateGradientInfoStorage(); | 449 void AllocateGradientInfoStorage(); |
450 }; | 450 }; |
451 | 451 |
452 //////////////////////////////////////////////////////////////////////////////// | 452 //////////////////////////////////////////////////////////////////////////////// |
453 | 453 |
454 SkPDFFunctionShader::SkPDFFunctionShader(SkPDFShader::State* state) | 454 SkPDFFunctionShader::SkPDFFunctionShader(SkPDFShader::State* state) |
455 : SkPDFDict("Pattern"), fShaderState(state) {} | 455 : SkPDFDict("Pattern"), fShaderState(state) { |
| 456 state->fImage.reset(); |
| 457 } |
456 | 458 |
457 SkPDFFunctionShader::~SkPDFFunctionShader() {} | 459 SkPDFFunctionShader::~SkPDFFunctionShader() {} |
458 | 460 |
459 bool SkPDFFunctionShader::equals(const SkPDFShader::State& state) const { | 461 bool SkPDFFunctionShader::equals(const SkPDFShader::State& state) const { |
460 return state == *fShaderState; | 462 return state == *fShaderState; |
461 } | 463 } |
462 | 464 |
463 //////////////////////////////////////////////////////////////////////////////// | 465 //////////////////////////////////////////////////////////////////////////////// |
464 | 466 |
465 SkPDFAlphaFunctionShader::SkPDFAlphaFunctionShader(SkPDFShader::State* state) | 467 SkPDFAlphaFunctionShader::SkPDFAlphaFunctionShader(SkPDFShader::State* state) |
466 : fShaderState(state) {} | 468 : fShaderState(state) { |
| 469 state->fImage.reset(); |
| 470 } |
467 | 471 |
468 bool SkPDFAlphaFunctionShader::equals(const SkPDFShader::State& state) const { | 472 bool SkPDFAlphaFunctionShader::equals(const SkPDFShader::State& state) const { |
469 return state == *fShaderState; | 473 return state == *fShaderState; |
470 } | 474 } |
471 | 475 |
472 SkPDFAlphaFunctionShader::~SkPDFAlphaFunctionShader() {} | 476 SkPDFAlphaFunctionShader::~SkPDFAlphaFunctionShader() {} |
473 | 477 |
474 //////////////////////////////////////////////////////////////////////////////// | 478 //////////////////////////////////////////////////////////////////////////////// |
475 | 479 |
476 SkPDFImageShader::SkPDFImageShader(SkPDFShader::State* state) | 480 SkPDFImageShader::SkPDFImageShader(SkPDFShader::State* state) |
477 : fShaderState(state) {} | 481 : fShaderState(state) { |
| 482 state->fImage.reset(); |
| 483 } |
478 | 484 |
479 bool SkPDFImageShader::equals(const SkPDFShader::State& state) const { | 485 bool SkPDFImageShader::equals(const SkPDFShader::State& state) const { |
480 return state == *fShaderState; | 486 return state == *fShaderState; |
481 } | 487 } |
482 | 488 |
483 SkPDFImageShader::~SkPDFImageShader() {} | 489 SkPDFImageShader::~SkPDFImageShader() {} |
484 | 490 |
485 //////////////////////////////////////////////////////////////////////////////// | 491 //////////////////////////////////////////////////////////////////////////////// |
486 | 492 |
487 static SkPDFObject* get_pdf_shader_by_state( | 493 static SkPDFObject* get_pdf_shader_by_state( |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 return false; | 1232 return false; |
1227 } | 1233 } |
1228 | 1234 |
1229 void SkPDFShader::State::AllocateGradientInfoStorage() { | 1235 void SkPDFShader::State::AllocateGradientInfoStorage() { |
1230 fColorData.set(sk_malloc_throw( | 1236 fColorData.set(sk_malloc_throw( |
1231 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); | 1237 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); |
1232 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); | 1238 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); |
1233 fInfo.fColorOffsets = | 1239 fInfo.fColorOffsets = |
1234 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); | 1240 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); |
1235 } | 1241 } |
OLD | NEW |