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

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

Issue 1454933002: Initial implementation of GPU no filter NinePatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 1 month 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
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 8
9 #include "SkGr.h" 9 #include "SkGr.h"
10 10
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 const SkPaint& skPaint, 590 const SkPaint& skPaint,
591 const SkMatrix& viewM, 591 const SkMatrix& viewM,
592 SkXfermode::Mode primColorMode, 592 SkXfermode::Mode primColorMode,
593 bool primitiveIsSrc, 593 bool primitiveIsSrc,
594 GrPaint* grPaint) { 594 GrPaint* grPaint) {
595 return skpaint_to_grpaint_impl(context, skPaint, viewM, nullptr, &primColorM ode, primitiveIsSrc, 595 return skpaint_to_grpaint_impl(context, skPaint, viewM, nullptr, &primColorM ode, primitiveIsSrc,
596 grPaint); 596 grPaint);
597 } 597 }
598 598
599 599
600 bool SkPaintToGrPaintWithTexture(GrContext* context,
601 const SkPaint& paint,
602 const SkMatrix& viewM,
603 const GrFragmentProcessor* fp,
604 bool textureIsAlphaOnly,
605 GrPaint* grPaint) {
606 SkAutoTUnref<const GrFragmentProcessor> shaderFP;
607 if (textureIsAlphaOnly) {
608 if (const SkShader* shader = paint.getShader()) {
609 shaderFP.reset(shader->asFragmentProcessor(context,
610 viewM,
611 nullptr,
612 paint.getFilterQuality()) );
613 if (!shaderFP) {
614 return false;
615 }
616 const GrFragmentProcessor* fpSeries[] = { shaderFP.get(), fp };
617 shaderFP.reset(GrFragmentProcessor::RunInSeries(fpSeries, 2));
618 } else {
619 shaderFP.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp ));
620 }
621 } else {
622 shaderFP.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp));
623 }
624
625 return SkPaintToGrPaintReplaceShader(context, paint, shaderFP.get(), grPaint );
626 }
627
628
600 //////////////////////////////////////////////////////////////////////////////// //////////////// 629 //////////////////////////////////////////////////////////////////////////////// ////////////////
601 630
602 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) { 631 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) {
603 #ifdef SK_DEBUG 632 #ifdef SK_DEBUG
604 const GrSurfaceDesc& desc = tex->desc(); 633 const GrSurfaceDesc& desc = tex->desc();
605 SkASSERT(w <= desc.fWidth); 634 SkASSERT(w <= desc.fWidth);
606 SkASSERT(h <= desc.fHeight); 635 SkASSERT(h <= desc.fHeight);
607 #endif 636 #endif
608 const GrPixelConfig config = tex->config(); 637 const GrPixelConfig config = tex->config();
609 SkColorType ct; 638 SkColorType ct;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 SkErrorInternals::SetError( kInvalidPaint_SkError, 684 SkErrorInternals::SetError( kInvalidPaint_SkError,
656 "Sorry, I don't understand the filtering " 685 "Sorry, I don't understand the filtering "
657 "mode you asked for. Falling back to " 686 "mode you asked for. Falling back to "
658 "MIPMaps."); 687 "MIPMaps.");
659 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 688 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
660 break; 689 break;
661 690
662 } 691 }
663 return textureFilterMode; 692 return textureFilterMode;
664 } 693 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698