| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 59 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 60 if (kEffect_Type == fType) { | 60 if (kEffect_Type == fType) { |
| 61 return kGPUOnly_Flag; | 61 return kGPUOnly_Flag; |
| 62 } else { | 62 } else { |
| 63 return 0; | 63 return 0; |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 67 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 68 #if SK_SUPPORT_GPU | 68 #if SK_SUPPORT_GPU |
| 69 SkBaseDevice* device = canvas->getTopDevice(); | 69 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
| 70 GrContext* context = NULL; | 70 GrContext* context = rt ? rt->getContext() : NULL; |
| 71 GrRenderTarget* rt = device->accessRenderTarget(); | |
| 72 if (NULL != rt) { | |
| 73 context = rt->getContext(); | |
| 74 } | |
| 75 if (kEffect_Type == fType && NULL == context) { | 71 if (kEffect_Type == fType && NULL == context) { |
| 76 return; | 72 return; |
| 77 } | 73 } |
| 78 #endif | 74 #endif |
| 79 | 75 |
| 80 SkPaint paint; | 76 SkPaint paint; |
| 81 if (kAA_Draw_Type == fType) { | 77 if (kAA_Draw_Type == fType) { |
| 82 paint.setAntiAlias(true); | 78 paint.setAntiAlias(true); |
| 83 } | 79 } |
| 84 | 80 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 246 |
| 251 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) | 247 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) |
| 252 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) | 248 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) |
| 253 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) | 249 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) |
| 254 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) | 250 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) |
| 255 #if SK_SUPPORT_GPU | 251 #if SK_SUPPORT_GPU |
| 256 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) | 252 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) |
| 257 #endif | 253 #endif |
| 258 | 254 |
| 259 } | 255 } |
| OLD | NEW |