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

Unified Diff: src/core/SkImageCacherator.cpp

Issue 1351533004: share code between SkGr and Cacherator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: captured strict check in a helper function Created 5 years, 3 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 | « include/gpu/SkGr.h ('k') | src/gpu/SkGpuDevice.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 dcc5c676f672e546be136263c50d14b9efdaadf3..f5ec5e34771e002b3463d499a379d7d62bbfad6b 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -162,13 +162,6 @@ bool SkImageCacherator::lockAsBitmap(SkBitmap* bitmap) {
//////////////////////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
-static void make_texture_desc(const SkImageInfo& info, GrSurfaceDesc* desc) {
- desc->fFlags = kNone_GrSurfaceFlags;
- desc->fWidth = info.width();
- desc->fHeight = info.height();
- desc->fConfig = SkImageInfo2GrPixelConfig(info);
- desc->fSampleCnt = 0;
-}
static GrTexture* load_compressed_into_texture(GrContext* ctx, SkData* data, GrSurfaceDesc desc) {
const void* rawStart;
@@ -229,9 +222,6 @@ GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, SkImageUsageType usa
GrMakeKeyFromImageID(&key, fUniqueID, SkIRect::MakeWH(fInfo.width(), fInfo.height()),
*ctx->caps(), usage);
- GrSurfaceDesc desc;
- make_texture_desc(fInfo, &desc);
-
// 1. Check the cache for a pre-existing one
if (GrTexture* tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(key)) {
return tex;
@@ -246,6 +236,8 @@ GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, SkImageUsageType usa
}
}
+ const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo);
+
// 3. Ask the generator to return a compressed form that the GPU might support
SkAutoTUnref<SkData> data(this->refEncoded());
if (data) {
« no previous file with comments | « include/gpu/SkGr.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698