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

Side by Side Diff: samplecode/SampleEncode.cpp

Issue 147683003: fix more 64bit warnings (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « samplecode/SampleComplexClip.cpp ('k') | samplecode/SampleHairline.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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 ".jpg", ".png" 105 ".jpg", ".png"
106 }; 106 };
107 107
108 #include <sys/stat.h> 108 #include <sys/stat.h>
109 109
110 class EncodeView : public SampleView { 110 class EncodeView : public SampleView {
111 public: 111 public:
112 SkBitmap* fBitmaps; 112 SkBitmap* fBitmaps;
113 SkAutoDataUnref* fEncodedPNGs; 113 SkAutoDataUnref* fEncodedPNGs;
114 SkAutoDataUnref* fEncodedJPEGs; 114 SkAutoDataUnref* fEncodedJPEGs;
115 size_t fBitmapCount; 115 int fBitmapCount;
116 116
117 EncodeView() { 117 EncodeView() {
118 #if 1 118 #if 1
119 fBitmapCount = SK_ARRAY_COUNT(gConfigs); 119 fBitmapCount = SK_ARRAY_COUNT(gConfigs);
120 fBitmaps = new SkBitmap[fBitmapCount]; 120 fBitmaps = new SkBitmap[fBitmapCount];
121 fEncodedPNGs = new SkAutoDataUnref[fBitmapCount]; 121 fEncodedPNGs = new SkAutoDataUnref[fBitmapCount];
122 fEncodedJPEGs = new SkAutoDataUnref[fBitmapCount]; 122 fEncodedJPEGs = new SkAutoDataUnref[fBitmapCount];
123 for (size_t i = 0; i < fBitmapCount; i++) { 123 for (int i = 0; i < fBitmapCount; i++) {
124 make_image(&fBitmaps[i], gConfigs[i], i); 124 make_image(&fBitmaps[i], gConfigs[i], i);
125 125
126 for (size_t j = 0; j < SK_ARRAY_COUNT(gTypes); j++) { 126 for (size_t j = 0; j < SK_ARRAY_COUNT(gTypes); j++) {
127 SkAutoTDelete<SkImageEncoder> codec( 127 SkAutoTDelete<SkImageEncoder> codec(
128 SkImageEncoder::Create(gTypes[j])); 128 SkImageEncoder::Create(gTypes[j]));
129 if (NULL == codec.get()) { 129 if (NULL == codec.get()) {
130 SkDebugf("[%s:%d] failed to encode %s%s\n", 130 SkDebugf("[%s:%d] failed to encode %s%s\n",
131 __FILE__, __LINE__,gConfigLabels[i], gExt[j]); 131 __FILE__, __LINE__,gConfigLabels[i], gExt[j]);
132 continue; 132 continue;
133 } 133 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 SkPaint paint; 175 SkPaint paint;
176 paint.setAntiAlias(true); 176 paint.setAntiAlias(true);
177 paint.setTextAlign(SkPaint::kCenter_Align); 177 paint.setTextAlign(SkPaint::kCenter_Align);
178 178
179 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); 179 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
180 180
181 SkScalar x = 0, y = 0, maxX = 0; 181 SkScalar x = 0, y = 0, maxX = 0;
182 const int SPACER = 10; 182 const int SPACER = 10;
183 183
184 for (size_t i = 0; i < fBitmapCount; i++) { 184 for (int i = 0; i < fBitmapCount; i++) {
185 canvas->drawText(gConfigLabels[i], strlen(gConfigLabels[i]), 185 canvas->drawText(gConfigLabels[i], strlen(gConfigLabels[i]),
186 x + SkIntToScalar(fBitmaps[i].width()) / 2, 0, 186 x + SkIntToScalar(fBitmaps[i].width()) / 2, 0,
187 paint); 187 paint);
188 y = paint.getTextSize(); 188 y = paint.getTextSize();
189 189
190 canvas->drawBitmap(fBitmaps[i], x, y); 190 canvas->drawBitmap(fBitmaps[i], x, y);
191 191
192 SkScalar yy = y; 192 SkScalar yy = y;
193 for (size_t j = 0; j < SK_ARRAY_COUNT(gTypes); j++) { 193 for (size_t j = 0; j < SK_ARRAY_COUNT(gTypes); j++) {
194 yy += SkIntToScalar(fBitmaps[i].height() + 10); 194 yy += SkIntToScalar(fBitmaps[i].height() + 10);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 236
237 private: 237 private:
238 typedef SampleView INHERITED; 238 typedef SampleView INHERITED;
239 }; 239 };
240 240
241 ////////////////////////////////////////////////////////////////////////////// 241 //////////////////////////////////////////////////////////////////////////////
242 242
243 static SkView* MyFactory() { return new EncodeView; } 243 static SkView* MyFactory() { return new EncodeView; }
244 static SkViewRegister reg(MyFactory); 244 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleComplexClip.cpp ('k') | samplecode/SampleHairline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698