@@ -161,7 +161,7 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
161
161
Direction direction,
162
162
int radius,
163
163
float sigma,
164
- const SkIRect& srcBounds ,
164
+ SkIRect* contentRect ,
165
165
GrTextureDomain::Mode mode,
166
166
const SkImageInfo& dstII,
167
167
SkBackingFit fit) {
@@ -184,18 +184,19 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
184
184
int bounds[2 ] = { 0 , 0 };
185
185
SkIRect dstRect = SkIRect::MakeWH (srcRect.width (), srcRect.height ());
186
186
if (GrTextureDomain::kIgnore_Mode == mode) {
187
+ *contentRect = dstRect;
187
188
convolve_gaussian_1d (dstRenderTargetContext.get (), clip, dstRect, srcOffset,
188
189
std::move (proxy), direction, radius, sigma,
189
190
GrTextureDomain::kIgnore_Mode , bounds);
190
191
return dstRenderTargetContext;
191
192
}
192
193
193
- SkIRect midRect = srcBounds , leftRect, rightRect;
194
+ SkIRect midRect = *contentRect , leftRect, rightRect;
194
195
midRect.offset (srcOffset);
195
196
SkIRect topRect, bottomRect;
196
197
if (Direction::kX == direction) {
197
- bounds[0 ] = srcBounds. left ();
198
- bounds[1 ] = srcBounds. right ();
198
+ bounds[0 ] = contentRect-> left ();
199
+ bounds[1 ] = contentRect-> right ();
199
200
topRect = SkIRect::MakeLTRB (0 , 0 , dstRect.right (), midRect.top ());
200
201
bottomRect = SkIRect::MakeLTRB (0 , midRect.bottom (), dstRect.right (), dstRect.bottom ());
201
202
midRect.inset (radius, 0 );
@@ -204,9 +205,14 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
204
205
SkIRect::MakeLTRB (midRect.right (), midRect.top (), dstRect.width (), midRect.bottom ());
205
206
dstRect.fTop = midRect.top ();
206
207
dstRect.fBottom = midRect.bottom ();
208
+
209
+ contentRect->fLeft = dstRect.fLeft ;
210
+ contentRect->fTop = midRect.fTop ;
211
+ contentRect->fRight = dstRect.fRight ;
212
+ contentRect->fBottom = midRect.fBottom ;
207
213
} else {
208
- bounds[0 ] = srcBounds. top ();
209
- bounds[1 ] = srcBounds. bottom ();
214
+ bounds[0 ] = contentRect-> top ();
215
+ bounds[1 ] = contentRect-> bottom ();
210
216
topRect = SkIRect::MakeLTRB (0 , 0 , midRect.left (), dstRect.bottom ());
211
217
bottomRect = SkIRect::MakeLTRB (midRect.right (), 0 , dstRect.right (), dstRect.bottom ());
212
218
midRect.inset (0 , radius);
@@ -215,6 +221,11 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
215
221
SkIRect::MakeLTRB (midRect.left (), midRect.bottom (), midRect.right (), dstRect.height ());
216
222
dstRect.fLeft = midRect.left ();
217
223
dstRect.fRight = midRect.right ();
224
+
225
+ contentRect->fLeft = midRect.fLeft ;
226
+ contentRect->fTop = dstRect.fTop ;
227
+ contentRect->fRight = midRect.fRight ;
228
+ contentRect->fBottom = dstRect.fBottom ;
218
229
}
219
230
if (!topRect.isEmpty ()) {
220
231
dstRenderTargetContext->clear (&topRect, 0 , GrRenderTargetContext::CanClearFullscreen::kNo );
@@ -488,7 +499,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
488
499
scale_irect_roundout (&srcRect, 1 .0f / scaleFactorX, 1 .0f / scaleFactorY);
489
500
if (sigmaX > 0 .0f ) {
490
501
dstRenderTargetContext = convolve_gaussian (context, std::move (srcProxy), srcRect, srcOffset,
491
- Direction::kX , radiusX, sigmaX, localSrcBounds,
502
+ Direction::kX , radiusX, sigmaX, & localSrcBounds,
492
503
mode, finalDestII, xFit);
493
504
if (!dstRenderTargetContext) {
494
505
return nullptr ;
@@ -508,17 +519,12 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
508
519
}
509
520
510
521
srcRect.offsetTo (0 , 0 );
511
- localSrcBounds = srcRect;
512
- if (GrTextureDomain::kClamp_Mode == mode) {
513
- // We need to adjust bounds because we only fill part of the srcRect in x-pass.
514
- localSrcBounds.inset (0 , radiusY);
515
- }
516
522
srcOffset.set (0 , 0 );
517
523
}
518
524
519
525
if (sigmaY > 0 .0f ) {
520
526
dstRenderTargetContext = convolve_gaussian (context, std::move (srcProxy), srcRect, srcOffset,
521
- Direction::kY , radiusY, sigmaY, localSrcBounds,
527
+ Direction::kY , radiusY, sigmaY, & localSrcBounds,
522
528
mode, finalDestII, yFit);
523
529
if (!dstRenderTargetContext) {
524
530
return nullptr ;
0 commit comments