Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
| 9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
| 10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 #endif | 375 #endif |
| 376 | 376 |
| 377 /////////////////////////////////////////////////////////////////////////////// | 377 /////////////////////////////////////////////////////////////////////////////// |
| 378 | 378 |
| 379 #if SK_SUPPORT_GPU | 379 #if SK_SUPPORT_GPU |
| 380 | 380 |
| 381 #include "GrTextureAccess.h" | 381 #include "GrTextureAccess.h" |
| 382 #include "effects/GrSimpleTextureEffect.h" | 382 #include "effects/GrSimpleTextureEffect.h" |
| 383 #include "SkGr.h" | 383 #include "SkGr.h" |
| 384 | 384 |
| 385 GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, | 385 bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, |
| 386 const SkMatrix* localMatrix) const { | 386 const SkMatrix* localMatrix, GrColor* grCol or, |
| 387 GrEffectRef** grEffect) const { | |
| 388 *grColor = this->getColorAsAlpha(paint); | |
|
bsalomon
2014/06/09 14:11:30
It can be a follow on CL but I think you'd fix an
dandov
2014/06/09 19:10:55
I fixed the bug, do I need to do something else to
| |
| 389 | |
| 387 SkMatrix matrix; | 390 SkMatrix matrix; |
| 388 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); | 391 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
| 389 | 392 |
| 390 SkMatrix lmInverse; | 393 SkMatrix lmInverse; |
| 391 if (!this->getLocalMatrix().invert(&lmInverse)) { | 394 if (!this->getLocalMatrix().invert(&lmInverse)) { |
| 392 return NULL; | 395 return false; |
| 393 } | 396 } |
| 394 if (localMatrix) { | 397 if (localMatrix) { |
| 395 SkMatrix inv; | 398 SkMatrix inv; |
| 396 if (!localMatrix->invert(&inv)) { | 399 if (!localMatrix->invert(&inv)) { |
| 397 return NULL; | 400 return false; |
| 398 } | 401 } |
| 399 lmInverse.postConcat(inv); | 402 lmInverse.postConcat(inv); |
| 400 } | 403 } |
| 401 matrix.preConcat(lmInverse); | 404 matrix.preConcat(lmInverse); |
| 402 | 405 |
| 403 SkShader::TileMode tm[] = { | 406 SkShader::TileMode tm[] = { |
| 404 (TileMode)fTileModeX, | 407 (TileMode)fTileModeX, |
| 405 (TileMode)fTileModeY, | 408 (TileMode)fTileModeY, |
| 406 }; | 409 }; |
| 407 | 410 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 446 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 444 break; | 447 break; |
| 445 | 448 |
| 446 } | 449 } |
| 447 GrTextureParams params(tm, textureFilterMode); | 450 GrTextureParams params(tm, textureFilterMode); |
| 448 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p arams); | 451 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p arams); |
| 449 | 452 |
| 450 if (NULL == texture) { | 453 if (NULL == texture) { |
| 451 SkErrorInternals::SetError( kInternalError_SkError, | 454 SkErrorInternals::SetError( kInternalError_SkError, |
| 452 "Couldn't convert bitmap to texture."); | 455 "Couldn't convert bitmap to texture."); |
| 453 return NULL; | 456 return false; |
| 454 } | 457 } |
| 455 | 458 |
| 456 GrEffectRef* effect = NULL; | |
| 457 if (useBicubic) { | 459 if (useBicubic) { |
| 458 effect = GrBicubicEffect::Create(texture, matrix, tm); | 460 *grEffect = GrBicubicEffect::Create(texture, matrix, tm); |
| 459 } else { | 461 } else { |
| 460 effect = GrSimpleTextureEffect::Create(texture, matrix, params); | 462 *grEffect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| 461 } | 463 } |
| 462 GrUnlockAndUnrefCachedBitmapTexture(texture); | 464 GrUnlockAndUnrefCachedBitmapTexture(texture); |
| 463 return effect; | 465 |
| 466 return NULL != *grEffect; | |
|
dandov
2014/06/06 21:50:44
check if it will return NULL or a valid GrEffectRe
| |
| 464 } | 467 } |
| 465 #endif | 468 #endif |
| OLD | NEW |