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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, | 385 bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, |
386 const SkMatrix* localMatrix, GrColor* grCol
or, | 386 const SkMatrix* localMatrix, GrColor* paint
Color, |
387 GrEffectRef** grEffect) const { | 387 GrEffect** effect) const { |
388 SkMatrix matrix; | 388 SkMatrix matrix; |
389 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); | 389 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
390 | 390 |
391 SkMatrix lmInverse; | 391 SkMatrix lmInverse; |
392 if (!this->getLocalMatrix().invert(&lmInverse)) { | 392 if (!this->getLocalMatrix().invert(&lmInverse)) { |
393 return false; | 393 return false; |
394 } | 394 } |
395 if (localMatrix) { | 395 if (localMatrix) { |
396 SkMatrix inv; | 396 SkMatrix inv; |
397 if (!localMatrix->invert(&inv)) { | 397 if (!localMatrix->invert(&inv)) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 447 } |
448 GrTextureParams params(tm, textureFilterMode); | 448 GrTextureParams params(tm, textureFilterMode); |
449 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p
arams); | 449 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p
arams); |
450 | 450 |
451 if (NULL == texture) { | 451 if (NULL == texture) { |
452 SkErrorInternals::SetError( kInternalError_SkError, | 452 SkErrorInternals::SetError( kInternalError_SkError, |
453 "Couldn't convert bitmap to texture."); | 453 "Couldn't convert bitmap to texture."); |
454 return false; | 454 return false; |
455 } | 455 } |
456 | 456 |
457 *grColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? SkColor2GrColo
r(paint.getColor()) | 457 *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? |
458 : SkColor2GrColorJustAlpha(paint.getColo
r()); | 458 SkColor2GrColor(paint.getColor()
) : |
| 459 SkColor2GrColorJustAlpha(paint.g
etColor()); |
459 | 460 |
460 if (useBicubic) { | 461 if (useBicubic) { |
461 *grEffect = GrBicubicEffect::Create(texture, matrix, tm); | 462 *effect = GrBicubicEffect::Create(texture, matrix, tm); |
462 } else { | 463 } else { |
463 *grEffect = GrSimpleTextureEffect::Create(texture, matrix, params); | 464 *effect = GrSimpleTextureEffect::Create(texture, matrix, params); |
464 } | 465 } |
465 GrUnlockAndUnrefCachedBitmapTexture(texture); | 466 GrUnlockAndUnrefCachedBitmapTexture(texture); |
466 | 467 |
467 return true; | 468 return true; |
468 } | 469 } |
469 | 470 |
470 #else | 471 #else |
471 | 472 |
472 bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, | 473 bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, |
473 const SkMatrix* localMatrix, GrColor* grCol
or, | 474 const SkMatrix* localMatrix, GrColor* paint
Color, |
474 GrEffect** grEffect) const { | 475 GrEffect** effect) const { |
475 SkDEBUGFAIL("Should not call in GPU-less build"); | 476 SkDEBUGFAIL("Should not call in GPU-less build"); |
476 return false; | 477 return false; |
477 } | 478 } |
478 | 479 |
479 #endif | 480 #endif |
OLD | NEW |