Remove another GrColor helper function

GrPremulColor is only use in test code, and is redundant

Bug: skia:
Change-Id: I4a22941d28cbec3eb203bca393cfeccffe04e053
Reviewed-on: https://skia-review.googlesource.com/c/165524
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Brian Osman 2018-10-29 14:11:04 -04:00 committed by Skia Commit-Bot
parent 4b0765362f
commit 4408b1cf87
2 changed files with 3 additions and 13 deletions

View File

@ -124,17 +124,6 @@ static inline bool GrColorIsOpaque(GrColor color) {
return (color & (0xFFU << GrColor_SHIFT_A)) == (0xFFU << GrColor_SHIFT_A);
}
static inline GrColor GrPremulColor(GrColor color) {
unsigned r = GrColorUnpackR(color);
unsigned g = GrColorUnpackG(color);
unsigned b = GrColorUnpackB(color);
unsigned a = GrColorUnpackA(color);
return GrColorPackRGBA(SkMulDiv255Round(r, a),
SkMulDiv255Round(g, a),
SkMulDiv255Round(b, a),
a);
}
/** Returns an unpremuled version of the GrColor. */
static inline GrColor GrUnpremulColor(GrColor color) {
GrColorIsPMAssert(color);

View File

@ -13,6 +13,7 @@
#include "GrSurfaceProxy.h"
#include "GrTextureProxy.h"
#include "ProxyUtils.h"
#include "SkGr.h"
#include "SkBase64.h"
#include "SkPngEncoder.h"
@ -47,7 +48,7 @@ void test_write_pixels(skiatest::Reporter* reporter,
for (int y = 0; y < dstContext->width(); ++y) {
for (int x = 0; x < dstContext->height(); ++x) {
pixels.get()[y * dstContext->width() + x] =
GrPremulColor(GrColorPackRGBA(x, y, x + y, 2*y));
SkColorToPremulGrColor(SkColorSetARGB(2*y, x, y, x + y));
}
}
@ -101,7 +102,7 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrProxyProvider* proxyPr
for (int y = 0; y < dstContext->width(); ++y) {
for (int x = 0; x < dstContext->height(); ++x) {
pixels.get()[y * dstContext->width() + x] =
GrPremulColor(GrColorPackRGBA(y, x, x * y, 2*y));
SkColorToPremulGrColor(SkColorSetARGB(2*y, y, x, x * y));
}
}