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

Unified Diff: gm/yuvtorgbeffect.cpp

Issue 977273003: Merged https://codereview.chromium.org/922273002/ to M41 (Closed) Base URL: https://skia.googlesource.com/skia.git@m41
Patch Set: Created 5 years, 9 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 | « no previous file | src/gpu/SkGr.cpp » ('j') | src/ports/SkFontHost_FreeType_common.cpp » ('J')
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 ed551ff087fb4dbe31bc3c97adc3d16b4a20568f..cd951f9a95103922fd3b8851f555f26630a83f45 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -19,6 +19,10 @@
#include "SkGr.h"
#include "SkGradientShader.h"
+#define YSIZE 8
+#define USIZE 4
+#define VSIZE 4
+
namespace skiagm {
/**
* This GM directly exercises GrYUVtoRGBEffect.
@@ -35,7 +39,7 @@ protected:
}
virtual SkISize onISize() SK_OVERRIDE {
- return SkISize::Make(334, 128);
+ return SkISize::Make(238, 84);
}
virtual uint32_t onGetFlags() const SK_OVERRIDE {
@@ -44,10 +48,12 @@ protected:
}
virtual void onOnceBeforeDraw() SK_OVERRIDE {
- SkImageInfo info = SkImageInfo::MakeA8(24, 24);
- fBmp[0].allocPixels(info);
- fBmp[1].allocPixels(info);
- fBmp[2].allocPixels(info);
+ 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);
unsigned char* pixels[3];
for (int i = 0; i < 3; ++i) {
pixels[i] = (unsigned char*)fBmp[i].getPixels();
@@ -56,8 +62,9 @@ protected:
const int limit[] = {255, 0, 255};
const int invl[] = {0, 255, 0};
const int inc[] = {1, -1, 1};
- for (int j = 0; j < 576; ++j) {
- for (int i = 0; i < 3; ++i) {
+ for (int i = 0; i < 3; ++i) {
+ const size_t nbBytes = fBmp[i].rowBytes() * fBmp[i].height();
+ for (size_t j = 0; j < nbBytes; ++j) {
pixels[i][j] = (unsigned char)color[i];
color[i] = (color[i] == limit[i]) ? invl[i] : color[i] + inc[i];
}
@@ -92,7 +99,8 @@ protected:
static const SkScalar kDrawPad = 10.f;
static const SkScalar kTestPad = 10.f;
- static const SkScalar kColorSpaceOffset = 64.f;
+ static const SkScalar kColorSpaceOffset = 36.f;
+ SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}};
for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpace;
++space) {
@@ -109,9 +117,10 @@ 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]],
- static_cast<SkYUVColorSpace>(space)));
+ texture[indices[i][1]],
+ texture[indices[i][2]],
+ sizes,
+ static_cast<SkYUVColorSpace>(space)));
if (fp) {
SkMatrix viewMatrix;
viewMatrix.setTranslate(x, y);
« no previous file with comments | « no previous file | src/gpu/SkGr.cpp » ('j') | src/ports/SkFontHost_FreeType_common.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698