DM: don't change byte order when unpremultiplying to compare to PNGs.
We've already decoded the PNGs themselves into unpremultiplied bitmaps with native byte order. SkColor is just not the right choice unless you get lucky. dm -w /tmp/dm && dm -r /tmp/dm still works on Linux, and it's much closer to working on Mac: 0 tasks left, 2 failed Failures: matrixconvolution_gpu colormatrix_gpu BUG=skia: R=reed@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/139943002 git-svn-id: http://skia.googlecode.com/svn/trunk@13101 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
c3147c668c
commit
389fb7fcd4
@ -1,6 +1,7 @@
|
||||
#include "DMWriteTask.h"
|
||||
|
||||
#include "DMUtil.h"
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkCommandLineFlags.h"
|
||||
#include "SkImageDecoder.h"
|
||||
#include "SkImageEncoder.h"
|
||||
@ -136,12 +137,17 @@ bool WriteTask::Expectations::check(const Task& task, SkBitmap bitmap) const {
|
||||
unpremul.setConfig(info);
|
||||
unpremul.allocPixels();
|
||||
|
||||
// Unpremultiply without changing native byte order.
|
||||
SkAutoLockPixels lockSrc(bitmap), lockDst(unpremul);
|
||||
const SkPMColor* src = (SkPMColor*)bitmap.getPixels();
|
||||
SkColor* dst = (SkColor*)unpremul.getPixels();
|
||||
|
||||
uint32_t* dst = (uint32_t*)unpremul.getPixels();
|
||||
for (size_t i = 0; i < bitmap.getSize()/4; i++) {
|
||||
dst[i] = SkUnPreMultiply::PMColorToColor(src[i]);
|
||||
const U8CPU a = SkGetPackedA32(src[i]);
|
||||
const SkUnPreMultiply::Scale s = SkUnPreMultiply::GetScale(a);
|
||||
dst[i] = SkPackARGB32NoCheck(a,
|
||||
SkUnPreMultiply::ApplyScale(s, SkGetPackedR32(src[i])),
|
||||
SkUnPreMultiply::ApplyScale(s, SkGetPackedG32(src[i])),
|
||||
SkUnPreMultiply::ApplyScale(s, SkGetPackedB32(src[i])));
|
||||
}
|
||||
bitmap.swap(unpremul);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user