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

Side by Side Diff: gm/yuvtorgbeffect.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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') | include/core/SkColorFilter.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 renderRect.outset(kDrawPad, kDrawPad); 107 renderRect.outset(kDrawPad, kDrawPad);
108 108
109 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; 109 SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset;
110 SkScalar x = kDrawPad + kTestPad; 110 SkScalar x = kDrawPad + kTestPad;
111 111
112 const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, 112 const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
113 {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}; 113 {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
114 114
115 for (int i = 0; i < 6; ++i) { 115 for (int i = 0; i < 6; ++i) {
116 GrPipelineBuilder pipelineBuilder; 116 GrPipelineBuilder pipelineBuilder;
117 pipelineBuilder.setXPFactory( 117 pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXferm ode::kSrc_Mode));
118 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref (); 118 sk_sp<GrFragmentProcessor> fp(
119 SkAutoTUnref<const GrFragmentProcessor> fp( 119 GrYUVEffect::MakeYUVToRGB(texture[indices[i][0]],
120 GrYUVEffect::CreateYUVToRGB(texture[indices[i][0]], 120 texture[indices[i][1]],
121 texture[indices[i][1]], 121 texture[indices[i][2]],
122 texture[indices[i][2]], 122 sizes,
123 sizes, 123 static_cast<SkYUVColorSpac e>(space)));
124 static_cast<SkYUVColorSp ace>(space)));
125 if (fp) { 124 if (fp) {
126 SkMatrix viewMatrix; 125 SkMatrix viewMatrix;
127 viewMatrix.setTranslate(x, y); 126 viewMatrix.setTranslate(x, y);
128 pipelineBuilder.addColorFragmentProcessor(fp); 127 pipelineBuilder.addColorFragmentProcessor(std::move(fp));
129 SkAutoTUnref<GrDrawBatch> batch( 128 SkAutoTUnref<GrDrawBatch> batch(
130 GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, v iewMatrix, 129 GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, v iewMatrix,
131 renderRect, null ptr, nullptr)); 130 renderRect, null ptr, nullptr));
132 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin eBuilder, batch); 131 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin eBuilder, batch);
133 } 132 }
134 x += renderRect.width() + kTestPad; 133 x += renderRect.width() + kTestPad;
135 } 134 }
136 } 135 }
137 } 136 }
138 137
139 private: 138 private:
140 SkBitmap fBmp[3]; 139 SkBitmap fBmp[3];
141 140
142 typedef GM INHERITED; 141 typedef GM INHERITED;
143 }; 142 };
144 143
145 DEF_GM(return new YUVtoRGBEffect;) 144 DEF_GM(return new YUVtoRGBEffect;)
146 } 145 }
147 146
148 #endif 147 #endif
OLDNEW
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | include/core/SkColorFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698