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

Side by Side Diff: include/gpu/effects/GrPorterDuffXferProcessor.h

Issue 1540363002: Don't ref/unref the static src-over xp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tiny Created 5 years 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 | « no previous file | src/gpu/GrPipeline.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 2014 Google Inc. 2 * Copyright 2014 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 #ifndef GrPorterDuffXferProcessor_DEFINED 8 #ifndef GrPorterDuffXferProcessor_DEFINED
9 #define GrPorterDuffXferProcessor_DEFINED 9 #define GrPorterDuffXferProcessor_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "GrXferProcessor.h" 12 #include "GrXferProcessor.h"
13 #include "SkXfermode.h" 13 #include "SkXfermode.h"
14 14
15 class GrProcOptInfo; 15 class GrProcOptInfo;
16 16
17 class GrPorterDuffXPFactory : public GrXPFactory { 17 class GrPorterDuffXPFactory : public GrXPFactory {
18 public: 18 public:
19 static GrXPFactory* Create(SkXfermode::Mode mode); 19 static GrXPFactory* Create(SkXfermode::Mode mode);
20 20
21 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, 21 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
22 GrXPFactory::InvariantBlendedColor*) const ove rride; 22 GrXPFactory::InvariantBlendedColor*) const ove rride;
23 23
24
25 /** Because src-over is so common we special case it for performance reasons . If this returns
26 null then the SimpleSrcOverXP() below should be used. */
24 static GrXferProcessor* CreateSrcOverXferProcessor(const GrCaps& caps, 27 static GrXferProcessor* CreateSrcOverXferProcessor(const GrCaps& caps,
25 const GrPipelineOptimizat ions& optimizations, 28 const GrPipelineOptimizat ions& optimizations,
26 bool hasMixedSamples, 29 bool hasMixedSamples,
27 const GrXferProcessor::Ds tTexture*); 30 const GrXferProcessor::Ds tTexture*);
31 /** This XP implements non-LCD src-over using hw blend with no optimizations . It is returned
32 by reference because it is global and its ref-cnting methods are not thr ead safe. */
33 static const GrXferProcessor& SimpleSrcOverXP();
28 34
29 static inline void SrcOverInvariantBlendedColor( 35 static inline void SrcOverInvariantBlendedColor(
30 GrColor inputColor, 36 GrColor inputColor,
31 GrColorComponentFlags validColor Flags, 37 GrColorComponentFlags validColor Flags,
32 bool isOpaque, 38 bool isOpaque,
33 GrXPFactory::InvariantBlendedCol or* blendedColor) { 39 GrXPFactory::InvariantBlendedCol or* blendedColor) {
34 if (!isOpaque) { 40 if (!isOpaque) {
35 blendedColor->fWillBlendWithDst = true; 41 blendedColor->fWillBlendWithDst = true;
36 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 42 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
37 return; 43 return;
(...skipping 28 matching lines...) Expand all
66 GR_DECLARE_XP_FACTORY_TEST; 72 GR_DECLARE_XP_FACTORY_TEST;
67 static void TestGetXPOutputTypes(const GrXferProcessor*, int* outPrimary, in t* outSecondary); 73 static void TestGetXPOutputTypes(const GrXferProcessor*, int* outPrimary, in t* outSecondary);
68 74
69 SkXfermode::Mode fXfermode; 75 SkXfermode::Mode fXfermode;
70 76
71 friend class GrPorterDuffTest; // for TestGetXPOutputTypes() 77 friend class GrPorterDuffTest; // for TestGetXPOutputTypes()
72 typedef GrXPFactory INHERITED; 78 typedef GrXPFactory INHERITED;
73 }; 79 };
74 80
75 #endif 81 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698