diff options
author | jvanverth <jvanverth@google.com> | 2015-02-13 12:02:22 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-13 12:02:23 -0800 |
commit | 0ff748ace6a53f05b52268f7a8786eeef611a839 (patch) | |
tree | 279ad46936f8475119a5e013af23c80bd1937126 /gm | |
parent | b5d0ce6bd4fef192a9908562b5a01bc01683c7bb (diff) |
Revert of YUV scale fix (patchset #2 id:20001 of https://codereview.chromium.org/922273002/)
Reason for revert:
Turning Windows compile bots red.
Original issue's description:
> YUV scale fix
>
> There was a scaling mistake visible in some JPEG images because the ratio between Y, U and V planes were assumed to be the same ratios as the ratio between texture sizes, which was wrong because texture have a minimum size of 16 and are rounded up to the next POT. Since the ratios between Y and UV planes are generally 1, 2 or 4, rounding up to the next POT would generally preserve this ratio, so that this bug was not very visible, apart from very small jpeg images of 8 or less pixels in either width or height.
>
> BUG=457954
>
> Committed: https://skia.googlesource.com/skia/+/e6eddf7dd85add7da41f22f2643bdd573ad1f1cf
TBR=bsalomon@google.com,sugoi@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=457954
Review URL: https://codereview.chromium.org/926123002
Diffstat (limited to 'gm')
-rw-r--r-- | gm/yuvtorgbeffect.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index 2cff7649d6..fb0c67d3d1 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -19,10 +19,6 @@ #include "SkGr.h" #include "SkGradientShader.h" -#define YSIZE 8 -#define USIZE 4 -#define VSIZE 4 - namespace skiagm { /** * This GM directly exercises GrYUVtoRGBEffect. @@ -39,16 +35,14 @@ protected: } SkISize onISize() SK_OVERRIDE { - return SkISize::Make(238, 84); + return SkISize::Make(334, 128); } void onOnceBeforeDraw() SK_OVERRIDE { - SkImageInfo yinfo = SkImageInfo::MakeA8(YSIZE, YSIZE); - fBmp[0].allocPixels(yinfo); - SkImageInfo uinfo = SkImageInfo::MakeA8(USIZE, USIZE); - fBmp[1].allocPixels(uinfo); - SkImageInfo vinfo = SkImageInfo::MakeA8(VSIZE, VSIZE); - fBmp[2].allocPixels(vinfo); + SkImageInfo info = SkImageInfo::MakeA8(24, 24); + fBmp[0].allocPixels(info); + fBmp[1].allocPixels(info); + fBmp[2].allocPixels(info); unsigned char* pixels[3]; for (int i = 0; i < 3; ++i) { pixels[i] = (unsigned char*)fBmp[i].getPixels(); @@ -57,9 +51,8 @@ protected: const int limit[] = {255, 0, 255}; const int invl[] = {0, 255, 0}; const int inc[] = {1, -1, 1}; - for (int i = 0; i < 3; ++i) { - const int nbBytes = fBmp[i].rowBytes() * fBmp[i].height(); - for (int j = 0; j < nbBytes; ++j) { + for (int j = 0; j < 576; ++j) { + for (int i = 0; i < 3; ++i) { pixels[i][j] = (unsigned char)color[i]; color[i] = (color[i] == limit[i]) ? invl[i] : color[i] + inc[i]; } @@ -95,8 +88,7 @@ protected: static const SkScalar kDrawPad = 10.f; static const SkScalar kTestPad = 10.f; - static const SkScalar kColorSpaceOffset = 36.f; - SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; + static const SkScalar kColorSpaceOffset = 64.f; for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpace; ++space) { @@ -113,10 +105,9 @@ protected: for (int i = 0; i < 6; ++i) { SkAutoTUnref<GrFragmentProcessor> fp( GrYUVtoRGBEffect::Create(texture[indices[i][0]], - texture[indices[i][1]], - texture[indices[i][2]], - sizes, - static_cast<SkYUVColorSpace>(space))); + texture[indices[i][1]], + texture[indices[i][2]], + static_cast<SkYUVColorSpace>(space))); if (fp) { SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); |