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

Unified Diff: src/core/SkImageCacherator.cpp

Issue 1862133002: Add whitelist parameter to refEncodedData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comments 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
« no previous file with comments | « src/core/SkImageCacherator.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageCacherator.cpp
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 7b5ff2267774463584c525bdd0f2cc5ee3fcbd8a..8d6a65a39733182be113479e7a1d3b30e05374e4 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -25,6 +25,16 @@
#include "SkGrPriv.h"
#endif
+bool SkGpuFormatWhitelist::includes(SkEncodedFormat format) {
+#if SK_SUPPORT_GPU
+ return GrIsCompressedFormatPossiblySupported(fCtx, format);
+#else
+ return false;
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
SkImageCacherator* SkImageCacherator::NewFromGenerator(SkImageGenerator* gen,
const SkIRect* subset) {
if (!gen) {
@@ -70,8 +80,15 @@ SkImageCacherator::SkImageCacherator(SkImageGenerator* gen, const SkImageInfo& i
{}
SkData* SkImageCacherator::refEncoded(GrContext* ctx) {
+ SkImageGenerator::RefEncodedWhitelist* whitelist = nullptr;
+#if SK_SUPPORT_GPU
+ SkGpuFormatWhitelist gpuWhitelist(ctx);
+ if (ctx) {
+ whitelist = &gpuWhitelist;
+ }
+#endif
ScopedGenerator generator(this);
- return generator->refEncodedData(ctx);
+ return generator->refEncodedData(whitelist);
}
static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) {
« no previous file with comments | « src/core/SkImageCacherator.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698