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

Side by Side Diff: gm/texturedomaineffect.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/rrects.cpp ('k') | gm/yuvtorgbeffect.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 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; 109 SkScalar y = kDrawPad + kTestPad;
110 for (int tm = 0; tm < textureMatrices.count(); ++tm) { 110 for (int tm = 0; tm < textureMatrices.count(); ++tm) {
111 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) { 111 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) {
112 SkScalar x = kDrawPad + kTestPad; 112 SkScalar x = kDrawPad + kTestPad;
113 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) { 113 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) {
114 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; 114 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m;
115 GrPipelineBuilder pipelineBuilder; 115 GrPipelineBuilder pipelineBuilder;
116 pipelineBuilder.setXPFactory( 116 pipelineBuilder.setXPFactory(
117 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->u nref(); 117 GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
118 SkAutoTUnref<const GrFragmentProcessor> fp( 118 sk_sp<GrFragmentProcessor> fp(
119 GrTextureDomainEffect::Create(texture, textureMatrices[t m], 119 GrTextureDomainEffect::Make(texture, textureMatrices[tm] ,
120 GrTextureDomain::MakeTexelDomain (texture, 120 GrTextureDomain::MakeTexelDomain (texture,
121 texelDomains[d]), 121 texelDomains[d]),
122 mode, GrTextureParams::kNone_Fil terMode)); 122 mode, GrTextureParams::kNone_Fil terMode));
123 123
124 if (!fp) { 124 if (!fp) {
125 continue; 125 continue;
126 } 126 }
127 const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); 127 const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y);
128 pipelineBuilder.addColorFragmentProcessor(fp); 128 pipelineBuilder.addColorFragmentProcessor(std::move(fp));
129 129
130 SkAutoTUnref<GrDrawBatch> batch( 130 SkAutoTUnref<GrDrawBatch> batch(
131 GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, v iewMatrix, 131 GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, v iewMatrix,
132 renderRect, null ptr, nullptr)); 132 renderRect, null ptr, nullptr));
133 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin eBuilder, batch); 133 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin eBuilder, batch);
134 x += renderRect.width() + kTestPad; 134 x += renderRect.width() + kTestPad;
135 } 135 }
136 y += renderRect.height() + kTestPad; 136 y += renderRect.height() + kTestPad;
137 } 137 }
138 } 138 }
(...skipping 10 matching lines...) Expand all
149 }; 149 };
150 150
151 // Windows builds did not like SkScalar initialization in class :( 151 // Windows builds did not like SkScalar initialization in class :(
152 const SkScalar TextureDomainEffect::kDrawPad = 10.f; 152 const SkScalar TextureDomainEffect::kDrawPad = 10.f;
153 const SkScalar TextureDomainEffect::kTestPad = 10.f; 153 const SkScalar TextureDomainEffect::kTestPad = 10.f;
154 154
155 DEF_GM(return new TextureDomainEffect;) 155 DEF_GM(return new TextureDomainEffect;)
156 } 156 }
157 157
158 #endif 158 #endif
OLDNEW
« no previous file with comments | « gm/rrects.cpp ('k') | gm/yuvtorgbeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698