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

Side by Side Diff: gm/texturedomaineffect.cpp

Issue 608883003: GrResourceCache2 manages scratch texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@surfimpl
Patch Set: remove todo Created 6 years, 2 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 | « bench/GrResourceCacheBench.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 /* 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 GrTestTarget tt; 86 GrTestTarget tt;
87 context->getTestTarget(&tt); 87 context->getTestTarget(&tt);
88 if (NULL == tt.target()) { 88 if (NULL == tt.target()) {
89 SkDEBUGFAIL("Couldn't get Gr test target."); 89 SkDEBUGFAIL("Couldn't get Gr test target.");
90 return; 90 return;
91 } 91 }
92 92
93 GrDrawState* drawState = tt.target()->drawState(); 93 GrDrawState* drawState = tt.target()->drawState();
94 94
95 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fBmp, NULL ); 95 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp, NULL));
96 if (NULL == texture) { 96 if (!texture) {
97 return; 97 return;
98 } 98 }
99 99
100 SkTArray<SkMatrix> textureMatrices; 100 SkTArray<SkMatrix> textureMatrices;
101 textureMatrices.push_back().setIDiv(texture->width(), texture->height()) ; 101 textureMatrices.push_back().setIDiv(texture->width(), texture->height()) ;
102 textureMatrices.push_back() = textureMatrices[0]; 102 textureMatrices.push_back() = textureMatrices[0];
103 textureMatrices.back().postScale(1.5f, 0.85f); 103 textureMatrices.back().postScale(1.5f, 0.85f);
104 textureMatrices.push_back() = textureMatrices[0]; 104 textureMatrices.push_back() = textureMatrices[0];
105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture-> height() / 2.f); 105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture-> height() / 2.f);
106 106
(...skipping 30 matching lines...) Expand all
137 drawState->setRenderTarget(rt); 137 drawState->setRenderTarget(rt);
138 drawState->setColor(0xffffffff); 138 drawState->setColor(0xffffffff);
139 drawState->addColorProcessor(fp); 139 drawState->addColorProcessor(fp);
140 140
141 tt.target()->drawSimpleRect(renderRect); 141 tt.target()->drawSimpleRect(renderRect);
142 x += renderRect.width() + kTestPad; 142 x += renderRect.width() + kTestPad;
143 } 143 }
144 y += renderRect.height() + kTestPad; 144 y += renderRect.height() + kTestPad;
145 } 145 }
146 } 146 }
147 GrUnlockAndUnrefCachedBitmapTexture(texture);
148 } 147 }
149 148
150 private: 149 private:
151 static const SkScalar kDrawPad; 150 static const SkScalar kDrawPad;
152 static const SkScalar kTestPad; 151 static const SkScalar kTestPad;
153 static const int kTargetWidth = 100; 152 static const int kTargetWidth = 100;
154 static const int kTargetHeight = 100; 153 static const int kTargetHeight = 100;
155 SkBitmap fBmp; 154 SkBitmap fBmp;
156 155
157 typedef GM INHERITED; 156 typedef GM INHERITED;
158 }; 157 };
159 158
160 // Windows builds did not like SkScalar initialization in class :( 159 // Windows builds did not like SkScalar initialization in class :(
161 const SkScalar TextureDomainEffect::kDrawPad = 10.f; 160 const SkScalar TextureDomainEffect::kDrawPad = 10.f;
162 const SkScalar TextureDomainEffect::kTestPad = 10.f; 161 const SkScalar TextureDomainEffect::kTestPad = 10.f;
163 162
164 DEF_GM( return SkNEW(TextureDomainEffect); ) 163 DEF_GM( return SkNEW(TextureDomainEffect); )
165 } 164 }
166 165
167 #endif 166 #endif
OLDNEW
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | gm/yuvtorgbeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698