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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGrPriv.h
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h
index 25fda57d9ec8668ec8781fcbf1b5e5e0e2bb3528..36601fc3e3b918060dd81f3ab9cbf5fce03a303d 100644
--- a/src/gpu/SkGrPriv.h
+++ b/src/gpu/SkGrPriv.h
@@ -54,19 +54,20 @@ void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima
bool GrMakeStretchedKey(const GrUniqueKey& origKey, const SkGrStretch&, GrUniqueKey* stretchedKey);
/** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is required in order
- to convert the SkShader (if any) on the SkPaint. */
+ to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */
bool SkPaintToGrPaint(GrContext*,
const SkPaint& skPaint,
const SkMatrix& viewM,
GrPaint* grPaint);
-/** Ignores the SkShader (if any) on skPaint. */
+/** Same as above but ignores the SkShader (if any) on skPaint. */
bool SkPaintToGrPaintNoShader(GrContext* context,
const SkPaint& skPaint,
GrPaint* grPaint);
/** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProcessor. The processor
- should expect an unpremul input color and produce a premultiplied output color. */
+ should expect an unpremul input color and produce a premultiplied output color. There is
+ no primitive color. */
bool SkPaintToGrPaintReplaceShader(GrContext*,
const SkPaint& skPaint,
const GrFragmentProcessor* shaderFP,
@@ -75,8 +76,7 @@ bool SkPaintToGrPaintReplaceShader(GrContext*,
/** Blends the SkPaint's shader (or color if no shader) with the color which specified via a
GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate whether the
primitive color is the dst or src color to the blend in order to work around differences between
- drawVertices and drawAtlas.
- */
+ drawVertices and drawAtlas. */
bool SkPaintToGrPaintWithXfermode(GrContext* context,
const SkPaint& skPaint,
const SkMatrix& viewM,
@@ -84,6 +84,16 @@ bool SkPaintToGrPaintWithXfermode(GrContext* context,
bool primitiveIsSrc,
GrPaint* grPaint);
+/** This is used when there is a primitive color, but the shader should be ignored. Currently,
+ the expectation is that the primitive color will be premultiplied, though it really should be
+ unpremultiplied so that interpolation is done in unpremul space. The paint's alpha will be
+ applied to the primitive color after interpolation. */
+inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint& skPaint,
+ GrPaint* grPaint) {
+ return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXfermode::kDst_Mode,
+ false, grPaint);
+}
+
bool GrTextureUsageSupported(const GrCaps&, int width, int height, SkImageUsageType);
#endif
« 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