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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (NULL == device.get()) { | 69 if (NULL == device.get()) { |
70 return false; | 70 return false; |
71 } | 71 } |
72 | 72 |
73 SkCanvas canvas(device.get()); | 73 SkCanvas canvas(device.get()); |
74 canvas.scale(fSx, fSy); | 74 canvas.scale(fSx, fSy); |
75 SkPaint paint; | 75 SkPaint paint; |
76 | 76 |
77 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 77 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
78 paint.setFilterLevel(fFilterLevel); | 78 paint.setFilterLevel(fFilterLevel); |
79 canvas.drawBitmap(src, srcRect.left(), srcRect.top(), &paint); | 79 canvas.drawBitmap(src, 0, 0, &paint); |
80 | 80 |
81 *result = device.get()->accessBitmap(false); | 81 *result = device.get()->accessBitmap(false); |
82 offset->fX = dstBounds.fLeft; | 82 offset->fX = dstBounds.fLeft; |
83 offset->fY = dstBounds.fTop; | 83 offset->fY = dstBounds.fTop; |
84 return true; | 84 return true; |
85 } | 85 } |
86 | 86 |
87 void SkResizeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons
t { | 87 void SkResizeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons
t { |
88 SkRect bounds = src; | 88 SkRect bounds = src; |
89 if (getInput(0)) { | 89 if (getInput(0)) { |
(...skipping 14 matching lines...) Expand all Loading... |
104 matrix.mapRect(&floatBounds, SkRect::Make(src)); | 104 matrix.mapRect(&floatBounds, SkRect::Make(src)); |
105 SkIRect bounds; | 105 SkIRect bounds; |
106 floatBounds.roundOut(&bounds); | 106 floatBounds.roundOut(&bounds); |
107 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { | 107 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
111 *dst = bounds; | 111 *dst = bounds; |
112 return true; | 112 return true; |
113 } | 113 } |
OLD | NEW |