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

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

Issue 51033004: add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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/SkSpriteBlitter_RGB16.cpp ('k') | src/effects/SkBlurMask.h » ('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 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkBitmapAlphaThresholdShader.h" 8 #include "SkBitmapAlphaThresholdShader.h"
9 9
10 class BATShader : public SkShader { 10 class BATShader : public SkShader {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 SkRegion::Iterator iter(fRegion); 242 SkRegion::Iterator iter(fRegion);
243 context->setRenderTarget(maskTexture->asRenderTarget()); 243 context->setRenderTarget(maskTexture->asRenderTarget());
244 context->clear(NULL, 0x0); 244 context->clear(NULL, 0x0);
245 245
246 // offset to ensure border is zero on top/left 246 // offset to ensure border is zero on top/left
247 SkMatrix matrix; 247 SkMatrix matrix;
248 matrix.setTranslate(SK_Scalar1, SK_Scalar1); 248 matrix.setTranslate(SK_Scalar1, SK_Scalar1);
249 context->setMatrix(matrix); 249 context->setMatrix(matrix);
250 250
251 while (!iter.done()) { 251 while (!iter.done()) {
252 SkRect rect = SkRect::MakeFromIRect(iter.rect()); 252 SkRect rect = SkRect::Make(iter.rect());
253 context->drawRect(grPaint, rect); 253 context->drawRect(grPaint, rect);
254 iter.next(); 254 iter.next();
255 } 255 }
256 256
257 GrTexture* bmpTexture = GrLockAndRefCachedBitmapTexture(context, fBitmap, NU LL); 257 GrTexture* bmpTexture = GrLockAndRefCachedBitmapTexture(context, fBitmap, NU LL);
258 if (NULL == bmpTexture) { 258 if (NULL == bmpTexture) {
259 return NULL; 259 return NULL;
260 } 260 }
261 261
262 SkMatrix bmpMatrix = localInverse; 262 SkMatrix bmpMatrix = localInverse;
263 bmpMatrix.postIDiv(bmpTexture->width(), bmpTexture->height()); 263 bmpMatrix.postIDiv(bmpTexture->width(), bmpTexture->height());
264 264
265 SkMatrix maskMatrix = localInverse; 265 SkMatrix maskMatrix = localInverse;
266 // compensate for the border 266 // compensate for the border
267 maskMatrix.postTranslate(SK_Scalar1, SK_Scalar1); 267 maskMatrix.postTranslate(SK_Scalar1, SK_Scalar1);
268 maskMatrix.postIDiv(maskTexture->width(), maskTexture->height()); 268 maskMatrix.postIDiv(maskTexture->width(), maskTexture->height());
269 269
270 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, 270 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix,
271 maskTexture, maskMatrix, 271 maskTexture, maskMatrix,
272 fThreshold); 272 fThreshold);
273 273
274 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); 274 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture);
275 275
276 return effect; 276 return effect;
277 } 277 }
278 278
279 #endif 279 #endif
OLDNEW
« no previous file with comments | « src/core/SkSpriteBlitter_RGB16.cpp ('k') | src/effects/SkBlurMask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698