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

Side by Side Diff: gm/texdata.cpp

Issue 1918003003: Bring sk_sp to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 // This test only works with the GPU backend. 8 // This test only works with the GPU backend.
9 9
10 #include "gm.h" 10 #include "gm.h"
11 11
12 #if SK_SUPPORT_GPU 12 #if SK_SUPPORT_GPU
13 #include "GrContext.h" 13 #include "GrContext.h"
14 #include "GrDrawContext.h" 14 #include "GrDrawContext.h"
15 #include "SkColorPriv.h" 15 #include "SkColorPriv.h"
16 #include "effects/GrPorterDuffXferProcessor.h" 16 #include "effects/GrPorterDuffXferProcessor.h"
17 #include "effects/GrSimpleTextureEffect.h" 17 #include "effects/GrSimpleTextureEffect.h"
18 18
19 static const int S = 200; 19 static const int S = 200;
20 20
21 DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) { 21 DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
22 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa rget(); 22 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa rget();
23 GrContext* ctx = canvas->getGrContext(); 23 GrContext* ctx = canvas->getGrContext();
24 SkAutoTUnref<GrDrawContext> drawContext(ctx ? ctx->drawContext(target) : nullptr); 24 sk_sp<GrDrawContext> drawContext(ctx ? ctx->drawContext(sk_ref_sp(target )) : nullptr);
25 if (drawContext && target) { 25 if (drawContext && target) {
26 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); 26 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S));
27 static const int stride = 2 * S; 27 static const int stride = 2 * S;
28 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); 28 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40);
29 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff); 29 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff);
30 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00); 30 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00);
31 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80); 31 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80);
32 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00); 32 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00);
33 static const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00); 33 static const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00);
34 for (int i = 0; i < 2; ++i) { 34 for (int i = 0; i < 2; ++i) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 texture->writePixels(S, (i ? 0 : S), S, S, 109 texture->writePixels(S, (i ? 0 : S), S, S,
110 texture->config(), gTextureData.get(), 110 texture->config(), gTextureData.get(),
111 4 * stride); 111 4 * stride);
112 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)) ; 112 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)) ;
113 } 113 }
114 } else { 114 } else {
115 skiagm::GM::DrawGpuOnlyMessage(canvas); 115 skiagm::GM::DrawGpuOnlyMessage(canvas);
116 } 116 }
117 } 117 }
118 #endif 118 #endif
OLDNEW
« gm/beziereffects.cpp ('K') | « gm/rrects.cpp ('k') | gm/texturedomaineffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698