| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 default: | 469 default: |
| 470 SkErrorInternals::SetError( kInvalidPaint_SkError, | 470 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 471 "Sorry, I don't understand the filtering
" | 471 "Sorry, I don't understand the filtering
" |
| 472 "mode you asked for. Falling back to " | 472 "mode you asked for. Falling back to " |
| 473 "MIPMaps."); | 473 "MIPMaps."); |
| 474 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 474 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 475 break; | 475 break; |
| 476 | 476 |
| 477 } | 477 } |
| 478 GrTextureParams params(tm, textureFilterMode); | 478 GrTextureParams params(tm, textureFilterMode); |
| 479 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p
arams); | 479 GrTexture* texture = fRawBitmap.getTexture(); |
| 480 bool didLockTexture = false; |
| 481 |
| 482 if (!texture) { |
| 483 texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, ¶ms); |
| 484 didLockTexture = true; |
| 485 } |
| 480 | 486 |
| 481 if (NULL == texture) { | 487 if (NULL == texture) { |
| 482 SkErrorInternals::SetError( kInternalError_SkError, | 488 SkErrorInternals::SetError( kInternalError_SkError, |
| 483 "Couldn't convert bitmap to texture."); | 489 "Couldn't convert bitmap to texture."); |
| 484 return NULL; | 490 return NULL; |
| 485 } | 491 } |
| 486 | 492 |
| 487 GrEffectRef* effect = NULL; | 493 GrEffectRef* effect = NULL; |
| 488 if (paintFilterLevel == SkPaint::kHigh_FilterLevel) { | 494 if (paintFilterLevel == SkPaint::kHigh_FilterLevel) { |
| 489 effect = GrBicubicEffect::Create(texture, matrix, tm); | 495 effect = GrBicubicEffect::Create(texture, matrix, tm); |
| 490 } else { | 496 } else { |
| 491 effect = GrSimpleTextureEffect::Create(texture, matrix, params); | 497 effect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| 492 } | 498 } |
| 493 GrUnlockAndUnrefCachedBitmapTexture(texture); | 499 if (didLockTexture) { |
| 500 GrUnlockAndUnrefCachedBitmapTexture(texture); |
| 501 } |
| 494 return effect; | 502 return effect; |
| 495 } | 503 } |
| 496 #endif | 504 #endif |
| OLD | NEW |