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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 8 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
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index d0c526b1700aab2727466da756410591d8c17e99..d9727415b254a3bc1471b4f9196908dd23acab1f 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -396,7 +396,8 @@ void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -446,7 +447,8 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mode) {
GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
SkPath path;
@@ -466,7 +468,8 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -518,7 +521,8 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -536,7 +540,8 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
CHECK_SHOULD_DRAW(draw);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -611,7 +616,8 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect()) {
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -655,7 +661,8 @@ void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -1139,7 +1146,8 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
GrPaint grPaint;
if (!SkPaintToGrPaintWithTexture(this->context(), paint, viewMatrix, fp,
- kAlpha_8_SkColorType == bitmap.colorType(), &grPaint)) {
+ kAlpha_8_SkColorType == bitmap.colorType(),
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -1233,7 +1241,8 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
} else {
fp.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp));
}
- if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp, &grPaint)) {
+ if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -1393,7 +1402,8 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
fp.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp));
}
- if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp, &grPaint)) {
+ if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -1532,7 +1542,8 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc
&kMode));
GrPaint grPaint;
if (!SkPaintToGrPaintWithTexture(this->context(), paint, *draw.fMatrix, fp,
- producer->isAlphaOnly(), &grPaint)) {
+ producer->isAlphaOnly(),
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -1599,7 +1610,8 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
GrPaint grPaint;
// we ignore the shader if texs is null.
- if (!SkPaintToGrPaintNoShader(this->context(), copy, &grPaint)) {
+ if (!SkPaintToGrPaintNoShader(this->context(), copy,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -1671,12 +1683,14 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
colorMode = SkXfermode::kModulate_Mode;
}
if (!SkPaintToGrPaintWithXfermode(this->context(), paint, *draw.fMatrix, colorMode,
- false, &grPaint)) {
+ false, this->surfaceProps().allowSRGBInputs(),
+ &grPaint)) {
return;
}
} else {
// We have a shader, but no colors to blend it against.
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
}
@@ -1684,12 +1698,15 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
if (colors) {
// We have colors, but either have no shader or no texture coords (which implies that
// we should ignore the shader).
- if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), paint, &grPaint)) {
+ if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), paint,
+ this->surfaceProps().allowSRGBInputs(),
+ &grPaint)) {
return;
}
} else {
// No colors and no shaders. Just draw with the paint color.
- if (!SkPaintToGrPaintNoShader(this->context(), paint, &grPaint)) {
+ if (!SkPaintToGrPaintNoShader(this->context(), paint,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
}
@@ -1727,11 +1744,12 @@ void SkGpuDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRS
GrPaint grPaint;
if (colors) {
if (!SkPaintToGrPaintWithXfermode(this->context(), p, *draw.fMatrix, mode, true,
- &grPaint)) {
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
} else {
- if (!SkPaintToGrPaint(this->context(), p, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), p, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
}
@@ -1750,7 +1768,8 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}
@@ -1768,7 +1787,8 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL
CHECK_SHOULD_DRAW(draw);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
+ this->surfaceProps().allowSRGBInputs(), &grPaint)) {
return;
}

Powered by Google App Engine
This is Rietveld 408576698