diff options
author | robertphillips <robertphillips@google.com> | 2015-05-26 11:38:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-26 11:38:03 -0700 |
commit | ea4615034498aca2f9ca1753fb9a1ef10508d8cc (patch) | |
tree | 22f0027849de0dd18b199fb13c6c28be812cf229 /gm | |
parent | 884e97cb04db7ed053a866567ee9c6e4c01f993a (diff) |
Split drawing functionality out of GrContext and into new GrDrawContext
This is mainly a mechanical CL. There were some fiddly bits in GrContext.cpp where it no longer had access to the GrDrawTarget (and had to use the new GrDrawContext).
I've converted GrAARectRenderer & GrOvalRenderer into static classes so I could stop allocating them.
Review URL: https://codereview.chromium.org/1151283004
Diffstat (limited to 'gm')
-rw-r--r-- | gm/texdata.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gm/texdata.cpp b/gm/texdata.cpp index dff2944bdb..e7c15b2498 100644 --- a/gm/texdata.cpp +++ b/gm/texdata.cpp @@ -12,6 +12,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" +#include "GrDrawContext.h" #include "SkColorPriv.h" #include "effects/GrPorterDuffXferProcessor.h" #include "effects/GrSimpleTextureEffect.h" @@ -38,7 +39,8 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTarget(); GrContext* ctx = canvas->getGrContext(); - if (ctx && target) { + GrDrawContext* drawContext = ctx ? ctx->drawContext() : NULL; + if (drawContext && target) { SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); static const int stride = 2 * S; static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); @@ -111,7 +113,7 @@ protected: tm.postIDiv(2*S, 2*S); paint.addColorTextureProcessor(texture, tm); - ctx->drawRect(target, clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); + drawContext->drawRect(target, clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); // now update the lower right of the texture in first pass // or upper right in second pass @@ -125,7 +127,7 @@ protected: texture->writePixels(S, (i ? 0 : S), S, S, texture->config(), gTextureData.get(), 4 * stride); - ctx->drawRect(target, clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); + drawContext->drawRect(target, clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); } } else { this->drawGpuOnlyMessage(canvas); |