diff options
author | Greg Daniel <egdaniel@google.com> | 2018-06-14 17:41:45 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-14 17:41:58 +0000 |
commit | cf274da6faa9d32e08053180c8113fcaab666028 (patch) | |
tree | c8b6699693fd14a96e315801960965b3df9eb019 /src | |
parent | 9414c96781d7f95a066b95261f333f0c0b46b39f (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/text/GrAtlasManager.cpp | 2 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasManager.h | 15 | ||||
-rw-r--r-- | src/gpu/text/GrGlyphCache.cpp | 29 |
3 files changed, 2 insertions, 44 deletions
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp index e589b20814..ec07429180 100644 --- a/src/gpu/text/GrAtlasManager.cpp +++ b/src/gpu/text/GrAtlasManager.cpp @@ -7,8 +7,10 @@ #include "GrAtlasManager.h" +#include "GrCaps.h" #include "GrGlyph.h" #include "GrGlyphCache.h" +#include "GrProxyProvider.h" void GrAtlasManager::ComputeAtlasLimits(int maxTextureSize, size_t maxTextureBytes, int* maxDim, int* minDim, int* maxPlot, int* minPlot) { diff --git a/src/gpu/text/GrAtlasManager.h b/src/gpu/text/GrAtlasManager.h index 6c168534ad..38e2781d4d 100644 --- a/src/gpu/text/GrAtlasManager.h +++ b/src/gpu/text/GrAtlasManager.h @@ -8,10 +8,8 @@ #ifndef GrAtlasManager_DEFINED #define GrAtlasManager_DEFINED -#include "GrCaps.h" #include "GrDrawOpAtlas.h" #include "GrOnFlushResourceProvider.h" -#include "GrProxyProvider.h" class GrAtlasGlypCache; class GrTextStrike; @@ -30,23 +28,11 @@ public: float maxTextureBytes, GrDrawOpAtlas::AllowMultitexturing); ~GrAtlasManager() override; - // Change an expected 565 mask format to 8888 if 565 is not supported (will happen when using - // Metal on macOS). The actual conversion of the data is handled in get_packed_glyph_image() in - // GrGlyphCache.cpp - GrMaskFormat resolveMaskFormat(GrMaskFormat format) const { - if (kA565_GrMaskFormat == format && - !fProxyProvider->caps()->isConfigTexturable(kRGB_565_GrPixelConfig)) { - format = kARGB_GrMaskFormat; - } - return format; - } - // if getProxies returns nullptr, the client must not try to use other functions on the // GrGlyphCache which use the atlas. This function *must* be called first, before other // functions which use the atlas. Note that we can have proxies available but none active // (i.e., none instantiated). const sk_sp<GrTextureProxy>* getProxies(GrMaskFormat format, unsigned int* numActiveProxies) { - format = this->resolveMaskFormat(format); if (this->initAtlas(format)) { *numActiveProxies = this->getAtlas(format)->numActivePages(); return this->getAtlas(format)->getProxies(); @@ -141,7 +127,6 @@ private: } GrDrawOpAtlas* getAtlas(GrMaskFormat format) const { - format = this->resolveMaskFormat(format); int atlasIndex = MaskFormatToAtlasIndex(format); SkASSERT(fAtlases[atlasIndex]); return fAtlases[atlasIndex].get(); diff --git a/src/gpu/text/GrGlyphCache.cpp b/src/gpu/text/GrGlyphCache.cpp index 78b9dc3d12..f6a18c3271 100644 --- a/src/gpu/text/GrGlyphCache.cpp +++ b/src/gpu/text/GrGlyphCache.cpp @@ -8,15 +8,10 @@ #include "GrGlyphCache.h" #include "GrAtlasManager.h" #include "GrCaps.h" -#include "GrColor.h" #include "GrDistanceFieldGenFromVector.h" #include "SkAutoMalloc.h" #include "SkDistanceFieldGen.h" -#include "SkMasks.h" - -static std::unique_ptr<const SkMasks> k565Masks(SkMasks::CreateMasks({0xF800, 0x07E0, 0x001F, 0}, - GrMaskFormatBytesPerPixel(kA565_GrMaskFormat) * 8)); GrGlyphCache::GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes) : fPreserveStrike(nullptr), fGlyphSizeLimit(0) { @@ -133,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(k565Masks->getRed(color565), - k565Masks->getGreen(color565), - k565Masks->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. @@ -265,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(); |