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

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

Issue 766653008: Revert of Make all blending up to GrOptDrawState be handled by the xp/xp factory. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: Created 6 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
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkBlurMaskFilter.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 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 30 matching lines...) Expand all
41 SkImageFilter* input) { 41 SkImageFilter* input) {
42 return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outer Threshold, input)); 42 return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outer Threshold, input));
43 } 43 }
44 44
45 #if SK_SUPPORT_GPU 45 #if SK_SUPPORT_GPU
46 #include "GrContext.h" 46 #include "GrContext.h"
47 #include "GrCoordTransform.h" 47 #include "GrCoordTransform.h"
48 #include "GrFragmentProcessor.h" 48 #include "GrFragmentProcessor.h"
49 #include "GrInvariantOutput.h" 49 #include "GrInvariantOutput.h"
50 #include "GrTextureAccess.h" 50 #include "GrTextureAccess.h"
51 #include "effects/GrPorterDuffXferProcessor.h"
52 51
53 #include "SkGr.h" 52 #include "SkGr.h"
54 53
55 #include "gl/GrGLProcessor.h" 54 #include "gl/GrGLProcessor.h"
56 #include "gl/builders/GrGLProgramBuilder.h" 55 #include "gl/builders/GrGLProgramBuilder.h"
57 56
58 class AlphaThresholdEffect : public GrFragmentProcessor { 57 class AlphaThresholdEffect : public GrFragmentProcessor {
59 58
60 public: 59 public:
61 static GrFragmentProcessor* Create(GrTexture* texture, 60 static GrFragmentProcessor* Create(GrTexture* texture,
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 maskDesc.fHeight = texture->height(); 274 maskDesc.fHeight = texture->height();
276 SkAutoTUnref<GrTexture> maskTexture( 275 SkAutoTUnref<GrTexture> maskTexture(
277 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa tch)); 276 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa tch));
278 if (!maskTexture) { 277 if (!maskTexture) {
279 return false; 278 return false;
280 } 279 }
281 280
282 { 281 {
283 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget ()); 282 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget ());
284 GrPaint grPaint; 283 GrPaint grPaint;
285 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 284 grPaint.setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff);
286 SkRegion::Iterator iter(fRegion); 285 SkRegion::Iterator iter(fRegion);
287 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget()); 286 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget());
288 287
289 SkMatrix old_matrix = context->getMatrix(); 288 SkMatrix old_matrix = context->getMatrix();
290 context->setMatrix(in_matrix); 289 context->setMatrix(in_matrix);
291 290
292 while (!iter.done()) { 291 while (!iter.done()) {
293 SkRect rect = SkRect::Make(iter.rect()); 292 SkRect rect = SkRect::Make(iter.rect());
294 context->drawRect(grPaint, rect); 293 context->drawRect(grPaint, rect);
295 iter.next(); 294 iter.next();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 (U8CPU)(SkColorGetG(source) * scale), 366 (U8CPU)(SkColorGetG(source) * scale),
368 (U8CPU)(SkColorGetB(source) * scale)); 367 (U8CPU)(SkColorGetB(source) * scale));
369 } 368 }
370 } 369 }
371 dptr[y * dst->width() + x] = output_color; 370 dptr[y * dst->width() + x] = output_color;
372 } 371 }
373 } 372 }
374 373
375 return true; 374 return true;
376 } 375 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698