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

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 1367993002: SkPDF Implement colorfilters on bitmaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « gm/colorfilterimagefilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.cpp
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 52c4c655cd9c38d6b1cd58c4cb0b217f54321c8a..98de50b77d7390441c05c0cd9463c1f4dbb87818 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -9,6 +9,7 @@
#include "SkAnnotation.h"
#include "SkColor.h"
+#include "SkColorFilter.h"
#include "SkClipStack.h"
#include "SkData.h"
#include "SkDraw.h"
@@ -2202,10 +2203,20 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
}
SkBitmap subsetBitmap;
- // Should extractSubset be done by the SkPDFDevice?
scroggo 2015/09/24 17:09:16 I suppose this comment is no longer relevant becau
hal.canary 2015/09/24 17:15:06 It wasn't relevant before, too.
if (!bitmap->extractSubset(&subsetBitmap, subset)) {
return;
}
+ if (SkColorFilter* colorFilter = paint.getColorFilter()) {
+ // TODO(http://skbug.com/4378): implement colorfilter everywhere.
scroggo 2015/09/24 17:09:16 What do you mean support it everywhere? I suppose
hal.canary 2015/09/24 17:15:05 I tried to make it more clear.
scroggo 2015/09/24 17:20:26 lgtm
+ SkBitmap tmp;
+ if (subsetBitmap.copyTo(&tmp, kN32_SkColorType)) {
+ for (int y = 0; y < tmp.height(); ++y) {
+ SkPMColor* pixels = tmp.getAddr32(0, y);
+ colorFilter->filterSpan(pixels, tmp.width(), pixels);
+ }
+ subsetBitmap = tmp;
+ }
+ }
SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap));
if (!image) {
return;
« no previous file with comments | « gm/colorfilterimagefilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698