| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const SkMatrix* textureMatrix; | 194 const SkMatrix* textureMatrix; |
| 195 SkMatrix tempMatrix; | 195 SkMatrix tempMatrix; |
| 196 if (canUseTextureCoordsAsLocalCoords) { | 196 if (canUseTextureCoordsAsLocalCoords) { |
| 197 textureMatrix = &SkMatrix::I(); | 197 textureMatrix = &SkMatrix::I(); |
| 198 } else { | 198 } else { |
| 199 if (!srcToDstMatrix.invert(&tempMatrix)) { | 199 if (!srcToDstMatrix.invert(&tempMatrix)) { |
| 200 return; | 200 return; |
| 201 } | 201 } |
| 202 textureMatrix = &tempMatrix; | 202 textureMatrix = &tempMatrix; |
| 203 } | 203 } |
| 204 bool gammaCorrect = this->surfaceProps().isGammaCorrect(); |
| 204 SkAutoTUnref<const GrFragmentProcessor> fp(producer->createFragmentProcessor
( | 205 SkAutoTUnref<const GrFragmentProcessor> fp(producer->createFragmentProcessor
( |
| 205 *textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect,
filterMode)); | 206 *textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect,
filterMode, |
| 207 gammaCorrect)); |
| 206 if (!fp) { | 208 if (!fp) { |
| 207 return; | 209 return; |
| 208 } | 210 } |
| 209 | 211 |
| 210 GrPaint grPaint; | 212 GrPaint grPaint; |
| 211 if (!SkPaintToGrPaintWithTexture(fContext, paint, viewMatrix, fp, producer->
isAlphaOnly(), | 213 if (!SkPaintToGrPaintWithTexture(fContext, paint, viewMatrix, fp, producer->
isAlphaOnly(), |
| 212 this->surfaceProps().isGammaCorrect(), &grP
aint)) { | 214 gammaCorrect, &grPaint)) { |
| 213 return; | 215 return; |
| 214 } | 216 } |
| 215 | 217 |
| 216 if (canUseTextureCoordsAsLocalCoords) { | 218 if (canUseTextureCoordsAsLocalCoords) { |
| 217 fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect,
clippedSrcRect); | 219 fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect,
clippedSrcRect); |
| 218 return; | 220 return; |
| 219 } | 221 } |
| 220 | 222 |
| 221 if (!mf) { | 223 if (!mf) { |
| 222 fDrawContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect); | 224 fDrawContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 236 rrect)) { | 238 rrect)) { |
| 237 return; | 239 return; |
| 238 } | 240 } |
| 239 SkPath rectPath; | 241 SkPath rectPath; |
| 240 rectPath.addRect(clippedDstRect); | 242 rectPath.addRect(clippedDstRect); |
| 241 rectPath.setIsVolatile(true); | 243 rectPath.setIsVolatile(true); |
| 242 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext.get(), fCl
ip, | 244 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext.get(), fCl
ip, |
| 243 rectPath, &grPaint, viewMatrix, mf, GrSt
yle::SimpleFill(), | 245 rectPath, &grPaint, viewMatrix, mf, GrSt
yle::SimpleFill(), |
| 244 true); | 246 true); |
| 245 } | 247 } |
| OLD | NEW |