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

Side by Side Diff: gm/texdata.cpp

Issue 1321353002: Limit lifetime of GrDrawContext objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 3 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
« no previous file with comments | « no previous file | src/core/SkImageFilter.cpp » ('j') | src/gpu/GrRenderTarget.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 21 matching lines...) Expand all
32 return SkString("texdata"); 32 return SkString("texdata");
33 } 33 }
34 34
35 SkISize onISize() override { 35 SkISize onISize() override {
36 return SkISize::Make(2*S, 2*S); 36 return SkISize::Make(2*S, 2*S);
37 } 37 }
38 38
39 void onDraw(SkCanvas* canvas) override { 39 void onDraw(SkCanvas* canvas) override {
40 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa rget(); 40 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa rget();
41 GrContext* ctx = canvas->getGrContext(); 41 GrContext* ctx = canvas->getGrContext();
42 GrDrawContext* drawContext = ctx ? ctx->drawContext() : nullptr; 42 SkAutoTUnref<GrDrawContext> drawContext(ctx ? ctx->drawContext() : nullp tr);
43 if (drawContext && target) { 43 if (drawContext && target) {
44 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); 44 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S));
45 static const int stride = 2 * S; 45 static const int stride = 2 * S;
46 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); 46 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40);
47 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff); 47 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff);
48 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00); 48 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00);
49 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80); 49 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80);
50 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00); 50 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00);
51 static const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00); 51 static const SkPMColor black = SkPackARGB32(0x00, 0x00, 0x00, 0x00);
52 for (int i = 0; i < 2; ++i) { 52 for (int i = 0; i < 2; ++i) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 }; 139 };
140 140
141 ////////////////////////////////////////////////////////////////////////////// 141 //////////////////////////////////////////////////////////////////////////////
142 142
143 static GM* MyFactory(void*) { return new TexDataGM; } 143 static GM* MyFactory(void*) { return new TexDataGM; }
144 static GMRegistry reg(MyFactory); 144 static GMRegistry reg(MyFactory);
145 145
146 } 146 }
147 147
148 #endif 148 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkImageFilter.cpp » ('j') | src/gpu/GrRenderTarget.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698