aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text/GrAtlasTextContext.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-05-11 10:57:37 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-11 18:14:32 +0000
commitec8f8b064340b030fc4ce10f6cbbc3d6f63b946f (patch)
tree77f75eafbe3a353c52e008ef71704f468166be8e /src/gpu/text/GrAtlasTextContext.cpp
parent07072944af9fac196efeb78d6791537221cd1d4c (diff)
Fix GPU text colors when color spaces are involved
1) Only store GrColors in GrTextUtils::Paint. We still store premul and unpremul versions, but this is slightly clearer. 2) GrTextUtils::Paint also needs info from the render target context to linearize and transform the color to dst space. Bug: skia:6605 Change-Id: I6e12c55eafaecd2a090c82b4f56827401305bf3a Reviewed-on: https://skia-review.googlesource.com/16486 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/text/GrAtlasTextContext.cpp')
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index d99f2828fc..abe8d24d07 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -118,7 +118,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext*
cacheBlob = cache->find(key);
}
- GrTextUtils::Paint paint(&skPaint);
+ GrTextUtils::Paint paint(&skPaint, rtc->getColorSpace(), rtc->getColorXformFromSRGB());
if (cacheBlob) {
if (cacheBlob->mustRegenerate(paint, blurRec, viewMatrix, x, y)) {
// We have to remake the blob because changes may invalidate our masks.
@@ -166,7 +166,7 @@ void GrAtlasTextContext::RegenerateTextBlob(GrAtlasTextBlob* cacheBlob,
uint32_t scalerContextFlags, const SkMatrix& viewMatrix,
const SkSurfaceProps& props, const SkTextBlob* blob,
SkScalar x, SkScalar y, SkDrawFilter* drawFilter) {
- cacheBlob->initReusableBlob(paint.filteredSkColor(), viewMatrix, x, y);
+ cacheBlob->initReusableBlob(paint.filteredUnpremulColor(), viewMatrix, x, y);
// Regenerate textblob
SkTextBlobRunIterator it(blob);
@@ -289,7 +289,7 @@ void GrAtlasTextContext::drawText(GrContext* context, GrRenderTargetContext* rtc
if (context->abandoned()) {
return;
}
- GrTextUtils::Paint paint(&skPaint);
+ GrTextUtils::Paint paint(&skPaint, rtc->getColorSpace(), rtc->getColorXformFromSRGB());
if (this->canDraw(skPaint, viewMatrix, props, *context->caps()->shaderCaps())) {
sk_sp<GrAtlasTextBlob> blob(
MakeDrawTextBlob(context->getTextBlobCache(), context->getAtlasGlyphCache(),
@@ -313,7 +313,7 @@ void GrAtlasTextContext::drawPosText(GrContext* context, GrRenderTargetContext*
const char text[], size_t byteLength, const SkScalar pos[],
int scalarsPerPosition, const SkPoint& offset,
const SkIRect& regionClipBounds) {
- GrTextUtils::Paint paint(&skPaint);
+ GrTextUtils::Paint paint(&skPaint, rtc->getColorSpace(), rtc->getColorXformFromSRGB());
if (context->abandoned()) {
return;
} else if (this->canDraw(skPaint, viewMatrix, props, *context->caps()->shaderCaps())) {
@@ -352,7 +352,7 @@ DRAW_OP_TEST_DEFINE(TextBlobOp) {
}
// Setup dummy SkPaint / GrPaint / GrRenderTargetContext
- sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
+ sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContext(
SkBackingFit::kApprox, 1024, 1024, kRGBA_8888_GrPixelConfig, nullptr));
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
@@ -374,7 +374,7 @@ DRAW_OP_TEST_DEFINE(TextBlobOp) {
SkScalar x = SkIntToScalar(xInt);
SkScalar y = SkIntToScalar(yInt);
- GrTextUtils::Paint paint(&skPaint);
+ GrTextUtils::Paint paint(&skPaint, rtc->getColorSpace(), rtc->getColorXformFromSRGB());
// right now we don't handle textblobs, nor do we handle drawPosText. Since we only intend to
// test the text op with this unit test, that is okay.
sk_sp<GrAtlasTextBlob> blob(GrAtlasTextContext::MakeDrawTextBlob(