aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text/GrAtlasGlyphCache.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-19 16:59:04 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-20 15:10:18 +0000
commitc949ce9d808dbf7c2db7dc0b85271969ba46b69a (patch)
tree14cce659a0861b970f99d80dbfb69a52975498a3 /src/gpu/text/GrAtlasGlyphCache.cpp
parent4c76c41c981dd7ea95062a1895a6e3415b70bce1 (diff)
Replace some GrSurface:read/writePixels with the GrSurfaceContext equivalent
Change-Id: I7b11a323b0c74ee70f52b1bd8be376fb7188cb19 Reviewed-on: https://skia-review.googlesource.com/7204 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/text/GrAtlasGlyphCache.cpp')
-rw-r--r--src/gpu/text/GrAtlasGlyphCache.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp
index 5b71a072df..315b3c00fa 100644
--- a/src/gpu/text/GrAtlasGlyphCache.cpp
+++ b/src/gpu/text/GrAtlasGlyphCache.cpp
@@ -119,8 +119,11 @@ void GrAtlasGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
* @param filename Full path to desired file
*/
static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char* filename) {
+
+ SkImageInfo ii = SkImageInfo::Make(sProxy->width(), sProxy->height(),
+ kRGBA_8888_SkColorType, kPremul_SkAlphaType);
SkBitmap bm;
- if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(sProxy->width(), sProxy->height()))) {
+ if (!bm.tryAllocPixels(ii)) {
return false;
}
@@ -131,14 +134,7 @@ static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char*
return false;
}
- // TODO: remove this instantiation when readPixels is on SurfaceContext
- GrTexture* tex = sContext->asDeferredTexture()->instantiate(context->textureProvider());
- if (!tex) {
- return false;
- }
-
- bool result = tex->readPixels(0, 0, sProxy->width(), sProxy->height(), kSkia8888_GrPixelConfig,
- bm.getPixels(), bm.rowBytes());
+ bool result = sContext->readPixels(ii, bm.getPixels(), bm.rowBytes(), 0, 0);
if (!result) {
SkDebugf("------ failed to read pixels for %s\n", filename);
return false;