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

Side by Side Diff: gm/etc1bitmap.cpp

Issue 303273008: Revert of Initial work to get ETC1 data up to the GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | gyp/gpu.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 2014 Google Inc. 2 * Copyright 2014 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h"
11 #include "SkDecodingImageGenerator.h"
12 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
13 #include "SkOSFile.h" 11 #include "SkOSFile.h"
14 12
15 namespace skiagm { 13 namespace skiagm {
16 14
17 /** 15 /**
18 * Test decoding an image from a PKM file and then 16 * Test decoding an image from a PKM file and then
19 * from compressed ETC1 data. 17 * from compressed ETC1 data.
20 */ 18 */
21 class ETC1BitmapGM : public GM { 19 class ETC1BitmapGM : public GM {
22 public: 20 public:
23 ETC1BitmapGM() { } 21 ETC1BitmapGM() { }
24 virtual ~ETC1BitmapGM() { } 22 virtual ~ETC1BitmapGM() { }
25 23
26 protected: 24 protected:
27 virtual SkString onShortName() SK_OVERRIDE { 25 virtual SkString onShortName() SK_OVERRIDE {
28 return SkString("etc1bitmap"); 26 return SkString("etc1bitmap");
29 } 27 }
30 28
31 virtual SkISize onISize() SK_OVERRIDE { 29 virtual SkISize onISize() SK_OVERRIDE {
32 return make_isize(512, 512); 30 return make_isize(512, 512);
33 } 31 }
34 32
35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 33 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
36 34
37 SkBitmap bm; 35 SkBitmap bm;
38 SkString filename = SkOSPath::SkPathJoin( 36 SkString filename = SkOSPath::SkPathJoin(
39 INHERITED::gResourcePath.c_str(), "mandrill_512.pkm"); 37 INHERITED::gResourcePath.c_str(), "mandrill_512.pkm");
40 38 if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm,
41 SkData *fileData = SkData::NewFromFileName(filename.c_str()); 39 SkBitmap::kARGB_8888_Config,
42 if (NULL == fileData) { 40 SkImageDecoder::kDecodePixels_Mode)) {
43 SkDebugf("Could not open the file. Did you forget to set the resourc ePath?\n"); 41 SkDebugf("Could not decode the file. Did you forget to set the "
42 "resourcePath?\n");
44 return; 43 return;
45 } 44 }
46
47 if (!SkInstallDiscardablePixelRef(
48 SkDecodingImageGenerator::Create(
49 fileData, SkDecodingImageGenerator::Options()), &bm)) {
50 SkDebugf("Could not install discardable pixel ref.\n");
51 return;
52 }
53
54 canvas->drawBitmap(bm, 0, 0); 45 canvas->drawBitmap(bm, 0, 0);
55 } 46 }
56 47
57 private: 48 private:
58 typedef GM INHERITED; 49 typedef GM INHERITED;
59 }; 50 };
60 51
61 } // namespace skiagm 52 } // namespace skiagm
62 53
63 ////////////////////////////////////////////////////////////////////////////// 54 //////////////////////////////////////////////////////////////////////////////
64 55
65 DEF_GM( return SkNEW(skiagm::ETC1BitmapGM); ) 56 DEF_GM( return SkNEW(skiagm::ETC1BitmapGM); )
OLDNEW
« no previous file with comments | « no previous file | gyp/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698