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

Side by Side Diff: gm/factory.cpp

Issue 1997703003: Make SkPngCodec decode progressively. (Closed) Base URL: https://skia.googlesource.com/skia.git@foil
Patch Set: Rebase Created 4 years, 3 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 | « fuzz/fuzz.cpp ('k') | include/codec/SkCodec.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 17 matching lines...) Expand all
28 protected: 28 protected:
29 void onOnceBeforeDraw() override { 29 void onOnceBeforeDraw() override {
30 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl ane-by-ddoo 30 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl ane-by-ddoo
31 SkString pngFilename = GetResourcePath("plane.png"); 31 SkString pngFilename = GetResourcePath("plane.png");
32 sk_sp<SkData> data(SkData::MakeFromFileName(pngFilename.c_str())); 32 sk_sp<SkData> data(SkData::MakeFromFileName(pngFilename.c_str()));
33 if (data) { 33 if (data) {
34 // Create a cache which will boot the pixels out anytime the 34 // Create a cache which will boot the pixels out anytime the
35 // bitmap is unlocked. 35 // bitmap is unlocked.
36 SkAutoTUnref<SkDiscardableMemoryPool> pool( 36 SkAutoTUnref<SkDiscardableMemoryPool> pool(
37 SkDiscardableMemoryPool::Create(1)); 37 SkDiscardableMemoryPool::Create(1));
38 SkAssertResult(SkDEPRECATED_InstallDiscardablePixelRef( 38 SkDEPRECATED_InstallDiscardablePixelRef(SkImageGenerator::NewFromEnc oded(data.get()),
39 SkImageGenerator::NewFrom Encoded(data.get()), 39 nullptr, &fBitmap, pool);
40 nullptr, &fBitmap, pool)) ;
41 } 40 }
42 } 41 }
43 42
44 SkString onShortName() override { 43 SkString onShortName() override {
45 return SkString("factory"); 44 return SkString("factory");
46 } 45 }
47 46
48 SkISize onISize() override { 47 SkISize onISize() override {
49 return SkISize::Make(640, 480); 48 return SkISize::Make(640, 480);
50 } 49 }
51 50
52 void onDraw(SkCanvas* canvas) override { 51 void onDraw(SkCanvas* canvas) override {
53 canvas->drawBitmap(fBitmap, 0, 0); 52 canvas->drawBitmap(fBitmap, 0, 0);
54 } 53 }
55 54
56 private: 55 private:
57 SkBitmap fBitmap; 56 SkBitmap fBitmap;
58 57
59 typedef GM INHERITED; 58 typedef GM INHERITED;
60 }; 59 };
61 60
62 ////////////////////////////////////////////////////////////////////////////// 61 //////////////////////////////////////////////////////////////////////////////
63 62
64 static GM* MyFactory(void*) { return new FactoryGM; } 63 static GM* MyFactory(void*) { return new FactoryGM; }
65 static GMRegistry reg(MyFactory); 64 static GMRegistry reg(MyFactory);
66 65
67 } // namespace skiagm 66 } // namespace skiagm
OLDNEW
« no previous file with comments | « fuzz/fuzz.cpp ('k') | include/codec/SkCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698