aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-02-22 17:19:04 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-22 17:19:04 -0800
commitd0c4e092d54d281991ecfdc2e4ddd5217e45b42a (patch)
treeb7410292954a9f95bef49d7668adb8d82a07e0f8 /include/core
parent888934723db64ebecb0d6e577ba7b70689d83dd2 (diff)
Add dest type hint to SkShader::ContextRec
Let SkBlitter decide which dst type is optimal (PMColor vs PM4f), and pass that info to shaders. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1724503002 Review URL: https://codereview.chromium.org/1724503002
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkShader.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 8e69fafa78..72cd4a2dbe 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -10,6 +10,7 @@
#include "SkBitmap.h"
#include "SkFlattenable.h"
+#include "SkImageInfo.h"
#include "SkMask.h"
#include "SkMatrix.h"
#include "SkPaint.h"
@@ -96,14 +97,22 @@ public:
* ContextRec acts as a parameter bundle for creating Contexts.
*/
struct ContextRec {
- ContextRec(const SkPaint& paint, const SkMatrix& matrix, const SkMatrix* localM)
+ enum DstType {
+ kPMColor_DstType, // clients prefer shading into PMColor dest
+ kPM4f_DstType, // clients prefer shading into PM4f dest
+ };
+
+ ContextRec(const SkPaint& paint, const SkMatrix& matrix, const SkMatrix* localM,
+ DstType dstType)
: fPaint(&paint)
, fMatrix(&matrix)
- , fLocalMatrix(localM) {}
+ , fLocalMatrix(localM)
+ , fPreferredDstType(dstType) {}
- const SkPaint* fPaint; // the current paint associated with the draw
- const SkMatrix* fMatrix; // the current matrix in the canvas
- const SkMatrix* fLocalMatrix; // optional local matrix
+ const SkPaint* fPaint; // the current paint associated with the draw
+ const SkMatrix* fMatrix; // the current matrix in the canvas
+ const SkMatrix* fLocalMatrix; // optional local matrix
+ const DstType fPreferredDstType; // the "natural" client dest type
};
class Context : public ::SkNoncopyable {