aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-01-16 07:32:33 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-16 07:32:33 -0800
commitafe3005be3392e43bc51eb7eb2017eefaed85ad1 (patch)
tree3b96ec2e3249a928a0e876140bec3bf3e9dbb13f /tools
parentb50ced703030dfbda4fc3ef5e6ec9a52fc0405f8 (diff)
Require budget decision when creating a RenderTarget SkSurface.
Restructure SkGpuDevice creation: *SkSurfaceProps are optional. *Use SkSurfaceProps to communicate DF text rather than a flag. *Tell SkGpuDevice::Create whether RT comes from cache or not. Review URL: https://codereview.chromium.org/848903004
Diffstat (limited to 'tools')
-rw-r--r--tools/PictureRenderer.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 0d7e14c794..dc672f013b 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -157,16 +157,14 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
desc.fSampleCnt = fSampleCount;
target.reset(fGrContext->createUncachedTexture(desc, NULL, 0));
}
- if (NULL == target.get()) {
- SkASSERT(0);
+
+ uint32_t flags = fUseDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
+ SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(target->asRenderTarget(), &props));
+ if (!device) {
return NULL;
}
-
- uint32_t flags = fUseDFText ? SkGpuDevice::kDFText_Flag : 0;
- SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(target,
- SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType),
- flags));
- canvas = SkNEW_ARGS(SkCanvas, (device.get()));
+ canvas = SkNEW_ARGS(SkCanvas, (device));
break;
}
#endif