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

Side by Side Diff: gm/image.cpp

Issue 15986004: Revert "Add path utils, plus a test for it." (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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/gmmain.cpp ('k') | gyp/tests.gyp » ('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 * 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 #include "SkSurface.h" 9 #include "SkSurface.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 13 matching lines...) Expand all
24 if (!stream.isValid()) { 24 if (!stream.isValid()) {
25 return SkData::NewEmpty(); 25 return SkData::NewEmpty();
26 } 26 }
27 size_t size = stream.getLength(); 27 size_t size = stream.getLength();
28 void* mem = sk_malloc_throw(size); 28 void* mem = sk_malloc_throw(size);
29 stream.read(mem, size); 29 stream.read(mem, size);
30 return SkData::NewFromMalloc(mem, size); 30 return SkData::NewFromMalloc(mem, size);
31 } 31 }
32 32
33 static void drawJpeg(SkCanvas* canvas, const SkISize& size) { 33 static void drawJpeg(SkCanvas* canvas, const SkISize& size) {
34 // TODO: Make this draw a file that is checked in, so it can
35 // be exercised on machines other than mike's. Will require a
36 // rebaseline.
37 SkAutoDataUnref data(fileToData("/Users/mike/Downloads/skia.google.jpeg")); 34 SkAutoDataUnref data(fileToData("/Users/mike/Downloads/skia.google.jpeg"));
38 SkImage* image = SkImage::NewEncodedData(data); 35 SkImage* image = SkImage::NewEncodedData(data);
39 if (image) { 36 if (image) {
40 SkAutoCanvasRestore acr(canvas, true); 37 SkAutoCanvasRestore acr(canvas, true);
41 canvas->scale(size.width() * 1.0f / image->width(), 38 canvas->scale(size.width() * 1.0f / image->width(),
42 size.height() * 1.0f / image->height()); 39 size.height() * 1.0f / image->height());
43 image->draw(canvas,0, 0, NULL); 40 image->draw(canvas,0, 0, NULL);
44 image->unref(); 41 image->unref();
45 } 42 }
46 } 43 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 185 }
189 186
190 private: 187 private:
191 typedef skiagm::GM INHERITED; 188 typedef skiagm::GM INHERITED;
192 }; 189 };
193 190
194 ////////////////////////////////////////////////////////////////////////////// 191 //////////////////////////////////////////////////////////////////////////////
195 192
196 static skiagm::GM* MyFactory(void*) { return new ImageGM; } 193 static skiagm::GM* MyFactory(void*) { return new ImageGM; }
197 static skiagm::GMRegistry reg(MyFactory); 194 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/gmmain.cpp ('k') | gyp/tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698