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

Side by Side Diff: gm/verylargebitmap.cpp

Issue 19217002: Reduce verylargebitmap GMs memory footprint (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 | « no previous file | no next file » | 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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 protected: 53 protected:
54 virtual SkString onShortName() SK_OVERRIDE { 54 virtual SkString onShortName() SK_OVERRIDE {
55 return SkString("verylargebitmap"); 55 return SkString("verylargebitmap");
56 } 56 }
57 57
58 virtual SkISize onISize() SK_OVERRIDE { 58 virtual SkISize onISize() SK_OVERRIDE {
59 return SkISize::Make(640, 480); 59 return SkISize::Make(640, 480);
60 } 60 }
61 61
62 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 62 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
63 int veryBig = 100*1024; // 64K < size 63 int veryBig = 70*1024; // 64K < size
64 int big = 60*1024; // 32K < size < 64K 64 int big = 60*1024; // 32K < size < 64K
65 int small = 300; 65 int small = 150;
66 66
67 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); 67 canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
68 show_bm(canvas, small, small, SK_ColorRED); 68 show_bm(canvas, small, small, SK_ColorRED);
69 canvas->translate(0, SkIntToScalar(150)); 69 canvas->translate(0, SkIntToScalar(150));
70 70
71 show_bm(canvas, big, small, SK_ColorBLUE); 71 show_bm(canvas, big, small, SK_ColorBLUE);
72 canvas->translate(0, SkIntToScalar(150)); 72 canvas->translate(0, SkIntToScalar(150));
73 73
74 // as of this writing, the raster code will fail to draw the scaled vers ion 74 // as of this writing, the raster code will fail to draw the scaled vers ion
75 // since it has a 64K limit on x,y coordinates... (but gpu should succee d) 75 // since it has a 64K limit on x,y coordinates... (but gpu should succee d)
76 show_bm(canvas, veryBig, small, SK_ColorGREEN); 76 show_bm(canvas, veryBig, small, SK_ColorGREEN);
77 } 77 }
78 78
79 private: 79 private:
80 typedef skiagm::GM INHERITED; 80 typedef skiagm::GM INHERITED;
81 }; 81 };
82 82
83 ////////////////////////////////////////////////////////////////////////////// 83 //////////////////////////////////////////////////////////////////////////////
84 84
85 // This GM allocates more memory than Android devices are capable of fulfilling. 85 // This GM allocates more memory than Android devices are capable of fulfilling.
86 #ifndef SK_BUILD_FOR_ANDROID 86 #ifndef SK_BUILD_FOR_ANDROID
87 static skiagm::GM* MyFactory(void*) { return new VeryLargeBitmapGM; } 87 static skiagm::GM* MyFactory(void*) { return new VeryLargeBitmapGM; }
88 static skiagm::GMRegistry reg(MyFactory); 88 static skiagm::GMRegistry reg(MyFactory);
89 #endif 89 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698