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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 bitmap.height() <= fContext->caps()->maxTileSize())); | 1097 bitmap.height() <= fContext->caps()->maxTileSize())); |
1098 | 1098 |
1099 GrTexture* texture; | 1099 GrTexture* texture; |
1100 SkSourceGammaTreatment gammaTreatment = this->surfaceProps().isGammaCorrect(
) | 1100 SkSourceGammaTreatment gammaTreatment = this->surfaceProps().isGammaCorrect(
) |
1101 ? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore; | 1101 ? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore; |
1102 AutoBitmapTexture abt(fContext, bitmap, params, gammaTreatment, &texture); | 1102 AutoBitmapTexture abt(fContext, bitmap, params, gammaTreatment, &texture); |
1103 if (nullptr == texture) { | 1103 if (nullptr == texture) { |
1104 return; | 1104 return; |
1105 } | 1105 } |
1106 | 1106 |
1107 SkColorSpace* dstColorSpace = nullptr; // XFORMTODO | 1107 sk_sp<GrColorSpaceXform> colorSpaceXform = |
1108 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(bitmap.co
lorSpace(), | 1108 GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace
()); |
1109 dstColorS
pace); | |
1110 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() }; | 1109 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() }; |
1111 SkRect paintRect; | 1110 SkRect paintRect; |
1112 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width())); | 1111 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width())); |
1113 SkScalar hInv = SkScalarInvert(SkIntToScalar(texture->height())); | 1112 SkScalar hInv = SkScalarInvert(SkIntToScalar(texture->height())); |
1114 paintRect.setLTRB(SkScalarMul(srcRect.fLeft, wInv), | 1113 paintRect.setLTRB(SkScalarMul(srcRect.fLeft, wInv), |
1115 SkScalarMul(srcRect.fTop, hInv), | 1114 SkScalarMul(srcRect.fTop, hInv), |
1116 SkScalarMul(srcRect.fRight, wInv), | 1115 SkScalarMul(srcRect.fRight, wInv), |
1117 SkScalarMul(srcRect.fBottom, hInv)); | 1116 SkScalarMul(srcRect.fBottom, hInv)); |
1118 | 1117 |
1119 SkMatrix texMatrix; | 1118 SkMatrix texMatrix; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 } | 1537 } |
1539 | 1538 |
1540 static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_Filt
erMode; | 1539 static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_Filt
erMode; |
1541 bool gammaCorrect = this->surfaceProps().isGammaCorrect(); | 1540 bool gammaCorrect = this->surfaceProps().isGammaCorrect(); |
1542 SkSourceGammaTreatment gammaTreatment = gammaCorrect | 1541 SkSourceGammaTreatment gammaTreatment = gammaCorrect |
1543 ? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore; | 1542 ? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore; |
1544 sk_sp<GrFragmentProcessor> fp( | 1543 sk_sp<GrFragmentProcessor> fp( |
1545 producer->createFragmentProcessor(SkMatrix::I(), | 1544 producer->createFragmentProcessor(SkMatrix::I(), |
1546 SkRect::MakeIWH(producer->width(), pro
ducer->height()), | 1545 SkRect::MakeIWH(producer->width(), pro
ducer->height()), |
1547 GrTextureProducer::kNo_FilterConstrain
t, true, | 1546 GrTextureProducer::kNo_FilterConstrain
t, true, |
1548 &kMode, gammaTreatment)); | 1547 &kMode, fDrawContext->getColorSpace(),
gammaTreatment)); |
1549 GrPaint grPaint; | 1548 GrPaint grPaint; |
1550 if (!SkPaintToGrPaintWithTexture(this->context(), paint, *draw.fMatrix, std:
:move(fp), | 1549 if (!SkPaintToGrPaintWithTexture(this->context(), paint, *draw.fMatrix, std:
:move(fp), |
1551 producer->isAlphaOnly(), gammaCorrect, &grP
aint)) { | 1550 producer->isAlphaOnly(), gammaCorrect, &grP
aint)) { |
1552 return; | 1551 return; |
1553 } | 1552 } |
1554 | 1553 |
1555 fDrawContext->drawImageNine(fClip, grPaint, *draw.fMatrix, producer->width()
, | 1554 fDrawContext->drawImageNine(fClip, grPaint, *draw.fMatrix, producer->width()
, |
1556 producer->height(), center, dst); | 1555 producer->height(), center, dst); |
1557 } | 1556 } |
1558 | 1557 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 } | 1870 } |
1872 | 1871 |
1873 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { | 1872 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { |
1874 ASSERT_SINGLE_OWNER | 1873 ASSERT_SINGLE_OWNER |
1875 // We always return a transient cache, so it is freed after each | 1874 // We always return a transient cache, so it is freed after each |
1876 // filter traversal. | 1875 // filter traversal. |
1877 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); | 1876 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); |
1878 } | 1877 } |
1879 | 1878 |
1880 #endif | 1879 #endif |
OLD | NEW |