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

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

Issue 1307223004: Remove GrStagedProcessor, remove the word Stage as it applies to FPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix misresolve Created 5 years, 3 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/batches/GrDrawBatch.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 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 "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 462 }
463 463
464 GrRenderTarget* renderTarget = result->asRenderTarget(); 464 GrRenderTarget* renderTarget = result->asRenderTarget();
465 SkASSERT(renderTarget); 465 SkASSERT(renderTarget);
466 466
467 GrPaint paint; 467 GrPaint paint;
468 SkAutoTUnref<GrFragmentProcessor> 468 SkAutoTUnref<GrFragmentProcessor>
469 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManager (), yuvTextures[0], 469 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManager (), yuvTextures[0],
470 yuvTextures[1], yuvTextures[2 ], 470 yuvTextures[1], yuvTextures[2 ],
471 yuvInfo.fSize, yuvInfo.fColor Space)); 471 yuvInfo.fSize, yuvInfo.fColor Space));
472 paint.addColorProcessor(yuvToRgbProcessor); 472 paint.addColorFragmentProcessor(yuvToRgbProcessor);
473 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth), 473 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth),
474 SkIntToScalar(yuvInfo.fSize[0].fHeight)); 474 SkIntToScalar(yuvInfo.fSize[0].fHeight));
475 475
476 GrDrawContext* drawContext = ctx->drawContext(); 476 GrDrawContext* drawContext = ctx->drawContext();
477 if (!drawContext) { 477 if (!drawContext) {
478 return NULL; 478 return NULL;
479 } 479 }
480 480
481 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I() , r); 481 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I() , r);
482 482
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 // in a shader. 803 // in a shader.
804 if (constantColor) { 804 if (constantColor) {
805 SkColor filtered = colorFilter->filterColor(skPaint.getColor()); 805 SkColor filtered = colorFilter->filterColor(skPaint.getColor());
806 grPaint->setColor(SkColor2GrColor(filtered)); 806 grPaint->setColor(SkColor2GrColor(filtered));
807 } else { 807 } else {
808 SkTDArray<GrFragmentProcessor*> array; 808 SkTDArray<GrFragmentProcessor*> array;
809 // return false if failed? 809 // return false if failed?
810 if (colorFilter->asFragmentProcessors(context, grPaint->getProcessor DataManager(), 810 if (colorFilter->asFragmentProcessors(context, grPaint->getProcessor DataManager(),
811 &array)) { 811 &array)) {
812 for (int i = 0; i < array.count(); ++i) { 812 for (int i = 0; i < array.count(); ++i) {
813 grPaint->addColorProcessor(array[i]); 813 grPaint->addColorFragmentProcessor(array[i]);
814 array[i]->unref(); 814 array[i]->unref();
815 } 815 }
816 } 816 }
817 } 817 }
818 } 818 }
819 819
820 #ifndef SK_IGNORE_GPU_DITHER 820 #ifndef SK_IGNORE_GPU_DITHER
821 // If the dither flag is set, then we need to see if the underlying context 821 // If the dither flag is set, then we need to see if the underlying context
822 // supports it. If not, then install a dither effect. 822 // supports it. If not, then install a dither effect.
823 if (skPaint.isDither() && grPaint->numColorStages() > 0) { 823 if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0) {
824 // What are we rendering into? 824 // What are we rendering into?
825 SkASSERT(rt); 825 SkASSERT(rt);
826 826
827 // Suspect the dithering flag has no effect on these configs, otherwise 827 // Suspect the dithering flag has no effect on these configs, otherwise
828 // fall back on setting the appropriate state. 828 // fall back on setting the appropriate state.
829 if (GrPixelConfigIs8888(rt->config()) || 829 if (GrPixelConfigIs8888(rt->config()) ||
830 GrPixelConfigIs8888(rt->config())) { 830 GrPixelConfigIs8888(rt->config())) {
831 // The dither flag is set and the target is likely 831 // The dither flag is set and the target is likely
832 // not going to be dithered by the GPU. 832 // not going to be dithered by the GPU.
833 SkAutoTUnref<GrFragmentProcessor> fp(GrDitherEffect::Create()); 833 SkAutoTUnref<GrFragmentProcessor> fp(GrDitherEffect::Create());
834 if (fp.get()) { 834 if (fp.get()) {
835 grPaint->addColorProcessor(fp); 835 grPaint->addColorFragmentProcessor(fp);
836 grPaint->setDither(false); 836 grPaint->setDither(false);
837 } 837 }
838 } 838 }
839 } 839 }
840 #endif 840 #endif
841 return true; 841 return true;
842 } 842 }
843 843
844 bool SkPaint2GrPaint(GrContext* context, GrRenderTarget* rt, const SkPaint& skPa int, 844 bool SkPaint2GrPaint(GrContext* context, GrRenderTarget* rt, const SkPaint& skPa int,
845 const SkMatrix& viewM, bool constantColor, GrPaint* grPaint ) { 845 const SkMatrix& viewM, bool constantColor, GrPaint* grPaint ) {
(...skipping 10 matching lines...) Expand all
856 // want them messing around with the context. 856 // want them messing around with the context.
857 { 857 {
858 // Allow the shader to modify paintColor and also create an effect to be installed as 858 // Allow the shader to modify paintColor and also create an effect to be installed as
859 // the first color effect on the GrPaint. 859 // the first color effect on the GrPaint.
860 GrFragmentProcessor* fp = NULL; 860 GrFragmentProcessor* fp = NULL;
861 if (!shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCo lor, 861 if (!shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCo lor,
862 grPaint->getProcessorDataManager(), &fp )) { 862 grPaint->getProcessorDataManager(), &fp )) {
863 return false; 863 return false;
864 } 864 }
865 if (fp) { 865 if (fp) {
866 grPaint->addColorProcessor(fp)->unref(); 866 grPaint->addColorFragmentProcessor(fp)->unref();
867 constantColor = false; 867 constantColor = false;
868 } 868 }
869 } 869 }
870 870
871 // The grcolor is automatically set when calling asFragmentProcessor. 871 // The grcolor is automatically set when calling asFragmentProcessor.
872 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint. 872 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint.
873 return SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantCol or, grPaint); 873 return SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantCol or, grPaint);
874 } 874 }
875 875
876 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) { 876 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 SkErrorInternals::SetError( kInvalidPaint_SkError, 929 SkErrorInternals::SetError( kInvalidPaint_SkError,
930 "Sorry, I don't understand the filtering " 930 "Sorry, I don't understand the filtering "
931 "mode you asked for. Falling back to " 931 "mode you asked for. Falling back to "
932 "MIPMaps."); 932 "MIPMaps.");
933 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 933 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
934 break; 934 break;
935 935
936 } 936 }
937 return textureFilterMode; 937 return textureFilterMode;
938 } 938 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/batches/GrDrawBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698