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

Side by Side Diff: gm/imagefromyuvtextures.cpp

Issue 1930623003: Clean up test drawContext usage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix typo 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
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | gm/rectangletexture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 for (int i = 0; i < 3; ++i) { 118 for (int i = 0; i < 3; ++i) {
119 gpu->deleteTestingOnlyBackendTexture(yuvHandles[i]); 119 gpu->deleteTestingOnlyBackendTexture(yuvHandles[i]);
120 } 120 }
121 121
122 context->resetContext(); 122 context->resetContext();
123 } 123 }
124 124
125 void onDraw(SkCanvas* canvas) override { 125 void onDraw(SkCanvas* canvas) override {
126 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); 126 GrContext* context = canvas->getGrContext();
127 GrContext* context; 127 if (!context) {
128 if (!rt || !(context = rt->getContext())) {
129 skiagm::GM::DrawGpuOnlyMessage(canvas); 128 skiagm::GM::DrawGpuOnlyMessage(canvas);
130 return; 129 return;
131 } 130 }
132 131
133 GrBackendObject yuvHandles[3]; 132 GrBackendObject yuvHandles[3];
134 this->createYUVTextures(context, yuvHandles); 133 this->createYUVTextures(context, yuvHandles);
135 134
136 static const SkScalar kPad = 10.f; 135 static const SkScalar kPad = 10.f;
137 136
138 SkISize sizes[] = { 137 SkISize sizes[] = {
(...skipping 24 matching lines...) Expand all
163 162
164 static const int kBmpSize = 32; 163 static const int kBmpSize = 32;
165 164
166 typedef GM INHERITED; 165 typedef GM INHERITED;
167 }; 166 };
168 167
169 DEF_GM(return new ImageFromYUVTextures;) 168 DEF_GM(return new ImageFromYUVTextures;)
170 } 169 }
171 170
172 #endif 171 #endif
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | gm/rectangletexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698