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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 864383003: Remove createUncachedTexture function, attempt to recycle scratch in createTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@continue
Patch Set: Comments, fixes Created 5 years, 10 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 | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/SkGrPixelRef.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 2010 Google Inc. 2 * Copyright 2010 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 #include "SkGr.h" 8 #include "SkGr.h"
9 9
10 #include "GrXferProcessor.h" 10 #include "GrXferProcessor.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 SkASSERT(pixelRef); 172 SkASSERT(pixelRef);
173 pixelRef->addGenIDChangeListener(SkNEW_ARGS(GrResourceInvalidator, (key))); 173 pixelRef->addGenIDChangeListener(SkNEW_ARGS(GrResourceInvalidator, (key)));
174 } 174 }
175 #endif 175 #endif
176 176
177 static GrTexture* create_texture_for_bmp(GrContext* ctx, 177 static GrTexture* create_texture_for_bmp(GrContext* ctx,
178 const GrContentKey& optionalKey, 178 const GrContentKey& optionalKey,
179 GrSurfaceDesc desc, 179 GrSurfaceDesc desc,
180 const void* pixels, 180 const void* pixels,
181 size_t rowBytes) { 181 size_t rowBytes) {
182 GrTexture* result; 182 GrTexture* result = ctx->createTexture(desc, true, pixels, rowBytes);
183 if (optionalKey.isValid() || GrPixelConfigIsCompressed(desc.fConfig)) { 183 if (result && optionalKey.isValid()) {
184 result = ctx->createTexture(desc, pixels, rowBytes); 184 SkAssertResult(ctx->addResourceToCache(optionalKey, result));
185 if (result) {
186 SkAssertResult(ctx->addResourceToCache(optionalKey, result));
187 }
188 } else {
189 result = ctx->refScratchTexture(desc, GrContext::kExact_ScratchTexMatch) ;
190 if (pixels && result) {
191 result->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, p ixels, rowBytes);
192 }
193 } 185 }
194 return result; 186 return result;
195 } 187 }
196 188
197 // creates a new texture that is the input texture scaled up to the next power o f two in 189 // creates a new texture that is the input texture scaled up to the next power o f two in
198 // width or height. If optionalKey is valid it will be set on the new texture. s tretch 190 // width or height. If optionalKey is valid it will be set on the new texture. s tretch
199 // controls whether the scaling is done using nearest or bilerp filtering. 191 // controls whether the scaling is done using nearest or bilerp filtering.
200 GrTexture* resize_texture(GrTexture* inputTexture, Stretch stretch, 192 GrTexture* resize_texture(GrTexture* inputTexture, Stretch stretch,
201 const GrContentKey& optionalKey) { 193 const GrContentKey& optionalKey) {
202 SkASSERT(kNo_Stretch != stretch); 194 SkASSERT(kNo_Stretch != stretch);
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol or, &fp) && fp) { 720 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol or, &fp) && fp) {
729 grPaint->addColorProcessor(fp)->unref(); 721 grPaint->addColorProcessor(fp)->unref();
730 constantColor = false; 722 constantColor = false;
731 } 723 }
732 } 724 }
733 725
734 // The grcolor is automatically set when calling asFragmentProcessor. 726 // The grcolor is automatically set when calling asFragmentProcessor.
735 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint. 727 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint.
736 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint ); 728 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint );
737 } 729 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698