aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGrPriv.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-09-28 06:26:28 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-28 06:26:29 -0700
commitf1b7a1d82860e106ed7d3e0e876419e65783fb84 (patch)
tree8177909b7cf258639fccd47037befeae6c649c29 /src/gpu/SkGrPriv.h
parent67c6513a96f0dbfeff2bee1c444a5ac9f07857c6 (diff)
Make skpaint->grpaint flow work for composing draws (verts and atlas)
One side effect is that the SkShader's (or implicit shader's) fragment processor is responsible for the transition from an unpremul paint color to a premul color. Review URL: https://codereview.chromium.org/1348583002
Diffstat (limited to 'src/gpu/SkGrPriv.h')
-rw-r--r--src/gpu/SkGrPriv.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h
index 5cf4dd24d6..56a086e935 100644
--- a/src/gpu/SkGrPriv.h
+++ b/src/gpu/SkGrPriv.h
@@ -9,10 +9,17 @@
#define SkGrPriv_DEFINED
#include "GrTypes.h"
-#include "SkPoint.h"
+#include "SkImageInfo.h"
+#include "SkXfermode.h"
class GrCaps;
+class GrContext;
+class GrFragmentProcessor;
+class GrPaint;
class GrUniqueKey;
+class SkPaint;
+class SkMatrix;
+struct SkIRect;
/**
* Our key includes the offset, width, and height so that bitmaps created by extractSubset()
@@ -28,4 +35,35 @@ class GrUniqueKey;
void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& imageBounds,
const GrCaps&, SkImageUsageType);
+/** 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. */
+bool SkPaintToGrPaint(GrContext*,
+ const SkPaint& skPaint,
+ const SkMatrix& viewM,
+ GrPaint* grPaint);
+
+/** 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. */
+bool SkPaintToGrPaintReplaceShader(GrContext*,
+ const SkPaint& skPaint,
+ const GrFragmentProcessor* shaderFP,
+ GrPaint* grPaint);
+
+/** 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.
+ */
+bool SkPaintToGrPaintWithXfermode(GrContext* context,
+ const SkPaint& skPaint,
+ const SkMatrix& viewM,
+ SkXfermode::Mode primColorMode,
+ bool primitiveIsSrc,
+ GrPaint* grPaint);
+
#endif