| 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 "SkBmpCodec.h" | 8 #include "SkBmpCodec.h" |
| 9 #include "SkCodec.h" | 9 #include "SkCodec.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 349 } |
| 350 | 350 |
| 351 void SkCodec::fillIncompleteImage(const SkImageInfo& info, void* dst, size_t row
Bytes, | 351 void SkCodec::fillIncompleteImage(const SkImageInfo& info, void* dst, size_t row
Bytes, |
| 352 ZeroInitialized zeroInit, int linesRequested, int linesDecoded) { | 352 ZeroInitialized zeroInit, int linesRequested, int linesDecoded) { |
| 353 | 353 |
| 354 void* fillDst; | 354 void* fillDst; |
| 355 const uint32_t fillValue = this->getFillValue(info.colorType(), info.alphaTy
pe()); | 355 const uint32_t fillValue = this->getFillValue(info.colorType(), info.alphaTy
pe()); |
| 356 const int linesRemaining = linesRequested - linesDecoded; | 356 const int linesRemaining = linesRequested - linesDecoded; |
| 357 SkSampler* sampler = this->getSampler(false); | 357 SkSampler* sampler = this->getSampler(false); |
| 358 | 358 |
| 359 int fillWidth = info.width(); |
| 360 if (fOptions.fSubset) { |
| 361 fillWidth = fOptions.fSubset->width(); |
| 362 } |
| 363 |
| 359 switch (this->getScanlineOrder()) { | 364 switch (this->getScanlineOrder()) { |
| 360 case kTopDown_SkScanlineOrder: | 365 case kTopDown_SkScanlineOrder: |
| 361 case kNone_SkScanlineOrder: { | 366 case kNone_SkScanlineOrder: { |
| 362 const SkImageInfo fillInfo = info.makeWH(info.width(), linesRemainin
g); | 367 const SkImageInfo fillInfo = info.makeWH(fillWidth, linesRemaining); |
| 363 fillDst = SkTAddOffset<void>(dst, linesDecoded * rowBytes); | 368 fillDst = SkTAddOffset<void>(dst, linesDecoded * rowBytes); |
| 364 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler)
; | 369 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler)
; |
| 365 break; | 370 break; |
| 366 } | 371 } |
| 367 case kBottomUp_SkScanlineOrder: { | 372 case kBottomUp_SkScanlineOrder: { |
| 368 fillDst = dst; | 373 fillDst = dst; |
| 369 const SkImageInfo fillInfo = info.makeWH(info.width(), linesRemainin
g); | 374 const SkImageInfo fillInfo = info.makeWH(fillWidth, linesRemaining); |
| 370 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler)
; | 375 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler)
; |
| 371 break; | 376 break; |
| 372 } | 377 } |
| 373 case kOutOfOrder_SkScanlineOrder: { | 378 case kOutOfOrder_SkScanlineOrder: { |
| 374 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); | 379 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); |
| 375 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); | 380 const SkImageInfo fillInfo = info.makeWH(fillWidth, 1); |
| 376 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { | 381 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { |
| 377 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); | 382 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); |
| 378 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); | 383 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); |
| 379 } | 384 } |
| 380 break; | 385 break; |
| 381 } | 386 } |
| 382 } | 387 } |
| 383 } | 388 } |
| OLD | NEW |