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

Side by Side Diff: gm/copyTo4444.cpp

Issue 1806383002: Revert of Remove uses of SkImageDecoder from gms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « gm/cmykjpeg.cpp ('k') | gm/downsamplebitmap.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 14 matching lines...) Expand all
25 virtual SkString onShortName() { 25 virtual SkString onShortName() {
26 return SkString("copyTo4444"); 26 return SkString("copyTo4444");
27 } 27 }
28 28
29 virtual SkISize onISize() { 29 virtual SkISize onISize() {
30 return SkISize::Make(1024, 512); 30 return SkISize::Make(1024, 512);
31 } 31 }
32 32
33 virtual void onDraw(SkCanvas* canvas) { 33 virtual void onDraw(SkCanvas* canvas) {
34 SkBitmap bm, bm4444; 34 SkBitmap bm, bm4444;
35 if (!GetResourceAsBitmap("mandrill_512.png", &bm)) { 35 SkString pngFilename = GetResourcePath("mandrill_512.png");
36 if (!SkImageDecoder::DecodeFile(pngFilename.c_str(), &bm, kN32_SkColorTy pe,
37 SkImageDecoder::kDecodePixels_Mode)) {
36 SkDebugf("Could not decode the file. Did you forget to set the " 38 SkDebugf("Could not decode the file. Did you forget to set the "
37 "resourcePath?\n"); 39 "resourcePath?\n");
38 return; 40 return;
39 } 41 }
40 canvas->drawBitmap(bm, 0, 0); 42 canvas->drawBitmap(bm, 0, 0);
41 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType)); 43 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType));
42 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0); 44 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
43 } 45 }
44 46
45 private: 47 private:
46 typedef GM INHERITED; 48 typedef GM INHERITED;
47 }; 49 };
48 50
49 ////////////////////////////////////////////////////////////////////////////// 51 //////////////////////////////////////////////////////////////////////////////
50 52
51 static GM* MyFactory(void*) { return new CopyTo4444GM; } 53 static GM* MyFactory(void*) { return new CopyTo4444GM; }
52 static GMRegistry reg(MyFactory); 54 static GMRegistry reg(MyFactory);
53 55
54 } 56 }
OLDNEW
« no previous file with comments | « gm/cmykjpeg.cpp ('k') | gm/downsamplebitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698