Tag string bitmaps (for GMs) as sRGB

These are often used as inputs when testing image filters, and we need
tagged inputs to test the color pipeline. To avoid changing legacy mode
results, rasterize the bitmaps in legacy, but tag the output.

BUG=skia:

Change-Id: I55e2c0e0061b3f50b1caa18c19ba4fcf92cdf902
Reviewed-on: https://skia-review.googlesource.com/6280
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2016-12-20 11:09:31 -05:00 committed by Skia Commit-Bot
parent 33667da26d
commit 2b25d348fe

View File

@ -14,6 +14,7 @@
#include "SkCommonFlags.h"
#include "SkFontMgr.h"
#include "SkFontStyle.h"
#include "SkPixelRef.h"
#include "SkPoint3.h"
#include "SkShader.h"
#include "SkTestScalerContext.h"
@ -239,7 +240,12 @@ SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y,
canvas.clear(0x00000000);
canvas.drawText(str, strlen(str), SkIntToScalar(x), SkIntToScalar(y), paint);
return bitmap;
// Tag data as sRGB (without doing any color space conversion). Color-space aware configs
// will process this correctly but legacy configs will render as if this returned N32.
SkBitmap result;
result.setInfo(SkImageInfo::MakeS32(w, h, kPremul_SkAlphaType));
result.setPixelRef(sk_ref_sp(bitmap.pixelRef()), 0, 0);
return result;
}
void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPaint& origPaint,