aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text/GrGlyphCache.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-06-15 16:56:22 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-15 16:56:36 +0000
commit5540528f81c0a1ad10b8086a1009b799717329f6 (patch)
tree2868a5e821913d934fe16b37c82a223664487221 /src/gpu/text/GrGlyphCache.cpp
parentb0897650f1f4279d335994284bd15f972dee57bc (diff)
Revert "Reland "added 565 to 8888 conversion for gpu LCD text rendering for macOS""
This reverts commit 0513dd8675534afdd605cea32778a4b4671b2c3d. Reason for revert: Still has static initializer. Original change's description: > Reland "added 565 to 8888 conversion for gpu LCD text rendering for macOS" > > This reverts commit cf274da6faa9d32e08053180c8113fcaab666028. > > Reason for revert: removed the static initializer > > Original change's description: > > Revert "added 565 to 8888 conversion for gpu LCD text rendering for macOS" > > > > This reverts commit e6f2ecafaf0efecacfd4256f280e26ee74cb7e16. > > > > Reason for revert: breaking chrome roll cause of static initializers > > > > Original change's description: > > > added 565 to 8888 conversion for gpu LCD text rendering for macOS > > > > > > Bug: skia: > > > Change-Id: Ie24160bb098d388bf4ad69d0c2f9f8ed4beb215c > > > Reviewed-on: https://skia-review.googlesource.com/134508 > > > Commit-Queue: Timothy Liang <timliang@google.com> > > > Reviewed-by: Jim Van Verth <jvanverth@google.com> > > > > TBR=egdaniel@google.com,jvanverth@google.com,timliang@google.com > > > > Change-Id: Ida97a4085c93fcb990999ab71f99364ec2ef86b7 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: skia: > > Reviewed-on: https://skia-review.googlesource.com/135000 > > Reviewed-by: Greg Daniel <egdaniel@google.com> > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > Change-Id: I40c29b73970c55b3579a0169bbad666a798b2348 > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/135021 > Reviewed-by: Jim Van Verth <jvanverth@google.com> > Reviewed-by: Greg Daniel <egdaniel@google.com> > Commit-Queue: Timothy Liang <timliang@google.com> TBR=egdaniel@google.com,jvanverth@google.com,timliang@google.com Change-Id: I2632d02adc9ba791e5a55adafe0ad10a63f50073 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/135240 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/gpu/text/GrGlyphCache.cpp')
-rw-r--r--src/gpu/text/GrGlyphCache.cpp31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/gpu/text/GrGlyphCache.cpp b/src/gpu/text/GrGlyphCache.cpp
index 4c10a6c7eb..f6a18c3271 100644
--- a/src/gpu/text/GrGlyphCache.cpp
+++ b/src/gpu/text/GrGlyphCache.cpp
@@ -8,14 +8,11 @@
#include "GrGlyphCache.h"
#include "GrAtlasManager.h"
#include "GrCaps.h"
-#include "GrColor.h"
#include "GrDistanceFieldGenFromVector.h"
#include "SkAutoMalloc.h"
#include "SkDistanceFieldGen.h"
-std::unique_ptr<const SkMasks> GrGlyphCache::k565Masks;
-
GrGlyphCache::GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes)
: fPreserveStrike(nullptr), fGlyphSizeLimit(0) {
fGlyphSizeLimit = ComputeGlyphSizeLimit(caps->maxTextureSize(), maxTextureBytes);
@@ -123,7 +120,7 @@ static void expand_bits(INT_TYPE* dst,
static bool get_packed_glyph_image(SkGlyphCache* cache, const SkGlyph& glyph, int width,
int height, int dstRB, GrMaskFormat expectedMaskFormat,
- void* dst, const SkMasks& masks) {
+ void* dst) {
SkASSERT(glyph.fWidth == width);
SkASSERT(glyph.fHeight == height);
const void* src = cache->findImage(glyph);
@@ -131,29 +128,6 @@ static bool get_packed_glyph_image(SkGlyphCache* cache, const SkGlyph& glyph, in
return false;
}
- // Convert if the glyph uses a 565 mask format since it is using LCD text rendering but the
- // expected format is 8888 (will happen on macOS with Metal since that combination does not
- // support 565).
- if (kA565_GrMaskFormat == get_packed_glyph_mask_format(glyph) &&
- kARGB_GrMaskFormat == expectedMaskFormat) {
- const int a565Bpp = GrMaskFormatBytesPerPixel(kA565_GrMaskFormat);
- const int argbBpp = GrMaskFormatBytesPerPixel(kARGB_GrMaskFormat);
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- uint16_t color565 = 0;
- memcpy(&color565, src, a565Bpp);
- uint32_t colorRGBA = GrColorPackRGBA(masks.getRed(color565),
- masks.getGreen(color565),
- masks.getBlue(color565),
- 0xFF);
- memcpy(dst, &colorRGBA, argbBpp);
- src = (char*)src + a565Bpp;
- dst = (char*)dst + argbBpp;
- }
- }
- return true;
- }
-
// crbug:510931
// Retrieving the image from the cache can actually change the mask format. This case is very
// uncommon so for now we just draw a clear box for these glyphs.
@@ -263,7 +237,6 @@ GrDrawOpAtlas::ErrorCode GrTextStrike::addGlyphToAtlas(
SkASSERT(cache);
SkASSERT(fCache.find(glyph->fPackedID));
- expectedMaskFormat = fullAtlasManager->resolveMaskFormat(expectedMaskFormat);
int bytesPerPixel = GrMaskFormatBytesPerPixel(expectedMaskFormat);
int width = glyph->width();
int height = glyph->height();
@@ -289,7 +262,7 @@ GrDrawOpAtlas::ErrorCode GrTextStrike::addGlyphToAtlas(
}
if (!get_packed_glyph_image(cache, skGlyph, glyph->width(), glyph->height(),
rowBytes, expectedMaskFormat,
- dataPtr, *GrGlyphCache::k565Masks)) {
+ dataPtr)) {
return GrDrawOpAtlas::ErrorCode::kError;
}