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

Side by Side Diff: gm/yuvtorgbeffect.cpp

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month 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') | include/gpu/GrContext.h » ('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
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return; 74 return;
75 } 75 }
76 76
77 GrTestTarget tt; 77 GrTestTarget tt;
78 context->getTestTarget(&tt); 78 context->getTestTarget(&tt);
79 if (NULL == tt.target()) { 79 if (NULL == tt.target()) {
80 SkDEBUGFAIL("Couldn't get Gr test target."); 80 SkDEBUGFAIL("Couldn't get Gr test target.");
81 return; 81 return;
82 } 82 }
83 83
84 GrDrawState* drawState = tt.target()->drawState();
85
86 SkAutoTUnref<GrTexture> texture[3]; 84 SkAutoTUnref<GrTexture> texture[3];
87 texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], NULL)); 85 texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], NULL));
88 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], NULL)); 86 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], NULL));
89 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], NULL)); 87 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], NULL));
90 88
91 if (!texture[0] || !texture[1] || !texture[2]) { 89 if (!texture[0] || !texture[1] || !texture[2]) {
92 return; 90 return;
93 } 91 }
94 92
95 static const SkScalar kDrawPad = 10.f; 93 static const SkScalar kDrawPad = 10.f;
(...skipping 14 matching lines...) Expand all
110 108
111 for (int i = 0; i < 6; ++i) { 109 for (int i = 0; i < 6; ++i) {
112 SkAutoTUnref<GrFragmentProcessor> fp( 110 SkAutoTUnref<GrFragmentProcessor> fp(
113 GrYUVtoRGBEffect::Create(texture[indices[i][0]], 111 GrYUVtoRGBEffect::Create(texture[indices[i][0]],
114 texture[indices[i][1]], 112 texture[indices[i][1]],
115 texture[indices[i][2]], 113 texture[indices[i][2]],
116 static_cast<SkYUVColorSpace> (space))); 114 static_cast<SkYUVColorSpace> (space)));
117 if (fp) { 115 if (fp) {
118 SkMatrix viewMatrix; 116 SkMatrix viewMatrix;
119 viewMatrix.setTranslate(x, y); 117 viewMatrix.setTranslate(x, y);
120 drawState->reset(viewMatrix); 118 GrDrawState drawState(viewMatrix);
121 drawState->setRenderTarget(rt); 119 drawState.setRenderTarget(rt);
122 drawState->setColor(0xffffffff); 120 drawState.setColor(0xffffffff);
123 drawState->addColorProcessor(fp); 121 drawState.addColorProcessor(fp);
124 tt.target()->drawSimpleRect(renderRect); 122 tt.target()->drawSimpleRect(&drawState, renderRect);
125 } 123 }
126 x += renderRect.width() + kTestPad; 124 x += renderRect.width() + kTestPad;
127 } 125 }
128 } 126 }
129 } 127 }
130 128
131 private: 129 private:
132 SkBitmap fBmp[3]; 130 SkBitmap fBmp[3];
133 131
134 typedef GM INHERITED; 132 typedef GM INHERITED;
135 }; 133 };
136 134
137 DEF_GM( return SkNEW(YUVtoRGBEffect); ) 135 DEF_GM( return SkNEW(YUVtoRGBEffect); )
138 } 136 }
139 137
140 #endif 138 #endif
OLDNEW
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | include/gpu/GrContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698