OLD | NEW |
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 "SkAlphaThresholdFilter.h" | 8 #include "SkAlphaThresholdFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa
tch)); | 287 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa
tch)); |
288 if (!maskTexture) { | 288 if (!maskTexture) { |
289 return false; | 289 return false; |
290 } | 290 } |
291 | 291 |
292 { | 292 { |
293 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget
()); | 293 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget
()); |
294 GrPaint grPaint; | 294 GrPaint grPaint; |
295 grPaint.setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff); | 295 grPaint.setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff); |
296 SkRegion::Iterator iter(fRegion); | 296 SkRegion::Iterator iter(fRegion); |
297 context->clear(NULL, 0x0, true); | 297 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget()); |
298 | 298 |
299 SkMatrix old_matrix = context->getMatrix(); | 299 SkMatrix old_matrix = context->getMatrix(); |
300 context->setMatrix(in_matrix); | 300 context->setMatrix(in_matrix); |
301 | 301 |
302 while (!iter.done()) { | 302 while (!iter.done()) { |
303 SkRect rect = SkRect::Make(iter.rect()); | 303 SkRect rect = SkRect::Make(iter.rect()); |
304 context->drawRect(grPaint, rect); | 304 context->drawRect(grPaint, rect); |
305 iter.next(); | 305 iter.next(); |
306 } | 306 } |
307 context->setMatrix(old_matrix); | 307 context->setMatrix(old_matrix); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 (U8CPU)(SkColorGetG(source) *
scale), | 377 (U8CPU)(SkColorGetG(source) *
scale), |
378 (U8CPU)(SkColorGetB(source) *
scale)); | 378 (U8CPU)(SkColorGetB(source) *
scale)); |
379 } | 379 } |
380 } | 380 } |
381 dptr[y * dst->width() + x] = output_color; | 381 dptr[y * dst->width() + x] = output_color; |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 return true; | 385 return true; |
386 } | 386 } |
OLD | NEW |