| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2013 The Android Open Source Project | 2  * Copyright 2013 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 "SkResizeImageFilter.h" | 8 #include "SkResizeImageFilter.h" | 
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" | 
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 73     paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 73     paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 
| 74     paint.setFilterLevel(fFilterLevel); | 74     paint.setFilterLevel(fFilterLevel); | 
| 75     canvas.concat(dstMatrix); | 75     canvas.concat(dstMatrix); | 
| 76     canvas.drawBitmap(src, srcRect.left(), srcRect.top(), &paint); | 76     canvas.drawBitmap(src, srcRect.left(), srcRect.top(), &paint); | 
| 77 | 77 | 
| 78     *result = device.get()->accessBitmap(false); | 78     *result = device.get()->accessBitmap(false); | 
| 79     offset->fX = dstBounds.fLeft; | 79     offset->fX = dstBounds.fLeft; | 
| 80     offset->fY = dstBounds.fTop; | 80     offset->fY = dstBounds.fTop; | 
| 81     return true; | 81     return true; | 
| 82 } | 82 } | 
| 83 |  | 
| 84 void SkResizeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons
     t { |  | 
| 85     SkRect bounds = src; |  | 
| 86     if (getInput(0)) { |  | 
| 87         getInput(0)->computeFastBounds(src, &bounds); |  | 
| 88     } |  | 
| 89     dst->setXYWH(bounds.x(), bounds.y(), bounds.width() * fSx, bounds.height() *
      fSy); |  | 
| 90 } |  | 
| 91 |  | 
| 92 bool SkResizeImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm
     , |  | 
| 93                                          SkIRect* dst) const { |  | 
| 94     SkMatrix dstMatrix; |  | 
| 95     SkRect dstRect; |  | 
| 96     SkIRect dstRectI; |  | 
| 97     dstMatrix.setScale(SkScalarInvert(fSx), SkScalarInvert(fSy)); |  | 
| 98     dstMatrix.mapRect(&dstRect, SkRect::Make(src)); |  | 
| 99     dstRect.roundOut(&dstRectI); |  | 
| 100     if (getInput(0) && !getInput(0)->filterBounds(dstRectI, ctm, &dstRectI)) { |  | 
| 101         return false; |  | 
| 102     } |  | 
| 103 //    *dst = dstRectI; |  | 
| 104     *dst = src; |  | 
| 105     return true; |  | 
| 106 } |  | 
| 107 |  | 
| OLD | NEW | 
|---|