Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
| 10 | 10 |
| 11 #include "gm.h" | 11 #include "gm.h" |
| 12 | 12 |
| 13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
| 14 #include "GrContext.h" | 14 #include "GrContext.h" |
| 15 #include "GrDrawContext.h" | 15 #include "GrDrawContext.h" |
| 16 #include "SkColorPriv.h" | 16 #include "SkColorPriv.h" |
| 17 #include "effects/GrPorterDuffXferProcessor.h" | 17 #include "effects/GrPorterDuffXferProcessor.h" |
| 18 #include "effects/GrSimpleTextureEffect.h" | 18 #include "effects/GrSimpleTextureEffect.h" |
| 19 | 19 |
| 20 static const int S = 200; | 20 static const int S = 200; |
| 21 | 21 |
| 22 DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) { | 22 DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) { |
| 23 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa rget(); | 23 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa rget(); |
| 24 GrContext* ctx = canvas->getGrContext(); | 24 GrContext* ctx = canvas->getGrContext(); |
| 25 SkAutoTUnref<GrDrawContext> drawContext(ctx ? ctx->drawContext(target) : nullptr); | 25 SkAutoTUnref<GrDrawContext> drawContext(ctx ? ctx->drawingMgr().drawCont ext(target) |
|
bsalomon
2015/10/16 17:54:53
really want to have to go through ->drawingMgr() f
| |
| 26 : nullptr); | |
| 26 if (drawContext && target) { | 27 if (drawContext && target) { |
| 27 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); | 28 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); |
| 28 static const int stride = 2 * S; | 29 static const int stride = 2 * S; |
| 29 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); | 30 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); |
| 30 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff); | 31 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff); |
| 31 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00); | 32 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00); |
| 32 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80); | 33 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80); |
| 33 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00); | 34 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00); |
| 34 static const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00); | 35 static const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00); |
| 35 for (int i = 0; i < 2; ++i) { | 36 for (int i = 0; i < 2; ++i) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 texture->writePixels(S, (i ? 0 : S), S, S, | 111 texture->writePixels(S, (i ? 0 : S), S, S, |
| 111 texture->config(), gTextureData.get(), | 112 texture->config(), gTextureData.get(), |
| 112 4 * stride); | 113 4 * stride); |
| 113 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)) ; | 114 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)) ; |
| 114 } | 115 } |
| 115 } else { | 116 } else { |
| 116 skiagm::GM::DrawGpuOnlyMessage(canvas); | 117 skiagm::GM::DrawGpuOnlyMessage(canvas); |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 #endif | 120 #endif |
| OLD | NEW |