Chromium Code Reviews| 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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkMaskSwizzler.h" | 10 #include "SkMaskSwizzler.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 } | 353 } |
| 354 | 354 |
| 355 return new SkMaskSwizzler(dstInfo.width(), masks, proc); | 355 return new SkMaskSwizzler(dstInfo.width(), masks, proc); |
| 356 } | 356 } |
| 357 | 357 |
| 358 /* | 358 /* |
| 359 * | 359 * |
| 360 * Constructor for mask swizzler | 360 * Constructor for mask swizzler |
| 361 * | 361 * |
| 362 */ | 362 */ |
| 363 SkMaskSwizzler::SkMaskSwizzler(int width, SkMasks* masks, RowProc proc) | 363 SkMaskSwizzler::SkMaskSwizzler(int subsetWidth, SkMasks* masks, RowProc proc) |
| 364 : fMasks(masks) | 364 : fMasks(masks) |
| 365 , fRowProc(proc) | 365 , fRowProc(proc) |
| 366 , fSrcWidth(width) | 366 , fSubsetWidth(subsetWidth) |
| 367 , fDstWidth(width) | 367 , fDstWidth(subsetWidth) |
| 368 , fSampleX(1) | 368 , fSampleX(1) |
| 369 , fX0(0) | 369 , fX0(0) |
| 370 {} | 370 {} |
| 371 | 371 |
| 372 int SkMaskSwizzler::onSetSampleX(int sampleX) { | 372 int SkMaskSwizzler::onSetSampleX(int sampleX) { |
| 373 // FIXME: Share this function with SkSwizzler? | 373 // FIXME: Share this function with SkSwizzler? |
| 374 SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be | 374 SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be |
| 375 // way to report failure? | 375 // way to report failure? |
| 376 fSampleX = sampleX; | 376 fSampleX = sampleX; |
| 377 fX0 = get_start_coord(sampleX); | 377 fX0 = get_start_coord(sampleX); |
| 378 fDstWidth = get_scaled_dimension(fSrcWidth, sampleX); | 378 fDstWidth = get_scaled_dimension(fSubsetWidth, sampleX); |
| 379 | 379 |
| 380 // check that fX0 is less than original width | 380 // check that fX0 is less than original width |
|
scroggo
2015/10/16 13:36:16
This comment no longer applies
msarett
2015/10/16 17:36:52
Done.
| |
| 381 SkASSERT(fX0 >= 0 && fX0 < fSrcWidth); | 381 SkASSERT(fX0 >= 0); |
| 382 return fDstWidth; | 382 return fDstWidth; |
| 383 } | 383 } |
| 384 | 384 |
| 385 /* | 385 /* |
| 386 * | 386 * |
| 387 * Swizzle the specified row | 387 * Swizzle the specified row |
| 388 * | 388 * |
| 389 */ | 389 */ |
| 390 SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RES TRICT src) { | 390 SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RES TRICT src) { |
| 391 SkASSERT(nullptr != dst && nullptr != src); | 391 SkASSERT(nullptr != dst && nullptr != src); |
| 392 return fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX); | 392 return fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX); |
| 393 } | 393 } |
| OLD | NEW |