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

Unified Diff: src/gpu/GrTest.cpp

Issue 1441533003: Update testing frameworks/tests for MDB (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix ref counting bug Created 5 years, 1 month 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/gpu/GrTest.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTest.cpp
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 6e9df211fa93c4e8abcee595c37b9f5aa13f3a63..f6ece6c79e0270af25f48cd4fbda3f0e55833ccd 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -44,11 +44,12 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
}
};
-void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
+void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, GrRenderTarget* rt) {
SkASSERT(!fContext);
fContext.reset(SkRef(ctx));
fDrawTarget.reset(SkRef(target));
+ fRenderTarget.reset(SkRef(rt));
}
void GrContext::getTestTarget(GrTestTarget* tar) {
@@ -57,8 +58,22 @@ void GrContext::getTestTarget(GrTestTarget* tar) {
// then disconnects. This would help prevent test writers from mixing using the returned
// GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
// until ~GrTestTarget().
- SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(nullptr));
- tar->init(this, dt);
+ GrSurfaceDesc desc;
+ desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fWidth = 32;
+ desc.fHeight = 32;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
+ desc.fSampleCnt = 0;
+
+ SkAutoTUnref<GrTexture> texture(this->textureProvider()->createTexture(desc, false, nullptr, 0));
+ if (nullptr == texture) {
+ return;
+ }
+ SkASSERT(nullptr != texture->asRenderTarget());
+ GrRenderTarget* rt = texture->asRenderTarget();
+
+ SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(rt));
+ tar->init(this, dt, rt);
}
void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {
« no previous file with comments | « src/gpu/GrTest.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698