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

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

Issue 938383004: Dynamically create stencil buffer when needed. (Closed) Base URL: https://skia.googlesource.com/skia.git@bigstencil
Patch Set: Actually save file before uploading 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/GrTexture.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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch, 191 GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch,
192 SkPixelRef* pixelRef, 192 SkPixelRef* pixelRef,
193 const GrUniqueKey& optionalKey) { 193 const GrUniqueKey& optionalKey) {
194 SkASSERT(kNo_Stretch != stretch); 194 SkASSERT(kNo_Stretch != stretch);
195 195
196 GrContext* context = inputTexture->getContext(); 196 GrContext* context = inputTexture->getContext();
197 SkASSERT(context); 197 SkASSERT(context);
198 198
199 // Either it's a cache miss or the original wasn't cached to begin with. 199 // Either it's a cache miss or the original wasn't cached to begin with.
200 GrSurfaceDesc rtDesc = inputTexture->desc(); 200 GrSurfaceDesc rtDesc = inputTexture->desc();
201 rtDesc.fFlags = rtDesc.fFlags | 201 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag;
202 kRenderTarget_GrSurfaceFlag |
203 kNoStencil_GrSurfaceFlag;
204 rtDesc.fWidth = GrNextPow2(rtDesc.fWidth); 202 rtDesc.fWidth = GrNextPow2(rtDesc.fWidth);
205 rtDesc.fHeight = GrNextPow2(rtDesc.fHeight); 203 rtDesc.fHeight = GrNextPow2(rtDesc.fHeight);
206 rtDesc.fConfig = GrMakePixelConfigUncompressed(rtDesc.fConfig); 204 rtDesc.fConfig = GrMakePixelConfigUncompressed(rtDesc.fConfig);
207 205
208 // If the config isn't renderable try converting to either A8 or an 32 bit c onfig. Otherwise, 206 // If the config isn't renderable try converting to either A8 or an 32 bit c onfig. Otherwise,
209 // fail. 207 // fail.
210 if (!context->isConfigRenderable(rtDesc.fConfig, false)) { 208 if (!context->isConfigRenderable(rtDesc.fConfig, false)) {
211 if (GrPixelConfigIsAlphaOnly(rtDesc.fConfig)) { 209 if (GrPixelConfigIsAlphaOnly(rtDesc.fConfig)) {
212 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { 210 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
213 rtDesc.fConfig = kAlpha_8_GrPixelConfig; 211 rtDesc.fConfig = kAlpha_8_GrPixelConfig;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 yuvTextures[i].reset( 368 yuvTextures[i].reset(
371 ctx->refScratchTexture(yuvDesc, GrContext::kApprox_ScratchTexMatch)) ; 369 ctx->refScratchTexture(yuvDesc, GrContext::kApprox_ScratchTexMatch)) ;
372 if (!yuvTextures[i] || 370 if (!yuvTextures[i] ||
373 !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, 371 !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight,
374 yuvDesc.fConfig, planes[i], yuvInfo.fRo wBytes[i])) { 372 yuvDesc.fConfig, planes[i], yuvInfo.fRo wBytes[i])) {
375 return NULL; 373 return NULL;
376 } 374 }
377 } 375 }
378 376
379 GrSurfaceDesc rtDesc = desc; 377 GrSurfaceDesc rtDesc = desc;
380 rtDesc.fFlags = rtDesc.fFlags | 378 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag;
381 kRenderTarget_GrSurfaceFlag |
382 kNoStencil_GrSurfaceFlag;
383 379
384 GrTexture* result = create_texture_for_bmp(ctx, optionalKey, rtDesc, pixelRe f, NULL, 0); 380 GrTexture* result = create_texture_for_bmp(ctx, optionalKey, rtDesc, pixelRe f, NULL, 0);
385 if (!result) { 381 if (!result) {
386 return NULL; 382 return NULL;
387 } 383 }
388 384
389 GrRenderTarget* renderTarget = result->asRenderTarget(); 385 GrRenderTarget* renderTarget = result->asRenderTarget();
390 SkASSERT(renderTarget); 386 SkASSERT(renderTarget);
391 387
392 SkAutoTUnref<GrFragmentProcessor> 388 SkAutoTUnref<GrFragmentProcessor>
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol or, &fp) && fp) { 714 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol or, &fp) && fp) {
719 grPaint->addColorProcessor(fp)->unref(); 715 grPaint->addColorProcessor(fp)->unref();
720 constantColor = false; 716 constantColor = false;
721 } 717 }
722 } 718 }
723 719
724 // The grcolor is automatically set when calling asFragmentProcessor. 720 // The grcolor is automatically set when calling asFragmentProcessor.
725 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint. 721 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint.
726 SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantColor, grP aint); 722 SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantColor, grP aint);
727 } 723 }
OLDNEW
« no previous file with comments | « src/gpu/GrTexture.cpp ('k') | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698