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

Side by Side Diff: gm/gm.cpp

Issue 23567032: Have GMs read the GrContext via a setter/getter rather than a global. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: initialize fGr to NULL Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/gm.h ('k') | gm/gmmain.cpp » ('j') | gm/gmmain.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 using namespace skiagm; 9 using namespace skiagm;
10 10
11 SkString GM::gResourcePath; 11 SkString GM::gResourcePath;
12 12
13 GM::GM() { 13 GM::GM() {
14 fBGColor = SK_ColorWHITE; 14 fBGColor = SK_ColorWHITE;
15 fCanvasIsDeferred = false; 15 fCanvasIsDeferred = false;
16 fHaveCalledOnceBeforeDraw = false; 16 fHaveCalledOnceBeforeDraw = false;
17 #if SK_SUPPORT_GPU
18 fGr = NULL;
19 #endif
17 } 20 }
18 GM::~GM() {} 21 GM::~GM() {}
19 22
20 void GM::draw(SkCanvas* canvas) { 23 void GM::draw(SkCanvas* canvas) {
21 this->drawBackground(canvas); 24 this->drawBackground(canvas);
22 this->drawContent(canvas); 25 this->drawContent(canvas);
23 } 26 }
24 27
25 void GM::drawContent(SkCanvas* canvas) { 28 void GM::drawContent(SkCanvas* canvas) {
26 if (!fHaveCalledOnceBeforeDraw) { 29 if (!fHaveCalledOnceBeforeDraw) {
(...skipping 30 matching lines...) Expand all
57 SkISize size = this->getISize(); 60 SkISize size = this->getISize();
58 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), 61 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()),
59 SkIntToScalar(size.height())); 62 SkIntToScalar(size.height()));
60 SkPaint paint; 63 SkPaint paint;
61 paint.setColor(color); 64 paint.setColor(color);
62 canvas->drawRect(r, paint); 65 canvas->drawRect(r, paint);
63 } 66 }
64 67
65 // need to explicitly declare this, or we get some weird infinite loop llist 68 // need to explicitly declare this, or we get some weird infinite loop llist
66 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead; 69 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead;
OLDNEW
« no previous file with comments | « gm/gm.h ('k') | gm/gmmain.cpp » ('j') | gm/gmmain.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698