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

Unified Diff: gm/yuvtorgbeffect.cpp

Issue 516463005: Add support for the Rec601 YUV color space to GrYUVtoRGBEffect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use float literals to make VS happy Created 6 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 | « expectations/gm/ignored-tests.txt ('k') | include/core/SkImageGenerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/yuvtorgbeffect.cpp
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 12676f262e2477f72cd3a19487ea2b7400e3a0fd..acb6f2251b7ecc51b9d35c20402e8d4aafcbc147 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -35,7 +35,7 @@ protected:
}
virtual SkISize onISize() SK_OVERRIDE {
- return SkISize::Make(334, 64);
+ return SkISize::Make(334, 128);
}
virtual uint32_t onGetFlags() const SK_OVERRIDE {
@@ -93,31 +93,36 @@ protected:
static const SkScalar kDrawPad = 10.f;
static const SkScalar kTestPad = 10.f;
-
- SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()),
- SkIntToScalar(fBmp[0].height()));
- renderRect.outset(kDrawPad, kDrawPad);
-
- SkScalar y = kDrawPad + kTestPad;
- SkScalar x = kDrawPad + kTestPad;
-
- const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
-
- for (int i = 0; i < 6; ++i) {
- SkAutoTUnref<GrEffect> effect(
- GrYUVtoRGBEffect::Create(texture[indices[i][0]],
- texture[indices[i][1]],
- texture[indices[i][2]]));
- if (effect) {
- SkMatrix viewMatrix;
- viewMatrix.setTranslate(x, y);
- drawState->reset(viewMatrix);
- drawState->setRenderTarget(rt);
- drawState->setColor(0xffffffff);
- drawState->addColorEffect(effect, 1);
- tt.target()->drawSimpleRect(renderRect);
- }
- x += renderRect.width() + kTestPad;
+ static const SkScalar kColorSpaceOffset = 64.f;
+
+ for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpace;
+ ++space) {
+ SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()),
+ SkIntToScalar(fBmp[0].height()));
+ renderRect.outset(kDrawPad, kDrawPad);
+
+ SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset;
+ SkScalar x = kDrawPad + kTestPad;
+
+ const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
+
+ for (int i = 0; i < 6; ++i) {
+ SkAutoTUnref<GrEffect> effect(
+ GrYUVtoRGBEffect::Create(texture[indices[i][0]],
+ texture[indices[i][1]],
+ texture[indices[i][2]],
+ static_cast<SkYUVColorSpace>(space)));
+ if (effect) {
+ SkMatrix viewMatrix;
+ viewMatrix.setTranslate(x, y);
+ drawState->reset(viewMatrix);
+ drawState->setRenderTarget(rt);
+ drawState->setColor(0xffffffff);
+ drawState->addColorEffect(effect, 1);
+ tt.target()->drawSimpleRect(renderRect);
+ }
+ x += renderRect.width() + kTestPad;
+ }
}
GrUnlockAndUnrefCachedBitmapTexture(texture[0]);
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | include/core/SkImageGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698