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

Side by Side Diff: tests/RectangleTextureTest.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
« gm/beziereffects.cpp ('K') | « tests/PrimitiveProcessorTest.cpp ('k') | no next file » | 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 #include "Test.h" 8 #include "Test.h"
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 SkAutoTUnref<GrTexture> src(context->textureProvider()->createTexture( 82 SkAutoTUnref<GrTexture> src(context->textureProvider()->createTexture(
83 copySrcDesc, SkBudgeted::kYes, pixels.get(), 0)); 83 copySrcDesc, SkBudgeted::kYes, pixels.get(), 0));
84 84
85 context->copySurface(rectangleTexture, src); 85 context->copySurface(rectangleTexture, src);
86 test_read_pixels(reporter, context, rectangleTexture, pixels.get()); 86 test_read_pixels(reporter, context, rectangleTexture, pixels.get());
87 } 87 }
88 88
89 static void test_clear(skiatest::Reporter* reporter, GrContext* context, 89 static void test_clear(skiatest::Reporter* reporter, GrContext* context,
90 GrTexture* rectangleTexture) { 90 GrTexture* rectangleTexture) {
91 if (rectangleTexture->asRenderTarget()) { 91 if (rectangleTexture->asRenderTarget()) {
92 SkAutoTUnref<GrDrawContext> dc(context->drawContext(rectangleTexture->as RenderTarget())); 92 sk_sp<GrDrawContext> dc(
93 context->drawContext(sk_ref_sp(rectangleTexture->asR enderTarget())));
93 if (!dc) { 94 if (!dc) {
94 ERRORF(reporter, "Could not get GrDrawContext for rectangle texture. "); 95 ERRORF(reporter, "Could not get GrDrawContext for rectangle texture. ");
95 return; 96 return;
96 } 97 }
97 98
98 // Clear the whole thing. 99 // Clear the whole thing.
99 GrColor color0 = GrColorPackRGBA(0xA, 0xB, 0xC, 0xD); 100 GrColor color0 = GrColorPackRGBA(0xA, 0xB, 0xC, 0xD);
100 dc->clear(nullptr, color0, false); 101 dc->clear(nullptr, color0, false);
101 102
102 int w = rectangleTexture->width(); 103 int w = rectangleTexture->width();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 201
201 test_write_pixels(reporter, context, rectangleTexture); 202 test_write_pixels(reporter, context, rectangleTexture);
202 203
203 test_clear(reporter, context, rectangleTexture); 204 test_clear(reporter, context, rectangleTexture);
204 205
205 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID)); 206 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID));
206 } 207 }
207 } 208 }
208 209
209 #endif 210 #endif
OLDNEW
« gm/beziereffects.cpp ('K') | « tests/PrimitiveProcessorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698