| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBmpRLECodec.h" | 8 #include "SkBmpRLECodec.h" |
| 9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 496 |
| 497 private: | 497 private: |
| 498 int onSetSampleX(int sampleX) override { | 498 int onSetSampleX(int sampleX) override { |
| 499 return fCodec->setSampleX(sampleX); | 499 return fCodec->setSampleX(sampleX); |
| 500 } | 500 } |
| 501 | 501 |
| 502 // Unowned pointer. fCodec will delete this class in its destructor. | 502 // Unowned pointer. fCodec will delete this class in its destructor. |
| 503 SkBmpRLECodec* fCodec; | 503 SkBmpRLECodec* fCodec; |
| 504 }; | 504 }; |
| 505 | 505 |
| 506 SkSampler* SkBmpRLECodec::getSampler(bool createIfNecessary) { | 506 SkSampler* SkBmpRLECodec::getSampler(bool /*createIfNecessary*/) { |
| 507 if (!fSampler && createIfNecessary) { | 507 // We will always create an SkBmpRLESampler if one is requested. |
| 508 // This allows clients to always use the SkBmpRLESampler's |
| 509 // version of fill(), which does nothing since RLE decodes have |
| 510 // already filled pixel memory. This seems fine, since creating |
| 511 // an SkBmpRLESampler is pretty inexpensive. |
| 512 if (!fSampler) { |
| 508 fSampler.reset(new SkBmpRLESampler(this)); | 513 fSampler.reset(new SkBmpRLESampler(this)); |
| 509 } | 514 } |
| 510 | 515 |
| 511 return fSampler; | 516 return fSampler; |
| 512 } | 517 } |
| 513 | 518 |
| 514 int SkBmpRLECodec::setSampleX(int sampleX){ | 519 int SkBmpRLECodec::setSampleX(int sampleX){ |
| 515 fSampleX = sampleX; | 520 fSampleX = sampleX; |
| 516 return get_scaled_dimension(this->getInfo().width(), sampleX); | 521 return get_scaled_dimension(this->getInfo().width(), sampleX); |
| 517 } | 522 } |
| OLD | NEW |