Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Unified Diff: gm/texdata.cpp

Issue 1151283004: Split drawing functionality out of GrContext and into new GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix no-GPU builds Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/texdata.cpp
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index dff2944bdbeae900417f89a7c599c6bcf8987d7b..e7c15b24982f01499e712f332d9f584ba0cdf3d6 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);
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698