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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 #if SK_SUPPORT_GPU | 359 #if SK_SUPPORT_GPU |
360 | 360 |
361 #include "GrTextureAccess.h" | 361 #include "GrTextureAccess.h" |
362 #include "effects/GrSimpleTextureEffect.h" | 362 #include "effects/GrSimpleTextureEffect.h" |
363 #include "SkGr.h" | 363 #include "SkGr.h" |
364 | 364 |
365 bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint&
paint, | 365 bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint&
paint, |
366 const SkMatrix& viewM, | 366 const SkMatrix& viewM, |
367 const SkMatrix* localMatrix, GrColo
r* paintColor, | 367 const SkMatrix* localMatrix, GrColo
r* paintColor, |
368 GrProcessorDataManager*, | 368 GrProcessorDataManager* procDataMan
ager, |
369 GrFragmentProcessor** fp) const { | 369 GrFragmentProcessor** fp) const { |
370 SkMatrix matrix; | 370 SkMatrix matrix; |
371 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); | 371 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
372 | 372 |
373 SkMatrix lmInverse; | 373 SkMatrix lmInverse; |
374 if (!this->getLocalMatrix().invert(&lmInverse)) { | 374 if (!this->getLocalMatrix().invert(&lmInverse)) { |
375 return false; | 375 return false; |
376 } | 376 } |
377 if (localMatrix) { | 377 if (localMatrix) { |
378 SkMatrix inv; | 378 SkMatrix inv; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 SkErrorInternals::SetError( kInternalError_SkError, | 434 SkErrorInternals::SetError( kInternalError_SkError, |
435 "Couldn't convert bitmap to texture."); | 435 "Couldn't convert bitmap to texture."); |
436 return false; | 436 return false; |
437 } | 437 } |
438 | 438 |
439 *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? | 439 *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? |
440 SkColor2GrColor(paint.getColor()
) : | 440 SkColor2GrColor(paint.getColor()
) : |
441 SkColor2GrColorJustAlpha(paint.g
etColor()); | 441 SkColor2GrColorJustAlpha(paint.g
etColor()); |
442 | 442 |
443 if (useBicubic) { | 443 if (useBicubic) { |
444 *fp = GrBicubicEffect::Create(texture, matrix, tm); | 444 *fp = GrBicubicEffect::Create(procDataManager, texture, matrix, tm); |
445 } else { | 445 } else { |
446 *fp = GrSimpleTextureEffect::Create(texture, matrix, params); | 446 *fp = GrSimpleTextureEffect::Create(procDataManager, texture, matrix, pa
rams); |
447 } | 447 } |
448 | 448 |
449 return true; | 449 return true; |
450 } | 450 } |
451 | 451 |
452 #else | 452 #else |
453 | 453 |
454 bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const S
kMatrix&, | 454 bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const S
kMatrix&, |
455 const SkMatrix*, GrColor*, GrProces
sorDataManager*, | 455 const SkMatrix*, GrColor*, GrProces
sorDataManager*, |
456 GrFragmentProcessor**) const { | 456 GrFragmentProcessor**) const { |
457 SkDEBUGFAIL("Should not call in GPU-less build"); | 457 SkDEBUGFAIL("Should not call in GPU-less build"); |
458 return false; | 458 return false; |
459 } | 459 } |
460 | 460 |
461 #endif | 461 #endif |
OLD | NEW |