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, G rColor* grColor, |
| 386 const SkMatrix* localMatrix) const { | 386 GrEffectRef** grEffect, const SkMatrix* loc alMatrix) const { |
|
bsalomon
2014/06/05 17:32:44
Doesn't this function need to set grColor?
jvanverth1
2014/06/05 17:36:30
grColor never gets set by this method
dandov
2014/06/06 21:50:43
Done.
dandov
2014/06/06 21:50:43
Done.
dandov
2014/06/06 21:50:43
The grColor is set the alpha of the SkPaint's alph
| |
| 387 SkMatrix matrix; | 387 SkMatrix matrix; |
| 388 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); | 388 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
| 389 | 389 |
| 390 SkMatrix lmInverse; | 390 SkMatrix lmInverse; |
| 391 if (!this->getLocalMatrix().invert(&lmInverse)) { | 391 if (!this->getLocalMatrix().invert(&lmInverse)) { |
| 392 return NULL; | 392 return false; |
| 393 } | 393 } |
| 394 if (localMatrix) { | 394 if (localMatrix) { |
| 395 SkMatrix inv; | 395 SkMatrix inv; |
| 396 if (!localMatrix->invert(&inv)) { | 396 if (!localMatrix->invert(&inv)) { |
| 397 return NULL; | 397 return false; |
| 398 } | 398 } |
| 399 lmInverse.postConcat(inv); | 399 lmInverse.postConcat(inv); |
| 400 } | 400 } |
| 401 matrix.preConcat(lmInverse); | 401 matrix.preConcat(lmInverse); |
| 402 | 402 |
| 403 SkShader::TileMode tm[] = { | 403 SkShader::TileMode tm[] = { |
| 404 (TileMode)fTileModeX, | 404 (TileMode)fTileModeX, |
| 405 (TileMode)fTileModeY, | 405 (TileMode)fTileModeY, |
| 406 }; | 406 }; |
| 407 | 407 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 443 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 444 break; | 444 break; |
| 445 | 445 |
| 446 } | 446 } |
| 447 GrTextureParams params(tm, textureFilterMode); | 447 GrTextureParams params(tm, textureFilterMode); |
| 448 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p arams); | 448 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p arams); |
| 449 | 449 |
| 450 if (NULL == texture) { | 450 if (NULL == texture) { |
| 451 SkErrorInternals::SetError( kInternalError_SkError, | 451 SkErrorInternals::SetError( kInternalError_SkError, |
| 452 "Couldn't convert bitmap to texture."); | 452 "Couldn't convert bitmap to texture."); |
| 453 return NULL; | 453 return false; |
| 454 } | 454 } |
| 455 | 455 |
| 456 GrEffectRef* effect = NULL; | 456 *grEffect = NULL; |
|
bsalomon
2014/06/05 17:32:44
I don't think we should require this. The passed i
dandov
2014/06/06 21:50:43
Done.
| |
| 457 if (useBicubic) { | 457 if (useBicubic) { |
| 458 effect = GrBicubicEffect::Create(texture, matrix, tm); | 458 *grEffect = GrBicubicEffect::Create(texture, matrix, tm); |
| 459 } else { | 459 } else { |
| 460 effect = GrSimpleTextureEffect::Create(texture, matrix, params); | 460 *grEffect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| 461 } | 461 } |
| 462 GrUnlockAndUnrefCachedBitmapTexture(texture); | 462 GrUnlockAndUnrefCachedBitmapTexture(texture); |
| 463 return effect; | 463 return true; |
| 464 } | 464 } |
| 465 #endif | 465 #endif |
| OLD | NEW |