aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DMSrcSink.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-10-31 11:59:52 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-31 16:43:24 +0000
commit5b9a037bf41591e0076843f619ee47c9ad30e42d (patch)
tree72a16cab98209b9de87dd94ed4ec2eb41e985f73 /dm/DMSrcSink.cpp
parentb1fc36829de69da5376019403fdd649c06f4cf1b (diff)
gbr- has been brg- this whole time...
Rewrite things to make that a little clearer. A red pixel ends up in channel 2, what would naively draw as blue without a rotation. A green pixel ends up in channel 0, which would naively draw as red without rotation. A blue pixel ends up in channel 1, which would naively draw as green without this rotation. So this transformation is: r -> b g -> r b -> g i.e. rgb_to_brg Change-Id: I12331ff2622194e34a44f421f656fbe4db5d3dca Reviewed-on: https://skia-review.googlesource.com/65521 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'dm/DMSrcSink.cpp')
-rw-r--r--dm/DMSrcSink.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 8e36f0c669..656237dede 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -2168,11 +2168,11 @@ Error ViaCSXform::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkSt
uint32_t* row = pixels.getAddr32(0,y);
for (int x = 0; x < pixels.width(); x++) {
uint32_t pixel = *row;
- uint8_t r = SkGetPackedR32(pixel);
- uint8_t g = SkGetPackedG32(pixel);
- uint8_t b = SkGetPackedB32(pixel);
- uint8_t a = SkGetPackedA32(pixel);
- *row++ = SkSwizzle_RGBA_to_PMColor(b << 0 | r << 8 | g << 16 | a << 24);
+ uint8_t g = (pixel >> 0) & 0xff,
+ b = (pixel >> 8) & 0xff,
+ r = (pixel >> 16) & 0xff,
+ a = (pixel >> 24) & 0xff;
+ *row++ = SkSwizzle_RGBA_to_PMColor(r << 0 | g << 8 | b << 16 | a << 24);
}
}