| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkGpuBlurUtils.h" | 8 #include "SkGpuBlurUtils.h" |
| 9 | 9 |
| 10 #include "SkRect.h" | 10 #include "SkRect.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY); | 293 scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY); |
| 294 srcRect.roundOut(&srcRect); | 294 srcRect.roundOut(&srcRect); |
| 295 const SkIRect srcIRect = srcRect.roundOut(); | 295 const SkIRect srcIRect = srcRect.roundOut(); |
| 296 if (sigmaX > 0.0f) { | 296 if (sigmaX > 0.0f) { |
| 297 if (scaleFactorX > 1) { | 297 if (scaleFactorX > 1) { |
| 298 // TODO: if we pass in the source draw context we don't need thi
s here | 298 // TODO: if we pass in the source draw context we don't need thi
s here |
| 299 if (!srcDrawContext) { | 299 if (!srcDrawContext) { |
| 300 srcDrawContext.reset(context->drawContext(srcTexture->asRend
erTarget())); | 300 srcDrawContext.reset(context->drawContext(srcTexture->asRend
erTarget())); |
| 301 if (!srcDrawContext) { | 301 if (!srcDrawContext) { |
| 302 return nullptr; | 302 return nullptr; |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 // Clear out a radius to the right of the srcRect to prevent the | 306 // Clear out a radius to the right of the srcRect to prevent the |
| 307 // X convolution from reading garbage. | 307 // X convolution from reading garbage. |
| 308 clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, | 308 clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, |
| 309 radiusX, srcIRect.height()); | 309 radiusX, srcIRect.height()); |
| 310 srcDrawContext->clear(&clearRect, 0x0, false); | 310 srcDrawContext->clear(&clearRect, 0x0, false); |
| 311 } | 311 } |
| 312 | 312 |
| 313 SkAutoTUnref<GrDrawContext> dstDrawContext( | 313 SkAutoTUnref<GrDrawContext> dstDrawContext( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 326 srcOffset.set(0, 0); | 326 srcOffset.set(0, 0); |
| 327 } | 327 } |
| 328 | 328 |
| 329 if (sigmaY > 0.0f) { | 329 if (sigmaY > 0.0f) { |
| 330 if (scaleFactorY > 1 || sigmaX > 0.0f) { | 330 if (scaleFactorY > 1 || sigmaX > 0.0f) { |
| 331 // TODO: if we pass in the source draw context we don't need thi
s here | 331 // TODO: if we pass in the source draw context we don't need thi
s here |
| 332 if (!srcDrawContext) { | 332 if (!srcDrawContext) { |
| 333 srcDrawContext.reset(context->drawContext(srcTexture->asRend
erTarget())); | 333 srcDrawContext.reset(context->drawContext(srcTexture->asRend
erTarget())); |
| 334 if (!srcDrawContext) { | 334 if (!srcDrawContext) { |
| 335 return nullptr; | 335 return nullptr; |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 // Clear out a radius below the srcRect to prevent the Y | 339 // Clear out a radius below the srcRect to prevent the Y |
| 340 // convolution from reading garbage. | 340 // convolution from reading garbage. |
| 341 clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom, | 341 clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom, |
| 342 srcIRect.width(), radiusY); | 342 srcIRect.width(), radiusY); |
| 343 srcDrawContext->clear(&clearRect, 0x0, false); | 343 srcDrawContext->clear(&clearRect, 0x0, false); |
| 344 } | 344 } |
| 345 | 345 |
| 346 SkAutoTUnref<GrDrawContext> dstDrawContext( | 346 SkAutoTUnref<GrDrawContext> dstDrawContext( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 srcRect = dstRect; | 394 srcRect = dstRect; |
| 395 srcTexture = dstTexture; | 395 srcTexture = dstTexture; |
| 396 SkTSwap(dstTexture, tempTexture); | 396 SkTSwap(dstTexture, tempTexture); |
| 397 } | 397 } |
| 398 | 398 |
| 399 return SkRef(srcTexture); | 399 return SkRef(srcTexture); |
| 400 } | 400 } |
| 401 #endif | 401 #endif |
| 402 | 402 |
| 403 } | 403 } |
| OLD | NEW |