OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 bitmap.height() <= fContext->caps()->maxTextureSize()); | 1001 bitmap.height() <= fContext->caps()->maxTextureSize()); |
1002 // We should be respecting the max tile size by the time we get here. | 1002 // We should be respecting the max tile size by the time we get here. |
1003 SkASSERT(bitmap.width() <= fContext->caps()->maxTileSize() && | 1003 SkASSERT(bitmap.width() <= fContext->caps()->maxTileSize() && |
1004 bitmap.height() <= fContext->caps()->maxTileSize()); | 1004 bitmap.height() <= fContext->caps()->maxTileSize()); |
1005 | 1005 |
1006 sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext, bitmap, param
s, | 1006 sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext, bitmap, param
s, |
1007 fDrawContext->sourceGam
maTreatment()); | 1007 fDrawContext->sourceGam
maTreatment()); |
1008 if (nullptr == texture) { | 1008 if (nullptr == texture) { |
1009 return; | 1009 return; |
1010 } | 1010 } |
| 1011 |
1011 sk_sp<GrColorSpaceXform> colorSpaceXform = | 1012 sk_sp<GrColorSpaceXform> colorSpaceXform = |
1012 GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace
()); | 1013 GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace
()); |
1013 | 1014 |
1014 SkScalar iw = 1.f / texture->width(); | 1015 SkScalar iw = 1.f / texture->width(); |
1015 SkScalar ih = 1.f / texture->height(); | 1016 SkScalar ih = 1.f / texture->height(); |
1016 | 1017 |
1017 SkMatrix texMatrix; | 1018 SkMatrix texMatrix; |
1018 // Compute a matrix that maps the rect we will draw to the src rect. | 1019 // Compute a matrix that maps the rect we will draw to the src rect. |
1019 texMatrix.setRectToRect(dstRect, srcRect, SkMatrix::kStart_ScaleToFit); | 1020 texMatrix.setRectToRect(dstRect, srcRect, SkMatrix::kStart_ScaleToFit); |
1020 texMatrix.postScale(iw, ih); | 1021 texMatrix.postScale(iw, ih); |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 } | 1794 } |
1794 | 1795 |
1795 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { | 1796 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { |
1796 ASSERT_SINGLE_OWNER | 1797 ASSERT_SINGLE_OWNER |
1797 // We always return a transient cache, so it is freed after each | 1798 // We always return a transient cache, so it is freed after each |
1798 // filter traversal. | 1799 // filter traversal. |
1799 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); | 1800 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); |
1800 } | 1801 } |
1801 | 1802 |
1802 #endif | 1803 #endif |
OLD | NEW |