Chromium Code Reviews| Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp |
| diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp |
| index a8cc2e2181daa921370f3a965e23494626b835cb..fbc578e9ad9fcf682505adc9365ca58283ad8dbc 100644 |
| --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp |
| +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp |
| @@ -342,9 +342,15 @@ private: |
| SkIRect devPathBounds; |
| scaledBounds.roundOut(&devPathBounds); |
| // pad to allow room for antialiasing |
| - devPathBounds.outset(SkScalarCeilToInt(kAntiAliasPad), SkScalarCeilToInt(kAntiAliasPad)); |
| - // move origin to upper left corner |
| - devPathBounds.offsetTo(0,0); |
| + const int intPad = SkScalarCeilToInt(kAntiAliasPad); |
| + // pre-move origin (after outset, will be 0,0) |
| + int width = devPathBounds.width(); |
| + int height = devPathBounds.height(); |
| + devPathBounds.fLeft = intPad; |
| + devPathBounds.fTop = intPad; |
| + devPathBounds.fRight = intPad + width; |
| + devPathBounds.fBottom = intPad + height; |
| + devPathBounds.outset(intPad, intPad); |
|
joshualitt
2015/12/18 17:36:45
I guess this could still overflow if width or heig
jvanverth1
2015/12/18 17:48:42
We've already caught that case in canDraw() -- we
|
| // draw path to bitmap |
| SkMatrix drawMatrix; |
| @@ -381,8 +387,8 @@ private: |
| // generate signed distance field |
| devPathBounds.outset(SK_DistanceFieldPad, SK_DistanceFieldPad); |
| - int width = devPathBounds.width(); |
| - int height = devPathBounds.height(); |
| + width = devPathBounds.width(); |
| + height = devPathBounds.height(); |
| // TODO We should really generate this directly into the plot somehow |
| SkAutoSMalloc<1024> dfStorage(width * height * sizeof(unsigned char)); |