| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 #endif | 388 #endif |
| 389 | 389 |
| 390 /////////////////////////////////////////////////////////////////////////////// | 390 /////////////////////////////////////////////////////////////////////////////// |
| 391 | 391 |
| 392 #if SK_SUPPORT_GPU | 392 #if SK_SUPPORT_GPU |
| 393 | 393 |
| 394 #include "GrTextureAccess.h" | 394 #include "GrTextureAccess.h" |
| 395 #include "effects/GrSimpleTextureEffect.h" | 395 #include "effects/GrSimpleTextureEffect.h" |
| 396 #include "SkGr.h" | 396 #include "SkGr.h" |
| 397 | 397 |
| 398 bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, | 398 bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint&
paint, |
| 399 const SkMatrix* localMatrix, GrColor* paint
Color, | 399 const SkMatrix* localMatrix, GrColo
r* paintColor, |
| 400 GrEffect** effect) const { | 400 GrFragmentProcessor** fp) const { |
| 401 SkMatrix matrix; | 401 SkMatrix matrix; |
| 402 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); | 402 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
| 403 | 403 |
| 404 SkMatrix lmInverse; | 404 SkMatrix lmInverse; |
| 405 if (!this->getLocalMatrix().invert(&lmInverse)) { | 405 if (!this->getLocalMatrix().invert(&lmInverse)) { |
| 406 return false; | 406 return false; |
| 407 } | 407 } |
| 408 if (localMatrix) { | 408 if (localMatrix) { |
| 409 SkMatrix inv; | 409 SkMatrix inv; |
| 410 if (!localMatrix->invert(&inv)) { | 410 if (!localMatrix->invert(&inv)) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 SkErrorInternals::SetError( kInternalError_SkError, | 465 SkErrorInternals::SetError( kInternalError_SkError, |
| 466 "Couldn't convert bitmap to texture."); | 466 "Couldn't convert bitmap to texture."); |
| 467 return false; | 467 return false; |
| 468 } | 468 } |
| 469 | 469 |
| 470 *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? | 470 *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? |
| 471 SkColor2GrColor(paint.getColor()
) : | 471 SkColor2GrColor(paint.getColor()
) : |
| 472 SkColor2GrColorJustAlpha(paint.g
etColor()); | 472 SkColor2GrColorJustAlpha(paint.g
etColor()); |
| 473 | 473 |
| 474 if (useBicubic) { | 474 if (useBicubic) { |
| 475 *effect = GrBicubicEffect::Create(texture, matrix, tm); | 475 *fp = GrBicubicEffect::Create(texture, matrix, tm); |
| 476 } else { | 476 } else { |
| 477 *effect = GrSimpleTextureEffect::Create(texture, matrix, params); | 477 *fp = GrSimpleTextureEffect::Create(texture, matrix, params); |
| 478 } | 478 } |
| 479 GrUnlockAndUnrefCachedBitmapTexture(texture); | 479 GrUnlockAndUnrefCachedBitmapTexture(texture); |
| 480 | 480 |
| 481 return true; | 481 return true; |
| 482 } | 482 } |
| 483 | 483 |
| 484 #else | 484 #else |
| 485 | 485 |
| 486 bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, | 486 bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const S
kMatrix*, GrColor*, |
| 487 const SkMatrix* localMatrix, GrColor* paint
Color, | 487 GrFragmentProcessor**) const { |
| 488 GrEffect** effect) const { | |
| 489 SkDEBUGFAIL("Should not call in GPU-less build"); | 488 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 490 return false; | 489 return false; |
| 491 } | 490 } |
| 492 | 491 |
| 493 #endif | 492 #endif |
| OLD | NEW |