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

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
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | src/gpu/SkGrPriv.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 8
9 #include "SkGr.h" 9 #include "SkGr.h"
10 10
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 bool SkPaintToGrPaintWithXfermode(GrContext* context, 538 bool SkPaintToGrPaintWithXfermode(GrContext* context,
539 const SkPaint& skPaint, 539 const SkPaint& skPaint,
540 const SkMatrix& viewM, 540 const SkMatrix& viewM,
541 SkXfermode::Mode primColorMode, 541 SkXfermode::Mode primColorMode,
542 bool primitiveIsSrc, 542 bool primitiveIsSrc,
543 GrPaint* grPaint) { 543 GrPaint* grPaint) {
544 return skpaint_to_grpaint_impl(context, skPaint, viewM, nullptr, &primColorM ode, primitiveIsSrc, 544 return skpaint_to_grpaint_impl(context, skPaint, viewM, nullptr, &primColorM ode, primitiveIsSrc,
545 grPaint); 545 grPaint);
546 } 546 }
547 547
548 bool SkPaintToGrPaintWithTexture(GrContext* context,
549 const SkPaint& paint,
550 const SkMatrix& viewM,
551 const GrFragmentProcessor* fp,
552 bool textureIsAlphaOnly,
553 GrPaint* grPaint) {
554 SkAutoTUnref<const GrFragmentProcessor> shaderFP;
555 if (textureIsAlphaOnly) {
556 if (const SkShader* shader = paint.getShader()) {
557 shaderFP.reset(shader->asFragmentProcessor(context,
558 viewM,
559 nullptr,
560 paint.getFilterQuality()) );
561 if (!shaderFP) {
562 return false;
563 }
564 const GrFragmentProcessor* fpSeries[] = { shaderFP.get(), fp };
565 shaderFP.reset(GrFragmentProcessor::RunInSeries(fpSeries, 2));
566 } else {
567 shaderFP.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp ));
568 }
569 } else {
570 shaderFP.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp));
571 }
572
573 return SkPaintToGrPaintReplaceShader(context, paint, shaderFP.get(), grPaint );
574 }
575
548 576
549 //////////////////////////////////////////////////////////////////////////////// //////////////// 577 //////////////////////////////////////////////////////////////////////////////// ////////////////
550 578
551 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) { 579 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) {
552 #ifdef SK_DEBUG 580 #ifdef SK_DEBUG
553 const GrSurfaceDesc& desc = tex->desc(); 581 const GrSurfaceDesc& desc = tex->desc();
554 SkASSERT(w <= desc.fWidth); 582 SkASSERT(w <= desc.fWidth);
555 SkASSERT(h <= desc.fHeight); 583 SkASSERT(h <= desc.fHeight);
556 #endif 584 #endif
557 const GrPixelConfig config = tex->config(); 585 const GrPixelConfig config = tex->config();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 SkErrorInternals::SetError( kInvalidPaint_SkError, 632 SkErrorInternals::SetError( kInvalidPaint_SkError,
605 "Sorry, I don't understand the filtering " 633 "Sorry, I don't understand the filtering "
606 "mode you asked for. Falling back to " 634 "mode you asked for. Falling back to "
607 "MIPMaps."); 635 "MIPMaps.");
608 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 636 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
609 break; 637 break;
610 638
611 } 639 }
612 return textureFilterMode; 640 return textureFilterMode;
613 } 641 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | src/gpu/SkGrPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698