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

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

Issue 172793005: Revert "First draft of computeFastBounds() and onFilterBounds() for SkResizeImageFilter.", aka r135… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698