Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/effects/SkResizeImageFilter.cpp

Issue 208303002: Fixed resize filter (with test) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/resizeimagefilter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/resizeimagefilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698