| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 // This test only works with the GPU backend. | 8 // This test only works with the GPU backend. |
| 9 | 9 |
| 10 #include "gm.h" | 10 #include "gm.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; | 175 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; |
| 176 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, p)); | 176 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, p)); |
| 177 if (!fp) { | 177 if (!fp) { |
| 178 continue; | 178 continue; |
| 179 } | 179 } |
| 180 | 180 |
| 181 GrPipelineBuilder pipelineBuilder; | 181 GrPipelineBuilder pipelineBuilder; |
| 182 pipelineBuilder.setXPFactory( | 182 pipelineBuilder.setXPFactory( |
| 183 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref
(); | 183 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref
(); |
| 184 pipelineBuilder.addCoverageFragmentProcessor(fp); | 184 pipelineBuilder.addCoverageFragmentProcessor(fp); |
| 185 pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget(
)); | |
| 186 | 185 |
| 187 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds(
), 0xff000000)); | 186 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds(
), 0xff000000)); |
| 188 | 187 |
| 189 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui
lder, batch); | 188 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui
lder, batch); |
| 190 | 189 |
| 191 x += SkScalarCeilToScalar(path->getBounds().width() + kDX); | 190 x += SkScalarCeilToScalar(path->getBounds().width() + kDX); |
| 192 } | 191 } |
| 193 | 192 |
| 194 // Draw AA and non AA paths using normal API for reference. | 193 // Draw AA and non AA paths using normal API for reference. |
| 195 canvas->save(); | 194 canvas->save(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 216 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; | 215 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; |
| 217 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, rect)); | 216 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create(
edgeType, rect)); |
| 218 if (!fp) { | 217 if (!fp) { |
| 219 continue; | 218 continue; |
| 220 } | 219 } |
| 221 | 220 |
| 222 GrPipelineBuilder pipelineBuilder; | 221 GrPipelineBuilder pipelineBuilder; |
| 223 pipelineBuilder.setXPFactory( | 222 pipelineBuilder.setXPFactory( |
| 224 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref
(); | 223 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref
(); |
| 225 pipelineBuilder.addCoverageFragmentProcessor(fp); | 224 pipelineBuilder.addCoverageFragmentProcessor(fp); |
| 226 pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget(
)); | |
| 227 | 225 |
| 228 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff00
0000)); | 226 SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff00
0000)); |
| 229 | 227 |
| 230 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui
lder, batch); | 228 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBui
lder, batch); |
| 231 | 229 |
| 232 x += SkScalarCeilToScalar(rect.width() + kDX); | 230 x += SkScalarCeilToScalar(rect.width() + kDX); |
| 233 } | 231 } |
| 234 | 232 |
| 235 // Draw rect without and with AA using normal API for reference | 233 // Draw rect without and with AA using normal API for reference |
| 236 canvas->save(); | 234 canvas->save(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 252 PathList fPaths; | 250 PathList fPaths; |
| 253 RectList fRects; | 251 RectList fRects; |
| 254 | 252 |
| 255 typedef GM INHERITED; | 253 typedef GM INHERITED; |
| 256 }; | 254 }; |
| 257 | 255 |
| 258 DEF_GM(return new ConvexPolyEffect;) | 256 DEF_GM(return new ConvexPolyEffect;) |
| 259 } | 257 } |
| 260 | 258 |
| 261 #endif | 259 #endif |
| OLD | NEW |