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

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

Issue 305133006: use colortype instead of config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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 | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurImageFilter.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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return false; 100 return false;
101 } 101 }
102 102
103 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca le.fWidth), 103 SkRect dstRect = SkRect::MakeWH(SkScalarMul(SkIntToScalar(src.width()), fSca le.fWidth),
104 SkScalarMul(SkIntToScalar(src.height()), fSc ale.fHeight)); 104 SkScalarMul(SkIntToScalar(src.height()), fSc ale.fHeight));
105 SkIRect dstIRect; 105 SkIRect dstIRect;
106 dstRect.roundOut(&dstIRect); 106 dstRect.roundOut(&dstIRect);
107 if (dstIRect.isEmpty()) { 107 if (dstIRect.isEmpty()) {
108 return false; 108 return false;
109 } 109 }
110 result->setConfig(src.config(), dstIRect.width(), dstIRect.height()); 110 if (!result->allocPixels(src.info().makeWH(dstIRect.width(), dstIRect.height ()))) {
111 if (!result->allocPixels()) {
112 return false; 111 return false;
113 } 112 }
114 113
115 SkRect srcRect; 114 SkRect srcRect;
116 src.getBounds(&srcRect); 115 src.getBounds(&srcRect);
117 srcRect.offset(SkPoint::Make(SkIntToScalar(srcOffset.fX), SkIntToScalar(srcO ffset.fY))); 116 srcRect.offset(SkPoint::Make(SkIntToScalar(srcOffset.fX), SkIntToScalar(srcO ffset.fY)));
118 SkMatrix inverse; 117 SkMatrix inverse;
119 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit); 118 inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit);
120 inverse.postTranslate(-0.5f, -0.5f); 119 inverse.postTranslate(-0.5f, -0.5f);
121 120
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); 195 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref();
197 SkRect srcRect; 196 SkRect srcRect;
198 srcBM.getBounds(&srcRect); 197 srcBM.getBounds(&srcRect);
199 context->drawRectToRect(paint, dstRect, srcRect); 198 context->drawRectToRect(paint, dstRect, srcRect);
200 WrapTexture(dst, desc.fWidth, desc.fHeight, result); 199 WrapTexture(dst, desc.fWidth, desc.fHeight, result);
201 return true; 200 return true;
202 } 201 }
203 #endif 202 #endif
204 203
205 /////////////////////////////////////////////////////////////////////////////// 204 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698