| 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 #include "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
| 9 #include "SkBitmapController.h" | 9 #include "SkBitmapController.h" |
| 10 #include "SkBitmapProcState.h" | 10 #include "SkBitmapProcState.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 extern void SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcState&,
int, int, uint32_t*, int); | 30 extern void SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcState&,
int, int, uint32_t*, int); |
| 31 extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcSt
ate&, int, int, uint32_t*, int); | 31 extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcSt
ate&, int, int, uint32_t*, int); |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState&
, int, int, uint32_t*, int); | 34 extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState&
, int, int, uint32_t*, int); |
| 35 | 35 |
| 36 #define NAME_WRAP(x) x | 36 #define NAME_WRAP(x) x |
| 37 #include "SkBitmapProcState_filter.h" | 37 #include "SkBitmapProcState_filter.h" |
| 38 #include "SkBitmapProcState_procs.h" | 38 #include "SkBitmapProcState_procs.h" |
| 39 | 39 |
| 40 SkBitmapProcState::SkBitmapProcState() : fBMState(NULL) {} | 40 SkBitmapProcState::SkBitmapProcState() : fBMState(nullptr) {} |
| 41 | 41 |
| 42 SkBitmapProcState::~SkBitmapProcState() { | 42 SkBitmapProcState::~SkBitmapProcState() { |
| 43 SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get()); | 43 SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 /////////////////////////////////////////////////////////////////////////////// | 46 /////////////////////////////////////////////////////////////////////////////// |
| 47 | 47 |
| 48 // true iff the matrix contains, at most, scale and translate elements | 48 // true iff the matrix contains, at most, scale and translate elements |
| 49 static bool matrix_only_scale_translate(const SkMatrix& m) { | 49 static bool matrix_only_scale_translate(const SkMatrix& m) { |
| 50 return m.getType() <= (SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask); | 50 return m.getType() <= (SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 */ | 115 */ |
| 116 bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { | 116 bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { |
| 117 fPixmap.reset(); | 117 fPixmap.reset(); |
| 118 fInvMatrix = inv; | 118 fInvMatrix = inv; |
| 119 fFilterLevel = paint.getFilterQuality(); | 119 fFilterLevel = paint.getFilterQuality(); |
| 120 | 120 |
| 121 SkDefaultBitmapController controller; | 121 SkDefaultBitmapController controller; |
| 122 fBMState = controller.requestBitmap(fOrigBitmap, inv, paint.getFilterQuality
(), | 122 fBMState = controller.requestBitmap(fOrigBitmap, inv, paint.getFilterQuality
(), |
| 123 fBMStateStorage.get(), fBMStateStorage.s
ize()); | 123 fBMStateStorage.get(), fBMStateStorage.s
ize()); |
| 124 // Note : we allow the controller to return an empty (zero-dimension) result
. Should we? | 124 // Note : we allow the controller to return an empty (zero-dimension) result
. Should we? |
| 125 if (NULL == fBMState || fBMState->pixmap().info().isEmpty()) { | 125 if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) { |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 fPixmap = fBMState->pixmap(); | 128 fPixmap = fBMState->pixmap(); |
| 129 fInvMatrix = fBMState->invMatrix(); | 129 fInvMatrix = fBMState->invMatrix(); |
| 130 fFilterLevel = fBMState->quality(); | 130 fFilterLevel = fBMState->quality(); |
| 131 SkASSERT(fPixmap.addr()); | 131 SkASSERT(fPixmap.addr()); |
| 132 | 132 |
| 133 bool trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) ==
0; | 133 bool trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) ==
0; |
| 134 bool clampClamp = SkShader::kClamp_TileMode == fTileModeX && | 134 bool clampClamp = SkShader::kClamp_TileMode == fTileModeX && |
| 135 SkShader::kClamp_TileMode == fTileModeY; | 135 SkShader::kClamp_TileMode == fTileModeY; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 fInvProc = fInvMatrix.getMapXYProc(); | 168 fInvProc = fInvMatrix.getMapXYProc(); |
| 169 fInvType = fInvMatrix.getType(); | 169 fInvType = fInvMatrix.getType(); |
| 170 fInvSx = SkScalarToFixed(fInvMatrix.getScaleX()); | 170 fInvSx = SkScalarToFixed(fInvMatrix.getScaleX()); |
| 171 fInvSxFractionalInt = SkScalarToFractionalInt(fInvMatrix.getScaleX()); | 171 fInvSxFractionalInt = SkScalarToFractionalInt(fInvMatrix.getScaleX()); |
| 172 fInvKy = SkScalarToFixed(fInvMatrix.getSkewY()); | 172 fInvKy = SkScalarToFixed(fInvMatrix.getSkewY()); |
| 173 fInvKyFractionalInt = SkScalarToFractionalInt(fInvMatrix.getSkewY()); | 173 fInvKyFractionalInt = SkScalarToFractionalInt(fInvMatrix.getSkewY()); |
| 174 | 174 |
| 175 fAlphaScale = SkAlpha255To256(paint.getAlpha()); | 175 fAlphaScale = SkAlpha255To256(paint.getAlpha()); |
| 176 | 176 |
| 177 fShaderProc32 = NULL; | 177 fShaderProc32 = nullptr; |
| 178 fShaderProc16 = NULL; | 178 fShaderProc16 = nullptr; |
| 179 fSampleProc32 = NULL; | 179 fSampleProc32 = nullptr; |
| 180 fSampleProc16 = NULL; | 180 fSampleProc16 = nullptr; |
| 181 | 181 |
| 182 // recompute the triviality of the matrix here because we may have | 182 // recompute the triviality of the matrix here because we may have |
| 183 // changed it! | 183 // changed it! |
| 184 | 184 |
| 185 trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0; | 185 trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0; |
| 186 | 186 |
| 187 if (kLow_SkFilterQuality == fFilterLevel) { | 187 if (kLow_SkFilterQuality == fFilterLevel) { |
| 188 // Only try bilerp if the matrix is "interesting" and | 188 // Only try bilerp if the matrix is "interesting" and |
| 189 // the image has a suitable size. | 189 // the image has a suitable size. |
| 190 | 190 |
| 191 if (fInvType <= SkMatrix::kTranslate_Mask || | 191 if (fInvType <= SkMatrix::kTranslate_Mask || |
| 192 !valid_for_filtering(fPixmap.width() | fPixmap.height())) | 192 !valid_for_filtering(fPixmap.width() | fPixmap.height())) |
| 193 { | 193 { |
| 194 fFilterLevel = kNone_SkFilterQuality; | 194 fFilterLevel = kNone_SkFilterQuality; |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 return this->chooseScanlineProcs(trivialMatrix, clampClamp, paint); | 198 return this->chooseScanlineProcs(trivialMatrix, clampClamp, paint); |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp, | 201 bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp, |
| 202 const SkPaint& paint) { | 202 const SkPaint& paint) { |
| 203 fMatrixProc = this->chooseMatrixProc(trivialMatrix); | 203 fMatrixProc = this->chooseMatrixProc(trivialMatrix); |
| 204 // TODO(dominikg): SkASSERT(fMatrixProc) instead? chooseMatrixProc never ret
urns NULL. | 204 // TODO(dominikg): SkASSERT(fMatrixProc) instead? chooseMatrixProc never ret
urns nullptr. |
| 205 if (NULL == fMatrixProc) { | 205 if (nullptr == fMatrixProc) { |
| 206 return false; | 206 return false; |
| 207 } | 207 } |
| 208 | 208 |
| 209 /////////////////////////////////////////////////////////////////////// | 209 /////////////////////////////////////////////////////////////////////// |
| 210 | 210 |
| 211 const SkAlphaType at = fPixmap.alphaType(); | 211 const SkAlphaType at = fPixmap.alphaType(); |
| 212 | 212 |
| 213 // No need to do this if we're doing HQ sampling; if filter quality is | 213 // No need to do this if we're doing HQ sampling; if filter quality is |
| 214 // still set to HQ by the time we get here, then we must have installed | 214 // still set to HQ by the time we get here, then we must have installed |
| 215 // the shader procs above and can skip all this. | 215 // the shader procs above and can skip all this. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 S16_D16_nofilter_DX, | 331 S16_D16_nofilter_DX, |
| 332 S16_D16_filter_DXDY, | 332 S16_D16_filter_DXDY, |
| 333 S16_D16_filter_DX, | 333 S16_D16_filter_DX, |
| 334 | 334 |
| 335 SI8_D16_nofilter_DXDY, | 335 SI8_D16_nofilter_DXDY, |
| 336 SI8_D16_nofilter_DX, | 336 SI8_D16_nofilter_DX, |
| 337 SI8_D16_filter_DXDY, | 337 SI8_D16_filter_DXDY, |
| 338 SI8_D16_filter_DX, | 338 SI8_D16_filter_DX, |
| 339 | 339 |
| 340 // Don't support 4444 -> 565 | 340 // Don't support 4444 -> 565 |
| 341 NULL, NULL, NULL, NULL, | 341 nullptr, nullptr, nullptr, nullptr, |
| 342 // Don't support A8 -> 565 | 342 // Don't support A8 -> 565 |
| 343 NULL, NULL, NULL, NULL, | 343 nullptr, nullptr, nullptr, nullptr, |
| 344 // Don't support G8 -> 565 (but we could) | 344 // Don't support G8 -> 565 (but we could) |
| 345 NULL, NULL, NULL, NULL | 345 nullptr, nullptr, nullptr, nullptr |
| 346 }; | 346 }; |
| 347 #endif | 347 #endif |
| 348 | 348 |
| 349 fSampleProc32 = SK_ARM_NEON_WRAP(gSkBitmapProcStateSample32)[index]; | 349 fSampleProc32 = SK_ARM_NEON_WRAP(gSkBitmapProcStateSample32)[index]; |
| 350 index >>= 1; // shift away any opaque/alpha distinction | 350 index >>= 1; // shift away any opaque/alpha distinction |
| 351 fSampleProc16 = SK_ARM_NEON_WRAP(gSkBitmapProcStateSample16)[index]; | 351 fSampleProc16 = SK_ARM_NEON_WRAP(gSkBitmapProcStateSample16)[index]; |
| 352 | 352 |
| 353 // our special-case shaderprocs | 353 // our special-case shaderprocs |
| 354 if (SK_ARM_NEON_WRAP(S16_D16_filter_DX) == fSampleProc16) { | 354 if (SK_ARM_NEON_WRAP(S16_D16_filter_DX) == fSampleProc16) { |
| 355 if (clampClamp) { | 355 if (clampClamp) { |
| 356 fShaderProc16 = SK_ARM_NEON_WRAP(Clamp_S16_D16_filter_DX_shaderp
roc); | 356 fShaderProc16 = SK_ARM_NEON_WRAP(Clamp_S16_D16_filter_DX_shaderp
roc); |
| 357 } else if (SkShader::kRepeat_TileMode == fTileModeX && | 357 } else if (SkShader::kRepeat_TileMode == fTileModeX && |
| 358 SkShader::kRepeat_TileMode == fTileModeY) { | 358 SkShader::kRepeat_TileMode == fTileModeY) { |
| 359 fShaderProc16 = SK_ARM_NEON_WRAP(Repeat_S16_D16_filter_DX_shader
proc); | 359 fShaderProc16 = SK_ARM_NEON_WRAP(Repeat_S16_D16_filter_DX_shader
proc); |
| 360 } | 360 } |
| 361 } else if (SK_ARM_NEON_WRAP(SI8_opaque_D32_filter_DX) == fSampleProc32 &
& clampClamp) { | 361 } else if (SK_ARM_NEON_WRAP(SI8_opaque_D32_filter_DX) == fSampleProc32 &
& clampClamp) { |
| 362 fShaderProc32 = SK_ARM_NEON_WRAP(Clamp_SI8_opaque_D32_filter_DX_shad
erproc); | 362 fShaderProc32 = SK_ARM_NEON_WRAP(Clamp_SI8_opaque_D32_filter_DX_shad
erproc); |
| 363 } else if (S32_opaque_D32_nofilter_DX == fSampleProc32 && clampClamp) { | 363 } else if (S32_opaque_D32_nofilter_DX == fSampleProc32 && clampClamp) { |
| 364 fShaderProc32 = Clamp_S32_opaque_D32_nofilter_DX_shaderproc; | 364 fShaderProc32 = Clamp_S32_opaque_D32_nofilter_DX_shaderproc; |
| 365 } | 365 } |
| 366 | 366 |
| 367 if (NULL == fShaderProc32) { | 367 if (nullptr == fShaderProc32) { |
| 368 fShaderProc32 = this->chooseShaderProc32(); | 368 fShaderProc32 = this->chooseShaderProc32(); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 // see if our platform has any accelerated overrides | 372 // see if our platform has any accelerated overrides |
| 373 this->platformProcs(); | 373 this->platformProcs(); |
| 374 | 374 |
| 375 return true; | 375 return true; |
| 376 } | 376 } |
| 377 | 377 |
| 378 static void Clamp_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s, | 378 static void Clamp_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s, |
| 379 int x, int y, | 379 int x, int y, |
| 380 SkPMColor* SK_RESTRICT color
s, | 380 SkPMColor* SK_RESTRICT color
s, |
| 381 int count) { | 381 int count) { |
| 382 SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0); | 382 SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0); |
| 383 SkASSERT(s.fInvKy == 0); | 383 SkASSERT(s.fInvKy == 0); |
| 384 SkASSERT(count > 0 && colors != NULL); | 384 SkASSERT(count > 0 && colors != nullptr); |
| 385 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); | 385 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); |
| 386 | 386 |
| 387 const int maxX = s.fPixmap.width() - 1; | 387 const int maxX = s.fPixmap.width() - 1; |
| 388 const int maxY = s.fPixmap.height() - 1; | 388 const int maxY = s.fPixmap.height() - 1; |
| 389 int ix = s.fFilterOneX + x; | 389 int ix = s.fFilterOneX + x; |
| 390 int iy = SkClampMax(s.fFilterOneY + y, maxY); | 390 int iy = SkClampMax(s.fFilterOneY + y, maxY); |
| 391 #ifdef SK_DEBUG | 391 #ifdef SK_DEBUG |
| 392 { | 392 { |
| 393 SkPoint pt; | 393 SkPoint pt; |
| 394 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, | 394 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 } | 448 } |
| 449 return x; | 449 return x; |
| 450 } | 450 } |
| 451 | 451 |
| 452 static void Repeat_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s, | 452 static void Repeat_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s, |
| 453 int x, int y, | 453 int x, int y, |
| 454 SkPMColor* SK_RESTRICT colo
rs, | 454 SkPMColor* SK_RESTRICT colo
rs, |
| 455 int count) { | 455 int count) { |
| 456 SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0); | 456 SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0); |
| 457 SkASSERT(s.fInvKy == 0); | 457 SkASSERT(s.fInvKy == 0); |
| 458 SkASSERT(count > 0 && colors != NULL); | 458 SkASSERT(count > 0 && colors != nullptr); |
| 459 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); | 459 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); |
| 460 | 460 |
| 461 const int stopX = s.fPixmap.width(); | 461 const int stopX = s.fPixmap.width(); |
| 462 const int stopY = s.fPixmap.height(); | 462 const int stopY = s.fPixmap.height(); |
| 463 int ix = s.fFilterOneX + x; | 463 int ix = s.fFilterOneX + x; |
| 464 int iy = sk_int_mod(s.fFilterOneY + y, stopY); | 464 int iy = sk_int_mod(s.fFilterOneY + y, stopY); |
| 465 #ifdef SK_DEBUG | 465 #ifdef SK_DEBUG |
| 466 { | 466 { |
| 467 SkPoint pt; | 467 SkPoint pt; |
| 468 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, | 468 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 488 ix = 0; | 488 ix = 0; |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 | 491 |
| 492 static void S32_D32_constX_shaderproc(const SkBitmapProcState& s, | 492 static void S32_D32_constX_shaderproc(const SkBitmapProcState& s, |
| 493 int x, int y, | 493 int x, int y, |
| 494 SkPMColor* SK_RESTRICT colors, | 494 SkPMColor* SK_RESTRICT colors, |
| 495 int count) { | 495 int count) { |
| 496 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask))
== 0); | 496 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask))
== 0); |
| 497 SkASSERT(s.fInvKy == 0); | 497 SkASSERT(s.fInvKy == 0); |
| 498 SkASSERT(count > 0 && colors != NULL); | 498 SkASSERT(count > 0 && colors != nullptr); |
| 499 SkASSERT(1 == s.fPixmap.width()); | 499 SkASSERT(1 == s.fPixmap.width()); |
| 500 | 500 |
| 501 int iY0; | 501 int iY0; |
| 502 int iY1 SK_INIT_TO_AVOID_WARNING; | 502 int iY1 SK_INIT_TO_AVOID_WARNING; |
| 503 int iSubY SK_INIT_TO_AVOID_WARNING; | 503 int iSubY SK_INIT_TO_AVOID_WARNING; |
| 504 | 504 |
| 505 if (kNone_SkFilterQuality != s.fFilterLevel) { | 505 if (kNone_SkFilterQuality != s.fFilterLevel) { |
| 506 SkBitmapProcState::MatrixProc mproc = s.getMatrixProc(); | 506 SkBitmapProcState::MatrixProc mproc = s.getMatrixProc(); |
| 507 uint32_t xy[2]; | 507 uint32_t xy[2]; |
| 508 | 508 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // us to go from device -> src coordinates w/ just an integer add, | 626 // us to go from device -> src coordinates w/ just an integer add, |
| 627 // rather than running through the inverse-matrix | 627 // rather than running through the inverse-matrix |
| 628 fFilterOneX = SkScalarFloorToInt(pt.fX); | 628 fFilterOneX = SkScalarFloorToInt(pt.fX); |
| 629 fFilterOneY = SkScalarFloorToInt(pt.fY); | 629 fFilterOneY = SkScalarFloorToInt(pt.fY); |
| 630 return true; | 630 return true; |
| 631 } | 631 } |
| 632 | 632 |
| 633 SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() { | 633 SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() { |
| 634 | 634 |
| 635 if (kN32_SkColorType != fPixmap.colorType()) { | 635 if (kN32_SkColorType != fPixmap.colorType()) { |
| 636 return NULL; | 636 return nullptr; |
| 637 } | 637 } |
| 638 | 638 |
| 639 static const unsigned kMask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_M
ask; | 639 static const unsigned kMask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_M
ask; |
| 640 | 640 |
| 641 if (1 == fPixmap.width() && 0 == (fInvType & ~kMask)) { | 641 if (1 == fPixmap.width() && 0 == (fInvType & ~kMask)) { |
| 642 if (kNone_SkFilterQuality == fFilterLevel && | 642 if (kNone_SkFilterQuality == fFilterLevel && |
| 643 fInvType <= SkMatrix::kTranslate_Mask && | 643 fInvType <= SkMatrix::kTranslate_Mask && |
| 644 !this->setupForTranslate()) { | 644 !this->setupForTranslate()) { |
| 645 return DoNothing_shaderproc; | 645 return DoNothing_shaderproc; |
| 646 } | 646 } |
| 647 return S32_D32_constX_shaderproc; | 647 return S32_D32_constX_shaderproc; |
| 648 } | 648 } |
| 649 | 649 |
| 650 if (fAlphaScale < 256) { | 650 if (fAlphaScale < 256) { |
| 651 return NULL; | 651 return nullptr; |
| 652 } | 652 } |
| 653 if (fInvType > SkMatrix::kTranslate_Mask) { | 653 if (fInvType > SkMatrix::kTranslate_Mask) { |
| 654 return NULL; | 654 return nullptr; |
| 655 } | 655 } |
| 656 if (kNone_SkFilterQuality != fFilterLevel) { | 656 if (kNone_SkFilterQuality != fFilterLevel) { |
| 657 return NULL; | 657 return nullptr; |
| 658 } | 658 } |
| 659 | 659 |
| 660 SkShader::TileMode tx = (SkShader::TileMode)fTileModeX; | 660 SkShader::TileMode tx = (SkShader::TileMode)fTileModeX; |
| 661 SkShader::TileMode ty = (SkShader::TileMode)fTileModeY; | 661 SkShader::TileMode ty = (SkShader::TileMode)fTileModeY; |
| 662 | 662 |
| 663 if (SkShader::kClamp_TileMode == tx && SkShader::kClamp_TileMode == ty) { | 663 if (SkShader::kClamp_TileMode == tx && SkShader::kClamp_TileMode == ty) { |
| 664 if (this->setupForTranslate()) { | 664 if (this->setupForTranslate()) { |
| 665 return Clamp_S32_D32_nofilter_trans_shaderproc; | 665 return Clamp_S32_D32_nofilter_trans_shaderproc; |
| 666 } | 666 } |
| 667 return DoNothing_shaderproc; | 667 return DoNothing_shaderproc; |
| 668 } | 668 } |
| 669 if (SkShader::kRepeat_TileMode == tx && SkShader::kRepeat_TileMode == ty) { | 669 if (SkShader::kRepeat_TileMode == tx && SkShader::kRepeat_TileMode == ty) { |
| 670 if (this->setupForTranslate()) { | 670 if (this->setupForTranslate()) { |
| 671 return Repeat_S32_D32_nofilter_trans_shaderproc; | 671 return Repeat_S32_D32_nofilter_trans_shaderproc; |
| 672 } | 672 } |
| 673 return DoNothing_shaderproc; | 673 return DoNothing_shaderproc; |
| 674 } | 674 } |
| 675 return NULL; | 675 return nullptr; |
| 676 } | 676 } |
| 677 | 677 |
| 678 /////////////////////////////////////////////////////////////////////////////// | 678 /////////////////////////////////////////////////////////////////////////////// |
| 679 | 679 |
| 680 #ifdef SK_DEBUG | 680 #ifdef SK_DEBUG |
| 681 | 681 |
| 682 static void check_scale_nofilter(uint32_t bitmapXY[], int count, | 682 static void check_scale_nofilter(uint32_t bitmapXY[], int count, |
| 683 unsigned mx, unsigned my) { | 683 unsigned mx, unsigned my) { |
| 684 unsigned y = *bitmapXY++; | 684 unsigned y = *bitmapXY++; |
| 685 SkASSERT(y < my); | 685 SkASSERT(y < my); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 fx += dx; | 840 fx += dx; |
| 841 } | 841 } |
| 842 } else { | 842 } else { |
| 843 for (int i = 0; i < count; ++i) { | 843 for (int i = 0; i < count; ++i) { |
| 844 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; | 844 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; |
| 845 fx += dx; | 845 fx += dx; |
| 846 } | 846 } |
| 847 } | 847 } |
| 848 } | 848 } |
| 849 | 849 |
| OLD | NEW |