Fix text-as-path with skshader on gpu
Review URL: http://codereview.appspot.com/4576057/
git-svn-id: http://skia.googlecode.com/svn/trunk@1575 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 37c3ee3..bd9eba0 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -26,6 +26,10 @@
class Iter {
public:
Iter() {
+ this->reset();
+ }
+
+ void reset() {
fReg = GMRegistry::Head();
}
@@ -475,15 +479,22 @@
return -1;
}
+ int maxW = -1;
+ int maxH = -1;
+ Iter iter;
+ GM* gm;
+ while ((gm = iter.next()) != NULL) {
+ SkISize size = gm->getISize();
+ maxW = SkMax32(size.width(), maxW);
+ maxH = SkMax32(size.height(), maxH);
+ }
// setup a GL context for drawing offscreen
GrContext* context = NULL;
SkEGLContext eglContext;
- if (eglContext.init(1024, 1024)) {
+ if (eglContext.init(maxW, maxH)) {
context = GrContext::CreateGLShaderContext();
}
- Iter iter;
- GM* gm;
if (readPath) {
fprintf(stderr, "reading from %s\n", readPath);
@@ -493,6 +504,7 @@
// Accumulate success of all tests so we can flag error in any
// one with the return value.
+ iter.reset();
bool overallSuccess = true;
while ((gm = iter.next()) != NULL) {
SkISize size = gm->getISize();