| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkPictureShader.h" | 8 #include "SkPictureShader.h" |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| 11 #include "SkBitmapProcShader.h" | 11 #include "SkBitmapProcShader.h" |
| 12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
| 13 #include "SkMatrixUtils.h" | 13 #include "SkMatrixUtils.h" |
| 14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
| 15 #include "SkReadBuffer.h" | 15 #include "SkReadBuffer.h" |
| 16 #include "SkResourceCache.h" | 16 #include "SkResourceCache.h" |
| 17 | 17 |
| 18 #if SK_SUPPORT_GPU | 18 #if SK_SUPPORT_GPU |
| 19 #include "GrContext.h" | 19 #include "GrContext.h" |
| 20 #include "GrCaps.h" | |
| 21 #endif | 20 #endif |
| 22 | 21 |
| 23 namespace { | 22 namespace { |
| 24 static unsigned gBitmapSkaderKeyNamespaceLabel; | 23 static unsigned gBitmapSkaderKeyNamespaceLabel; |
| 25 | 24 |
| 26 struct BitmapShaderKey : public SkResourceCache::Key { | 25 struct BitmapShaderKey : public SkResourceCache::Key { |
| 27 public: | 26 public: |
| 28 BitmapShaderKey(uint32_t pictureID, | 27 BitmapShaderKey(uint32_t pictureID, |
| 29 const SkRect& tile, | 28 const SkRect& tile, |
| 30 SkShader::TileMode tmx, | 29 SkShader::TileMode tmx, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 338 } |
| 340 #endif | 339 #endif |
| 341 | 340 |
| 342 #if SK_SUPPORT_GPU | 341 #if SK_SUPPORT_GPU |
| 343 bool SkPictureShader::asFragmentProcessor(GrContext* context, const SkPaint& pai
nt, | 342 bool SkPictureShader::asFragmentProcessor(GrContext* context, const SkPaint& pai
nt, |
| 344 const SkMatrix& viewM, const SkMatrix*
localMatrix, | 343 const SkMatrix& viewM, const SkMatrix*
localMatrix, |
| 345 GrColor* paintColor, | 344 GrColor* paintColor, |
| 346 GrFragmentProcessor** fp) const { | 345 GrFragmentProcessor** fp) const { |
| 347 int maxTextureSize = 0; | 346 int maxTextureSize = 0; |
| 348 if (context) { | 347 if (context) { |
| 349 maxTextureSize = context->caps()->maxTextureSize(); | 348 maxTextureSize = context->getMaxTextureSize(); |
| 350 } | 349 } |
| 351 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix
, maxTextureSize)); | 350 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix
, maxTextureSize)); |
| 352 if (!bitmapShader) { | 351 if (!bitmapShader) { |
| 353 return false; | 352 return false; |
| 354 } | 353 } |
| 355 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); | 354 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); |
| 356 } | 355 } |
| 357 #else | 356 #else |
| 358 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, | 357 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, |
| 359 const SkMatrix*, GrColor*, | 358 const SkMatrix*, GrColor*, |
| 360 GrFragmentProcessor**) const { | 359 GrFragmentProcessor**) const { |
| 361 SkDEBUGFAIL("Should not call in GPU-less build"); | 360 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 362 return false; | 361 return false; |
| 363 } | 362 } |
| 364 #endif | 363 #endif |
| OLD | NEW |