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

Unified Diff: src/pdf/SkPDFGraphicState.cpp

Issue 18585002: Implemented transparent gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 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
Index: src/pdf/SkPDFGraphicState.cpp
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index 9cf21458233f6025807ce0be554a59e5e95b1d1c..ad9578578a93e4734f9e16968e2bb5e2c38ac0af 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -138,13 +138,17 @@ SkPDFObject* SkPDFGraphicState::GetInvertFunction() {
// static
SkPDFGraphicState* SkPDFGraphicState::GetSMaskGraphicState(
- SkPDFFormXObject* sMask, bool invert) {
+ SkPDFFormXObject* sMask, bool invert, bool alpha) {
// The practical chances of using the same mask more than once are unlikely
// enough that it's not worth canonicalizing.
SkAutoMutexAcquire lock(CanonicalPaintsMutex());
SkAutoTUnref<SkPDFDict> sMaskDict(new SkPDFDict("Mask"));
- sMaskDict->insertName("S", "Alpha");
+ if (alpha) {
+ sMaskDict->insertName("S", "Alpha");
+ } else {
+ sMaskDict->insertName("S", "Luminosity");
+ }
sMaskDict->insert("G", new SkPDFObjRef(sMask))->unref();
SkPDFGraphicState* result = new SkPDFGraphicState;
@@ -203,6 +207,8 @@ void SkPDFGraphicState::populateDict() {
fPopulated = true;
insertName("Type", "ExtGState");
+ // do a SMask if paint involves a gradient alpha
vandebo (ex-Chrome) 2013/07/03 17:07:01 How would paint involve a gradient alpha? We have
ducky 2013/07/03 23:32:09 That wasn't supposed to be there. I somehow missed
+ //TODO ADD STUFF HERE
SkAutoTUnref<SkPDFScalar> alpha(
new SkPDFScalar(SkScalarDiv(fPaint.getAlpha(), 0xFF)));
insert("CA", alpha.get());

Powered by Google App Engine
This is Rietveld 408576698