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

Side by Side Diff: gm/copyTo4444.cpp

Issue 1791583002: 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
msarett 2016/03/11 20:53:09 Pretty sure we don't support drawing into 4444?
scroggo 2016/03/17 13:05:48 We don't support *drawing* into 4444, but we do su
msarett 2016/03/17 13:53:38 Gotcha adding this back in.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm.h"
9
10 #include "Resources.h"
11 #include "SkCanvas.h"
12 #include "SkImageDecoder.h"
13 #include "SkOSFile.h"
14
15 namespace skiagm {
16
17 /**
18 * Test copying an image from 8888 to 4444.
19 */
20 class CopyTo4444GM : public GM {
21 public:
22 CopyTo4444GM() {}
23
24 protected:
25 virtual SkString onShortName() {
26 return SkString("copyTo4444");
27 }
28
29 virtual SkISize onISize() {
30 return SkISize::Make(1024, 512);
31 }
32
33 virtual void onDraw(SkCanvas* canvas) {
34 SkBitmap bm, bm4444;
35 SkString pngFilename = GetResourcePath("mandrill_512.png");
36 if (!SkImageDecoder::DecodeFile(pngFilename.c_str(), &bm, kN32_SkColorTy pe,
37 SkImageDecoder::kDecodePixels_Mode)) {
38 SkDebugf("Could not decode the file. Did you forget to set the "
39 "resourcePath?\n");
40 return;
41 }
42 canvas->drawBitmap(bm, 0, 0);
43 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType));
44 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
45 }
46
47 private:
48 typedef GM INHERITED;
49 };
50
51 //////////////////////////////////////////////////////////////////////////////
52
53 static GM* MyFactory(void*) { return new CopyTo4444GM; }
54 static GMRegistry reg(MyFactory);
55
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698