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

Side by Side Diff: gm/yuvtorgbeffect.cpp

Issue 1584703003: Remove two varieties of drawNonAARect from GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@hidedrawtargetabit
Patch Set: deprecation message on GrTest Created 4 years, 11 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/texturedomaineffect.cpp ('k') | src/gpu/GrDrawContext.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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
11 #include "gm.h" 11 #include "gm.h"
12 12
13 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 14
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrTest.h" 16 #include "GrDrawContext.h"
17 #include "effects/GrYUVtoRGBEffect.h" 17 #include "GrPipelineBuilder.h"
18 #include "SkBitmap.h" 18 #include "SkBitmap.h"
19 #include "SkGr.h" 19 #include "SkGr.h"
20 #include "SkGradientShader.h" 20 #include "SkGradientShader.h"
21 #include "batches/GrDrawBatch.h"
22 #include "batches/GrRectBatchFactory.h"
23 #include "effects/GrYUVtoRGBEffect.h"
21 24
22 #define YSIZE 8 25 #define YSIZE 8
23 #define USIZE 4 26 #define USIZE 4
24 #define VSIZE 4 27 #define VSIZE 4
25 28
26 namespace skiagm { 29 namespace skiagm {
27 /** 30 /**
28 * This GM directly exercises GrYUVtoRGBEffect. 31 * This GM directly exercises GrYUVtoRGBEffect.
29 */ 32 */
30 class YUVtoRGBEffect : public GM { 33 class YUVtoRGBEffect : public GM {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); 73 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget ();
71 if (nullptr == rt) { 74 if (nullptr == rt) {
72 return; 75 return;
73 } 76 }
74 GrContext* context = rt->getContext(); 77 GrContext* context = rt->getContext();
75 if (nullptr == context) { 78 if (nullptr == context) {
76 skiagm::GM::DrawGpuOnlyMessage(canvas); 79 skiagm::GM::DrawGpuOnlyMessage(canvas);
77 return; 80 return;
78 } 81 }
79 82
80 GrTestTarget tt; 83 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
81 context->getTestTarget(&tt, rt); 84 if (!drawContext) {
82 if (nullptr == tt.target()) {
83 SkDEBUGFAIL("Couldn't get Gr test target.");
84 return; 85 return;
85 } 86 }
86 87
87 SkAutoTUnref<GrTexture> texture[3]; 88 SkAutoTUnref<GrTexture> texture[3];
88 texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], 89 texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0],
89 GrTextureParams::ClampBilerp() )); 90 GrTextureParams::ClampBilerp() ));
90 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], 91 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1],
91 GrTextureParams::ClampBilerp() )); 92 GrTextureParams::ClampBilerp() ));
92 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], 93 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2],
93 GrTextureParams::ClampBilerp() )); 94 GrTextureParams::ClampBilerp() ));
(...skipping 27 matching lines...) Expand all
121 GrYUVtoRGBEffect::Create(texture[indices[i][0]], 122 GrYUVtoRGBEffect::Create(texture[indices[i][0]],
122 texture[indices[i][1]], 123 texture[indices[i][1]],
123 texture[indices[i][2]], 124 texture[indices[i][2]],
124 sizes, 125 sizes,
125 static_cast<SkYUVColorSpace >(space))); 126 static_cast<SkYUVColorSpace >(space)));
126 if (fp) { 127 if (fp) {
127 SkMatrix viewMatrix; 128 SkMatrix viewMatrix;
128 viewMatrix.setTranslate(x, y); 129 viewMatrix.setTranslate(x, y);
129 pipelineBuilder.setRenderTarget(rt); 130 pipelineBuilder.setRenderTarget(rt);
130 pipelineBuilder.addColorFragmentProcessor(fp); 131 pipelineBuilder.addColorFragmentProcessor(fp);
131 tt.target()->drawNonAARect(pipelineBuilder, 132 SkAutoTUnref<GrDrawBatch> batch(
132 GrColor_WHITE, 133 GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, v iewMatrix,
133 viewMatrix, 134 renderRect, null ptr, nullptr));
134 renderRect); 135 drawContext->internal_drawBatch(pipelineBuilder, batch);
135 } 136 }
136 x += renderRect.width() + kTestPad; 137 x += renderRect.width() + kTestPad;
137 } 138 }
138 } 139 }
139 } 140 }
140 141
141 private: 142 private:
142 SkBitmap fBmp[3]; 143 SkBitmap fBmp[3];
143 144
144 typedef GM INHERITED; 145 typedef GM INHERITED;
145 }; 146 };
146 147
147 DEF_GM(return new YUVtoRGBEffect;) 148 DEF_GM(return new YUVtoRGBEffect;)
148 } 149 }
149 150
150 #endif 151 #endif
OLDNEW
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698