| OLD | NEW |
| 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 "gm.h" | 8 #include "gm.h" |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 #include "GrTest.h" | 10 #include "GrTest.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 SkBaseDevice* device = canvas->getTopDevice(); | 70 SkBaseDevice* device = canvas->getTopDevice(); |
| 71 GrContext* context = NULL; | 71 GrContext* context = NULL; |
| 72 GrRenderTarget* rt = device->accessRenderTarget(); | 72 GrRenderTarget* rt = device->accessRenderTarget(); |
| 73 if (NULL != rt) { | 73 if (NULL != rt) { |
| 74 context = rt->getContext(); | 74 context = rt->getContext(); |
| 75 } | 75 } |
| 76 if (kEffect_Type == fType && NULL == context) { | 76 if (kEffect_Type == fType && NULL == context) { |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 if (kEffect_Type == fType) { | 79 if (kEffect_Type == fType) { |
| 80 numRRects *= GrRRectEffect::kEdgeTypeCnt; | 80 numRRects *= kGrEffectEdgeTypeCnt; |
| 81 } | 81 } |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 SkPaint paint; | 84 SkPaint paint; |
| 85 if (kAA_Draw_Type == fType) { | 85 if (kAA_Draw_Type == fType) { |
| 86 paint.setAntiAlias(true); | 86 paint.setAntiAlias(true); |
| 87 } | 87 } |
| 88 | 88 |
| 89 static const SkRect kMaxTileBound = SkRect::MakeWH(SkIntToScalar(kTileX)
, SkIntToScalar(kTileY)); | 89 static const SkRect kMaxTileBound = SkRect::MakeWH(SkIntToScalar(kTileX)
, SkIntToScalar(kTileY)); |
| 90 | 90 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 104 GrTestTarget tt; | 104 GrTestTarget tt; |
| 105 context->getTestTarget(&tt); | 105 context->getTestTarget(&tt); |
| 106 if (NULL == tt.target()) { | 106 if (NULL == tt.target()) { |
| 107 SkDEBUGFAIL("Couldn't get Gr test target."); | 107 SkDEBUGFAIL("Couldn't get Gr test target."); |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 GrDrawState* drawState = tt.target()->drawState(); | 110 GrDrawState* drawState = tt.target()->drawState(); |
| 111 | 111 |
| 112 SkRRect rrect = fRRects[rrectIdx]; | 112 SkRRect rrect = fRRects[rrectIdx]; |
| 113 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); | 113 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); |
| 114 GrRRectEffect::EdgeType edgeType = (GrRRectEffect::EdgeT
ype) | 114 GrEffectEdgeType edgeType = (GrEffectEdgeType) (curRRect
/ kNumRRects); |
| 115 (curRRect / kNumRRec
ts); | |
| 116 SkAutoTUnref<GrEffectRef> effect(GrRRectEffect::Create(e
dgeType, rrect)); | 115 SkAutoTUnref<GrEffectRef> effect(GrRRectEffect::Create(e
dgeType, rrect)); |
| 117 if (effect) { | 116 if (effect) { |
| 118 drawState->addCoverageEffect(effect); | 117 drawState->addCoverageEffect(effect); |
| 119 drawState->setIdentityViewMatrix(); | 118 drawState->setIdentityViewMatrix(); |
| 120 drawState->setRenderTarget(rt); | 119 drawState->setRenderTarget(rt); |
| 121 drawState->setColor(0xff000000); | 120 drawState->setColor(0xff000000); |
| 122 | 121 |
| 123 SkRect bounds = rrect.getBounds(); | 122 SkRect bounds = rrect.getBounds(); |
| 124 bounds.outset(2.f, 2.f); | 123 bounds.outset(2.f, 2.f); |
| 125 | 124 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 224 |
| 226 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) | 225 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) |
| 227 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) | 226 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) |
| 228 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) | 227 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) |
| 229 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) | 228 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) |
| 230 #if SK_SUPPORT_GPU | 229 #if SK_SUPPORT_GPU |
| 231 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) | 230 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) |
| 232 #endif | 231 #endif |
| 233 | 232 |
| 234 } | 233 } |
| OLD | NEW |