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

Side by Side Diff: src/gpu/SkGrPriv.h

Issue 1382753002: Fix drawVertices when there is a paint alpha (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 5 years, 2 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/SkGr.cpp ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 SkGrPriv_DEFINED 8 #ifndef SkGrPriv_DEFINED
9 #define SkGrPriv_DEFINED 9 #define SkGrPriv_DEFINED
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 */ 47 */
48 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima geBounds, 48 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima geBounds,
49 const GrCaps&, SkImageUsageType); 49 const GrCaps&, SkImageUsageType);
50 50
51 /** 51 /**
52 * Given an "unstretched" key, and a stretch rec, produce a stretched key. 52 * Given an "unstretched" key, and a stretch rec, produce a stretched key.
53 */ 53 */
54 bool GrMakeStretchedKey(const GrUniqueKey& origKey, const SkGrStretch&, GrUnique Key* stretchedKey); 54 bool GrMakeStretchedKey(const GrUniqueKey& origKey, const SkGrStretch&, GrUnique Key* stretchedKey);
55 55
56 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir ed in order 56 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir ed in order
57 to convert the SkShader (if any) on the SkPaint. */ 57 to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */
58 bool SkPaintToGrPaint(GrContext*, 58 bool SkPaintToGrPaint(GrContext*,
59 const SkPaint& skPaint, 59 const SkPaint& skPaint,
60 const SkMatrix& viewM, 60 const SkMatrix& viewM,
61 GrPaint* grPaint); 61 GrPaint* grPaint);
62 62
63 /** Ignores the SkShader (if any) on skPaint. */ 63 /** Same as above but ignores the SkShader (if any) on skPaint. */
64 bool SkPaintToGrPaintNoShader(GrContext* context, 64 bool SkPaintToGrPaintNoShader(GrContext* context,
65 const SkPaint& skPaint, 65 const SkPaint& skPaint,
66 GrPaint* grPaint); 66 GrPaint* grPaint);
67 67
68 /** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProce ssor. The processor 68 /** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProce ssor. The processor
69 should expect an unpremul input color and produce a premultiplied output col or. */ 69 should expect an unpremul input color and produce a premultiplied output col or. There is
70 no primitive color. */
70 bool SkPaintToGrPaintReplaceShader(GrContext*, 71 bool SkPaintToGrPaintReplaceShader(GrContext*,
71 const SkPaint& skPaint, 72 const SkPaint& skPaint,
72 const GrFragmentProcessor* shaderFP, 73 const GrFragmentProcessor* shaderFP,
73 GrPaint* grPaint); 74 GrPaint* grPaint);
74 75
75 /** Blends the SkPaint's shader (or color if no shader) with the color which spe cified via a 76 /** Blends the SkPaint's shader (or color if no shader) with the color which spe cified via a
76 GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate whether the 77 GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate whether the
77 primitive color is the dst or src color to the blend in order to work around differences between 78 primitive color is the dst or src color to the blend in order to work around differences between
78 drawVertices and drawAtlas. 79 drawVertices and drawAtlas. */
79 */
80 bool SkPaintToGrPaintWithXfermode(GrContext* context, 80 bool SkPaintToGrPaintWithXfermode(GrContext* context,
81 const SkPaint& skPaint, 81 const SkPaint& skPaint,
82 const SkMatrix& viewM, 82 const SkMatrix& viewM,
83 SkXfermode::Mode primColorMode, 83 SkXfermode::Mode primColorMode,
84 bool primitiveIsSrc, 84 bool primitiveIsSrc,
85 GrPaint* grPaint); 85 GrPaint* grPaint);
86 86
87 /** This is used when there is a primitive color, but the shader should be ignor ed. Currently,
88 the expectation is that the primitive color will be premultiplied, though it really should be
89 unpremultiplied so that interpolation is done in unpremul space. The paint's alpha will be
90 applied to the primitive color after interpolation. */
91 inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint & skPaint,
92 GrPaint* grPaint) {
93 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm ode::kDst_Mode,
94 false, grPaint);
95 }
96
87 bool GrTextureUsageSupported(const GrCaps&, int width, int height, SkImageUsageT ype); 97 bool GrTextureUsageSupported(const GrCaps&, int width, int height, SkImageUsageT ype);
88 98
89 #endif 99 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698