OLD | NEW |
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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 protected: | 62 protected: |
63 virtual SkString onShortName() SK_OVERRIDE { | 63 virtual SkString onShortName() SK_OVERRIDE { |
64 return SkString("verylargebitmap"); | 64 return SkString("verylargebitmap"); |
65 } | 65 } |
66 | 66 |
67 virtual SkISize onISize() SK_OVERRIDE { | 67 virtual SkISize onISize() SK_OVERRIDE { |
68 return SkISize::Make(500, 600); | 68 return SkISize::Make(500, 600); |
69 } | 69 } |
70 | 70 |
71 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 71 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
72 int veryBig = 70*1024; // 64K < size | 72 int veryBig = 65*1024; // 64K < size |
73 int big = 60*1024; // 32K < size < 64K | 73 int big = 33*1024; // 32K < size < 64K |
74 // smaller than many max texture sizes, but large enough to gpu-tile for
memory reasons. | 74 // smaller than many max texture sizes, but large enough to gpu-tile for
memory reasons. |
75 int medium = 7*1024; | 75 int medium = 5*1024; |
76 int small = 150; | 76 int small = 150; |
77 | 77 |
78 SkColor colors[2]; | 78 SkColor colors[2]; |
79 | 79 |
80 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); | 80 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); |
81 colors[0] = SK_ColorRED; | 81 colors[0] = SK_ColorRED; |
82 colors[1] = SK_ColorGREEN; | 82 colors[1] = SK_ColorGREEN; |
83 show_bm(canvas, small, small, colors); | 83 show_bm(canvas, small, small, colors); |
84 canvas->translate(0, SkIntToScalar(150)); | 84 canvas->translate(0, SkIntToScalar(150)); |
85 | 85 |
86 colors[0] = SK_ColorBLUE; | 86 colors[0] = SK_ColorBLUE; |
87 colors[1] = SK_ColorMAGENTA; | 87 colors[1] = SK_ColorMAGENTA; |
88 show_bm(canvas, big, small, colors); | 88 show_bm(canvas, big, small, colors); |
89 canvas->translate(0, SkIntToScalar(150)); | 89 canvas->translate(0, SkIntToScalar(150)); |
90 | 90 |
91 colors[0] = SK_ColorMAGENTA; | 91 colors[0] = SK_ColorMAGENTA; |
92 colors[1] = SK_ColorYELLOW; | 92 colors[1] = SK_ColorYELLOW; |
93 // as of this writing, the raster code will fail to draw the scaled vers
ion | |
94 // since it has a 64K limit on x,y coordinates... (but gpu should succee
d) | |
95 show_bm(canvas, medium, medium, colors); | 93 show_bm(canvas, medium, medium, colors); |
96 canvas->translate(0, SkIntToScalar(150)); | 94 canvas->translate(0, SkIntToScalar(150)); |
97 | 95 |
98 colors[0] = SK_ColorGREEN; | 96 colors[0] = SK_ColorGREEN; |
99 colors[1] = SK_ColorYELLOW; | 97 colors[1] = SK_ColorYELLOW; |
100 // as of this writing, the raster code will fail to draw the scaled vers
ion | 98 // as of this writing, the raster code will fail to draw the scaled vers
ion |
101 // since it has a 64K limit on x,y coordinates... (but gpu should succee
d) | 99 // since it has a 64K limit on x,y coordinates... (but gpu should succee
d) |
102 show_bm(canvas, veryBig, small, colors); | 100 show_bm(canvas, veryBig, small, colors); |
103 } | 101 } |
104 | 102 |
105 private: | 103 private: |
106 typedef skiagm::GM INHERITED; | 104 typedef skiagm::GM INHERITED; |
107 }; | 105 }; |
108 | 106 |
109 ////////////////////////////////////////////////////////////////////////////// | 107 ////////////////////////////////////////////////////////////////////////////// |
110 | 108 |
111 // This GM allocates more memory than Android devices are capable of fulfilling. | 109 // This GM allocates more memory than Android devices are capable of fulfilling. |
112 #ifndef SK_BUILD_FOR_ANDROID | 110 #ifndef SK_BUILD_FOR_ANDROID |
113 static skiagm::GM* MyFactory(void*) { return new VeryLargeBitmapGM; } | 111 static skiagm::GM* MyFactory(void*) { return new VeryLargeBitmapGM; } |
114 static skiagm::GMRegistry reg(MyFactory); | 112 static skiagm::GMRegistry reg(MyFactory); |
115 #endif | 113 #endif |
OLD | NEW |