aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text/GrAtlasManager.h
diff options
context:
space:
mode:
authorGravatar Timothy Liang <timliang@google.com>2018-06-15 13:28:35 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-19 19:56:24 +0000
commit91e260f4dbcb4006c3b177c2eba7ed0dc1af3e3d (patch)
treeec9617729c7b925613f9446c55299c8ec3b184e2 /src/gpu/text/GrAtlasManager.h
parentc994a93b327235182c6d29a782c409b2c58476ae (diff)
Reland "Reland "added 565 to 8888 conversion for gpu LCD text rendering for macOS""
This reverts commit 5540528f81c0a1ad10b8086a1009b799717329f6. Reason for revert: Changed unique pointer to not be static Original change's description: > 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> Bug: skia: CQ_INCLUDE_TRYBOTS=luci.chromium.try:android-marshmallow-arm64-rel Change-Id: Ie4fa0e4f862546068ed4ab818d4956de7175cb3d Reviewed-on: https://skia-review.googlesource.com/135241 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Timothy Liang <timliang@google.com>
Diffstat (limited to 'src/gpu/text/GrAtlasManager.h')
-rw-r--r--src/gpu/text/GrAtlasManager.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gpu/text/GrAtlasManager.h b/src/gpu/text/GrAtlasManager.h
index 38e2781d4d..6c168534ad 100644
--- a/src/gpu/text/GrAtlasManager.h
+++ b/src/gpu/text/GrAtlasManager.h
@@ -8,8 +8,10 @@
#ifndef GrAtlasManager_DEFINED
#define GrAtlasManager_DEFINED
+#include "GrCaps.h"
#include "GrDrawOpAtlas.h"
#include "GrOnFlushResourceProvider.h"
+#include "GrProxyProvider.h"
class GrAtlasGlypCache;
class GrTextStrike;
@@ -28,11 +30,23 @@ 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();
@@ -127,6 +141,7 @@ private:
}
GrDrawOpAtlas* getAtlas(GrMaskFormat format) const {
+ format = this->resolveMaskFormat(format);
int atlasIndex = MaskFormatToAtlasIndex(format);
SkASSERT(fAtlases[atlasIndex]);
return fAtlases[atlasIndex].get();