| 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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 if (doBicubic) { | 956 if (doBicubic) { |
| 957 fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), text
ure, | 957 fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), text
ure, |
| 958 SkMatrix::I(), | 958 SkMatrix::I(), |
| 959 tm)); | 959 tm)); |
| 960 } else { | 960 } else { |
| 961 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager()
, texture, | 961 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager()
, texture, |
| 962 SkMatrix::I(), params)); | 962 SkMatrix::I(), params)); |
| 963 } | 963 } |
| 964 | 964 |
| 965 // The bitmap read has to be first | 965 // The bitmap read has to be first |
| 966 grPaint.addColorProcessor(fp); | 966 grPaint.addColorFragmentProcessor(fp); |
| 967 if (!SkPaint2GrPaintNoShader(context, renderTarget, paint, SkColor2GrColor(p
aint.getColor()), | 967 if (!SkPaint2GrPaintNoShader(context, renderTarget, paint, SkColor2GrColor(p
aint.getColor()), |
| 968 false, &grPaint)) { | 968 false, &grPaint)) { |
| 969 return; | 969 return; |
| 970 } | 970 } |
| 971 | 971 |
| 972 grPaint.setColor(paintColor); | 972 grPaint.setColor(paintColor); |
| 973 | 973 |
| 974 // Setup dst rect and final matrix | 974 // Setup dst rect and final matrix |
| 975 SkRect dstRect = {0, 0, dstSize.fWidth, dstSize.fHeight}; | 975 SkRect dstRect = {0, 0, dstSize.fWidth, dstSize.fHeight}; |
| 976 | 976 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 } else if (bicubic) { | 1298 } else if (bicubic) { |
| 1299 SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode()); | 1299 SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode()); |
| 1300 SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTil
eModeY() }; | 1300 SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTil
eModeY() }; |
| 1301 fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), text
ure, SkMatrix::I(), | 1301 fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), text
ure, SkMatrix::I(), |
| 1302 tileModes)); | 1302 tileModes)); |
| 1303 } else { | 1303 } else { |
| 1304 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager()
, texture, | 1304 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager()
, texture, |
| 1305 SkMatrix::I(), params)); | 1305 SkMatrix::I(), params)); |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 grPaint.addColorProcessor(fp); | 1308 grPaint.addColorFragmentProcessor(fp); |
| 1309 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); | 1309 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); |
| 1310 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()
) : | 1310 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()
) : |
| 1311 SkColor2GrColor(paint.getColor()); | 1311 SkColor2GrColor(paint.getColor()); |
| 1312 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, paintCol
or, false, | 1312 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, paintCol
or, false, |
| 1313 &grPaint)) { | 1313 &grPaint)) { |
| 1314 return; | 1314 return; |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 fDrawContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, viewMatrix,
dstRect, | 1317 fDrawContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, viewMatrix,
dstRect, |
| 1318 paintRect); | 1318 paintRect); |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 #endif | 1900 #endif |
| 1901 } | 1901 } |
| 1902 | 1902 |
| 1903 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1903 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1904 // We always return a transient cache, so it is freed after each | 1904 // We always return a transient cache, so it is freed after each |
| 1905 // filter traversal. | 1905 // filter traversal. |
| 1906 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1906 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1907 } | 1907 } |
| 1908 | 1908 |
| 1909 #endif | 1909 #endif |
| OLD | NEW |