| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "gm.h" | 8 #include "gm.h" |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 GrPipelineBuilder pipelineBuilder; | 77 GrPipelineBuilder pipelineBuilder; |
| 78 pipelineBuilder.setXPFactory( | 78 pipelineBuilder.setXPFactory( |
| 79 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref
(); | 79 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref
(); |
| 80 | 80 |
| 81 SkRRect rrect = fRRect; | 81 SkRRect rrect = fRRect; |
| 82 rrect.offset(SkIntToScalar(x + kGap), SkIntToScalar(y + kGap)); | 82 rrect.offset(SkIntToScalar(x + kGap), SkIntToScalar(y + kGap)); |
| 83 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Create(edgeT
ype, rrect)); | 83 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Create(edgeT
ype, rrect)); |
| 84 SkASSERT(fp); | 84 SkASSERT(fp); |
| 85 if (fp) { | 85 if (fp) { |
| 86 pipelineBuilder.addCoverageFragmentProcessor(fp); | 86 pipelineBuilder.addCoverageFragmentProcessor(fp); |
| 87 pipelineBuilder.setRenderTarget(drawContext->accessRenderTar
get()); | |
| 88 | 87 |
| 89 SkRect bounds = testBounds; | 88 SkRect bounds = testBounds; |
| 90 bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); | 89 bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); |
| 91 | 90 |
| 92 SkAutoTUnref<GrDrawBatch> batch( | 91 SkAutoTUnref<GrDrawBatch> batch( |
| 93 GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMa
trix::I(), bounds, | 92 GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMa
trix::I(), bounds, |
| 94 nullptr, nullptr
)); | 93 nullptr, nullptr
)); |
| 95 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin
eBuilder, batch); | 94 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin
eBuilder, batch); |
| 96 } | 95 } |
| 97 canvas->restore(); | 96 canvas->restore(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 123 | 122 |
| 124 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRect(SkRect::MakeIWH(kSize,
kSize)), "rect"); ) | 123 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRect(SkRect::MakeIWH(kSize,
kSize)), "rect"); ) |
| 125 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize,
kSize)), "circle"); ) | 124 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize,
kSize)), "circle"); ) |
| 126 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize -
1, kSize - 10)), "ellipse"); ) | 125 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize -
1, kSize - 10)), "ellipse"); ) |
| 127 // The next two have small linear segments between the corners | 126 // The next two have small linear segments between the corners |
| 128 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize
- 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 10.f), "circular_corner"); ) | 127 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize
- 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 10.f), "circular_corner"); ) |
| 129 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize
- 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 15.f), "elliptical_corner"); ) | 128 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize
- 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 15.f), "elliptical_corner"); ) |
| 130 | 129 |
| 131 } | 130 } |
| 132 #endif | 131 #endif |
| OLD | NEW |