Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Android Open Source Project | 2 * Copyright 2014 The Android Open Source Project |
| 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 "SkMatrixImageFilter.h" | 8 #include "SkMatrixImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 offset->fX = dstBounds.fLeft; | 91 offset->fX = dstBounds.fLeft; |
| 92 offset->fY = dstBounds.fTop; | 92 offset->fY = dstBounds.fTop; |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void SkMatrixImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons t { | 96 void SkMatrixImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons t { |
| 97 SkRect bounds = src; | 97 SkRect bounds = src; |
| 98 if (getInput(0)) { | 98 if (getInput(0)) { |
| 99 getInput(0)->computeFastBounds(src, &bounds); | 99 getInput(0)->computeFastBounds(src, &bounds); |
| 100 } | 100 } |
| 101 SkMatrix matrix; | 101 fTransform.mapRect(dst, bounds); |
| 102 matrix.setTranslate(-bounds.x(), -bounds.y()); | 102 dst->join(bounds); // Work around for skia:3194 |
|
Stephen White
2014/12/08 17:20:51
This really doesn't seem right to me, and we could
| |
| 103 matrix.postConcat(fTransform); | |
| 104 matrix.postTranslate(bounds.x(), bounds.y()); | |
| 105 matrix.mapRect(dst, bounds); | |
| 106 } | 103 } |
| 107 | 104 |
| 108 bool SkMatrixImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm , | 105 bool SkMatrixImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm , |
| 109 SkIRect* dst) const { | 106 SkIRect* dst) const { |
| 110 SkMatrix transformInverse; | 107 SkMatrix transformInverse; |
| 111 if (!fTransform.invert(&transformInverse)) { | 108 if (!fTransform.invert(&transformInverse)) { |
| 112 return false; | 109 return false; |
| 113 } | 110 } |
| 114 SkMatrix matrix; | 111 SkMatrix matrix; |
| 115 if (!ctm.invert(&matrix)) { | 112 if (!ctm.invert(&matrix)) { |
| 116 return false; | 113 return false; |
| 117 } | 114 } |
| 118 matrix.postConcat(transformInverse); | 115 matrix.postConcat(transformInverse); |
| 119 matrix.postConcat(ctm); | 116 matrix.postConcat(ctm); |
| 120 SkRect floatBounds; | 117 SkRect floatBounds; |
| 121 matrix.mapRect(&floatBounds, SkRect::Make(src)); | 118 matrix.mapRect(&floatBounds, SkRect::Make(src)); |
| 122 SkIRect bounds = floatBounds.roundOut(); | 119 SkIRect bounds = floatBounds.roundOut(); |
| 123 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { | 120 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
| 124 return false; | 121 return false; |
| 125 } | 122 } |
| 126 | 123 |
| 127 *dst = bounds; | 124 *dst = bounds; |
| 128 return true; | 125 return true; |
| 129 } | 126 } |
| OLD | NEW |