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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 case kEffect_Type: | 50 case kEffect_Type: |
51 name.append("_effect"); | 51 name.append("_effect"); |
52 break; | 52 break; |
53 } | 53 } |
54 return name; | 54 return name; |
55 } | 55 } |
56 | 56 |
57 SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight)
; } | 57 SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight)
; } |
58 | 58 |
59 void onDraw(SkCanvas* canvas) override { | 59 void onDraw(SkCanvas* canvas) override { |
60 GrContext* context = NULL; | 60 GrContext* context = nullptr; |
61 #if SK_SUPPORT_GPU | 61 #if SK_SUPPORT_GPU |
62 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 62 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
63 context = rt ? rt->getContext() : NULL; | 63 context = rt ? rt->getContext() : nullptr; |
64 #endif | 64 #endif |
65 if (kEffect_Type == fType && NULL == context) { | 65 if (kEffect_Type == fType && nullptr == context) { |
66 this->drawGpuOnlyMessage(canvas); | 66 this->drawGpuOnlyMessage(canvas); |
67 return; | 67 return; |
68 } | 68 } |
69 | 69 |
70 SkPaint paint; | 70 SkPaint paint; |
71 if (kAA_Draw_Type == fType) { | 71 if (kAA_Draw_Type == fType) { |
72 paint.setAntiAlias(true); | 72 paint.setAntiAlias(true); |
73 } | 73 } |
74 | 74 |
75 static const SkRect kMaxTileBound = SkRect::MakeWH(SkIntToScalar(kTileX)
, | 75 static const SkRect kMaxTileBound = SkRect::MakeWH(SkIntToScalar(kTileX)
, |
(...skipping 19 matching lines...) Expand all Loading... |
95 SkRect imageSpaceBounds = fRRects[curRRect].getBounds(); | 95 SkRect imageSpaceBounds = fRRects[curRRect].getBounds(); |
96 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y)); | 96 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y)); |
97 SkASSERT(kMaxImageBound.contains(imageSpaceBounds)); | 97 SkASSERT(kMaxImageBound.contains(imageSpaceBounds)); |
98 #endif | 98 #endif |
99 canvas->save(); | 99 canvas->save(); |
100 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 100 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
101 if (kEffect_Type == fType) { | 101 if (kEffect_Type == fType) { |
102 #if SK_SUPPORT_GPU | 102 #if SK_SUPPORT_GPU |
103 GrTestTarget tt; | 103 GrTestTarget tt; |
104 context->getTestTarget(&tt); | 104 context->getTestTarget(&tt); |
105 if (NULL == tt.target()) { | 105 if (nullptr == tt.target()) { |
106 SkDEBUGFAIL("Couldn't get Gr test target."); | 106 SkDEBUGFAIL("Couldn't get Gr test target."); |
107 return; | 107 return; |
108 } | 108 } |
109 GrPipelineBuilder pipelineBuilder; | 109 GrPipelineBuilder pipelineBuilder; |
110 | 110 |
111 SkRRect rrect = fRRects[curRRect]; | 111 SkRRect rrect = fRRects[curRRect]; |
112 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); | 112 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); |
113 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; | 113 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; |
114 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Crea
te(edgeType, | 114 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Crea
te(edgeType, |
115
rrect)); | 115
rrect)); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) | 258 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) |
259 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) | 259 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) |
260 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) | 260 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) |
261 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) | 261 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) |
262 #if SK_SUPPORT_GPU | 262 #if SK_SUPPORT_GPU |
263 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) | 263 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) |
264 #endif | 264 #endif |
265 | 265 |
266 } | 266 } |
OLD | NEW |