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

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

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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 | « src/core/SkPaint.cpp ('k') | src/effects/SkBlurMask.cpp » ('j') | 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 "SkBicubicImageFilter.h" 8 #include "SkBicubicImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 result->setConfig(src.config(), dstIRect.width(), dstIRect.height()); 108 result->setConfig(src.config(), dstIRect.width(), dstIRect.height());
109 result->allocPixels(); 109 result->allocPixels();
110 if (!result->getPixels()) { 110 if (!result->getPixels()) {
111 return false; 111 return false;
112 } 112 }
113 113
114 SkRect srcRect; 114 SkRect srcRect;
115 src.getBounds(&srcRect); 115 src.getBounds(&srcRect);
116 SkMatrix inverse; 116 SkMatrix inverse;
117 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); 117 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit);
118 inverse.postTranslate(SkFloatToScalar(-0.5f), SkFloatToScalar(-0.5f)); 118 inverse.postTranslate(-0.5f, -0.5f);
119 119
120 for (int y = dstIRect.fTop; y < dstIRect.fBottom; ++y) { 120 for (int y = dstIRect.fTop; y < dstIRect.fBottom; ++y) {
121 SkPMColor* dptr = result->getAddr32(dstIRect.fLeft, y); 121 SkPMColor* dptr = result->getAddr32(dstIRect.fLeft, y);
122 for (int x = dstIRect.fLeft; x < dstIRect.fRight; ++x) { 122 for (int x = dstIRect.fLeft; x < dstIRect.fRight; ++x) {
123 SkPoint srcPt, dstPt = SkPoint::Make(SkIntToScalar(x), SkIntToScalar (y)); 123 SkPoint srcPt, dstPt = SkPoint::Make(SkIntToScalar(x), SkIntToScalar (y));
124 inverse.mapPoints(&srcPt, &dstPt, 1); 124 inverse.mapPoints(&srcPt, &dstPt, 1);
125 SkScalar fractx = srcPt.fX - SkScalarFloorToScalar(srcPt.fX); 125 SkScalar fractx = srcPt.fX - SkScalarFloorToScalar(srcPt.fX);
126 SkScalar fracty = srcPt.fY - SkScalarFloorToScalar(srcPt.fY); 126 SkScalar fracty = srcPt.fY - SkScalarFloorToScalar(srcPt.fY);
127 int sx = SkScalarFloorToInt(srcPt.fX); 127 int sx = SkScalarFloorToInt(srcPt.fX);
128 int sy = SkScalarFloorToInt(srcPt.fY); 128 int sy = SkScalarFloorToInt(srcPt.fY);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 GrPaint paint; 191 GrPaint paint;
192 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); 192 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref();
193 SkRect srcRect; 193 SkRect srcRect;
194 srcBM.getBounds(&srcRect); 194 srcBM.getBounds(&srcRect);
195 context->drawRectToRect(paint, dstRect, srcRect); 195 context->drawRectToRect(paint, dstRect, srcRect);
196 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t); 196 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t);
197 } 197 }
198 #endif 198 #endif
199 199
200 /////////////////////////////////////////////////////////////////////////////// 200 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/effects/SkBlurMask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698