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

Side by Side Diff: src/gpu/GrSWMaskHelper.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrSWMaskHelper.h" 8 #include "GrSWMaskHelper.h"
9 9
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 } 99 }
100 100
101 /** 101 /**
102 * Draw a single rect element of the clip stack into the accumulation bitmap 102 * Draw a single rect element of the clip stack into the accumulation bitmap
103 */ 103 */
104 void GrSWMaskHelper::draw(const SkRect& rect, SkRegion::Op op, 104 void GrSWMaskHelper::draw(const SkRect& rect, SkRegion::Op op,
105 bool antiAlias, uint8_t alpha) { 105 bool antiAlias, uint8_t alpha) {
106 SkPaint paint; 106 SkPaint paint;
107 107
108 SkXfermode* mode = SkXfermode::Create(op_to_mode(op));
109
110 SkASSERT(kNone_CompressionMode == fCompressionMode); 108 SkASSERT(kNone_CompressionMode == fCompressionMode);
111 109
112 paint.setXfermode(mode); 110 paint.setXfermode(SkXfermode::Make(op_to_mode(op)));
113 paint.setAntiAlias(antiAlias); 111 paint.setAntiAlias(antiAlias);
114 paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); 112 paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha));
115 113
116 fDraw.drawRect(rect, paint); 114 fDraw.drawRect(rect, paint);
117
118 SkSafeUnref(mode);
119 } 115 }
120 116
121 /** 117 /**
122 * Draw a single path element of the clip stack into the accumulation bitmap 118 * Draw a single path element of the clip stack into the accumulation bitmap
123 */ 119 */
124 void GrSWMaskHelper::draw(const SkPath& path, const SkStrokeRec& stroke, SkRegio n::Op op, 120 void GrSWMaskHelper::draw(const SkPath& path, const SkStrokeRec& stroke, SkRegio n::Op op,
125 bool antiAlias, uint8_t alpha) { 121 bool antiAlias, uint8_t alpha) {
126 122
127 SkPaint paint; 123 SkPaint paint;
128 if (stroke.isHairlineStyle()) { 124 if (stroke.isHairlineStyle()) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 pipelineBuilder->addCoverageFragmentProcessor( 357 pipelineBuilder->addCoverageFragmentProcessor(
362 GrSimpleTextureEffect::Create(texture, 358 GrSimpleTextureEffect::Create(texture,
363 maskMatrix, 359 maskMatrix,
364 GrTextureParams::kNone_Fi lterMode, 360 GrTextureParams::kNone_Fi lterMode,
365 kDevice_GrCoordSet))->unr ef(); 361 kDevice_GrCoordSet))->unr ef();
366 362
367 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S kMatrix::I(), 363 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S kMatrix::I(),
368 dstRect, nullptr, &invert)); 364 dstRect, nullptr, &invert));
369 target->drawBatch(*pipelineBuilder, batch); 365 target->drawBatch(*pipelineBuilder, batch);
370 } 366 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698