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

Side by Side Diff: samplecode/SampleTiling.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 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
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/core/SkBBoxHierarchyRecord.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 SkScalar y = SkIntToScalar(24); 96 SkScalar y = SkIntToScalar(24);
97 SkScalar x = SkIntToScalar(10); 97 SkScalar x = SkIntToScalar(10);
98 98
99 SkPictureRecorder recorder; 99 SkPictureRecorder recorder;
100 SkCanvas* textCanvas = NULL; 100 SkCanvas* textCanvas = NULL;
101 if (NULL == fTextPicture) { 101 if (NULL == fTextPicture) {
102 textCanvas = recorder.beginRecording(1000, 1000, NULL, 0); 102 textCanvas = recorder.beginRecording(1000, 1000, NULL, 0);
103 } 103 }
104 104
105 if (NULL != textCanvas) { 105 if (textCanvas) {
106 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { 106 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
107 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { 107 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
108 SkPaint p; 108 SkPaint p;
109 SkString str; 109 SkString str;
110 p.setAntiAlias(true); 110 p.setAntiAlias(true);
111 p.setDither(true); 111 p.setDither(true);
112 p.setLooper(fLooper); 112 p.setLooper(fLooper);
113 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]); 113 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]);
114 114
115 p.setTextAlign(SkPaint::kCenter_Align); 115 p.setTextAlign(SkPaint::kCenter_Align);
(...skipping 16 matching lines...) Expand all
132 paint.setDither(true); 132 paint.setDither(true);
133 133
134 canvas->save(); 134 canvas->save();
135 canvas->translate(x, y); 135 canvas->translate(x, y);
136 canvas->drawRect(r, paint); 136 canvas->drawRect(r, paint);
137 canvas->restore(); 137 canvas->restore();
138 138
139 x += r.width() * 4 / 3; 139 x += r.width() * 4 / 3;
140 } 140 }
141 } 141 }
142 if (NULL != textCanvas) { 142 if (textCanvas) {
143 SkPaint p; 143 SkPaint p;
144 SkString str; 144 SkString str;
145 p.setAntiAlias(true); 145 p.setAntiAlias(true);
146 p.setLooper(fLooper); 146 p.setLooper(fLooper);
147 str.printf("%s, %s", gConfigNames[i], gFilterNames[j]); 147 str.printf("%s, %s", gConfigNames[i], gFilterNames[j]);
148 textCanvas->drawText(str.c_str(), str.size(), x, y + r.heigh t() * 2 / 3, p); 148 textCanvas->drawText(str.c_str(), str.size(), x, y + r.heigh t() * 2 / 3, p);
149 } 149 }
150 150
151 y += r.height() * 4 / 3; 151 y += r.height() * 4 / 3;
152 } 152 }
153 } 153 }
154 154
155 if (NULL != textCanvas) { 155 if (textCanvas) {
156 SkASSERT(NULL == fTextPicture); 156 SkASSERT(NULL == fTextPicture);
157 fTextPicture.reset(recorder.endRecording()); 157 fTextPicture.reset(recorder.endRecording());
158 } 158 }
159 159
160 SkASSERT(NULL != fTextPicture); 160 SkASSERT(fTextPicture);
161 canvas->drawPicture(fTextPicture); 161 canvas->drawPicture(fTextPicture);
162 } 162 }
163 163
164 private: 164 private:
165 typedef SampleView INHERITED; 165 typedef SampleView INHERITED;
166 }; 166 };
167 167
168 ////////////////////////////////////////////////////////////////////////////// 168 //////////////////////////////////////////////////////////////////////////////
169 169
170 static SkView* MyFactory() { return new TilingView; } 170 static SkView* MyFactory() { return new TilingView; }
171 static SkViewRegister reg(MyFactory); 171 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/core/SkBBoxHierarchyRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698