OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 fMode = mode; | 64 fMode = mode; |
65 fDoFilter = doFilter; | 65 fDoFilter = doFilter; |
66 fDoRotate = doRotate; | 66 fDoRotate = doRotate; |
67 } | 67 } |
68 | 68 |
69 virtual ~GiantBitmapGM() { | 69 virtual ~GiantBitmapGM() { |
70 SkDELETE(fBM); | 70 SkDELETE(fBM); |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 74 uint32_t onGetFlags() const SK_OVERRIDE { |
75 #ifdef SK_BUILD_FOR_ANDROID | 75 #ifdef SK_BUILD_FOR_ANDROID |
76 return kSkipTiled_Flag; | 76 return kSkipTiled_Flag; |
77 #else | 77 #else |
78 if (fDoFilter && fDoRotate && fMode != SkShader::kClamp_TileMode) { | 78 if (fDoFilter && fDoRotate && fMode != SkShader::kClamp_TileMode) { |
79 return kSkipTiled_Flag; | 79 return kSkipTiled_Flag; |
80 } | 80 } |
81 return 0; | 81 return 0; |
82 #endif | 82 #endif |
83 } | 83 } |
84 | 84 |
85 virtual SkString onShortName() SK_OVERRIDE { | 85 SkString onShortName() SK_OVERRIDE { |
86 SkString str("giantbitmap_"); | 86 SkString str("giantbitmap_"); |
87 switch (fMode) { | 87 switch (fMode) { |
88 case SkShader::kClamp_TileMode: | 88 case SkShader::kClamp_TileMode: |
89 str.append("clamp"); | 89 str.append("clamp"); |
90 break; | 90 break; |
91 case SkShader::kRepeat_TileMode: | 91 case SkShader::kRepeat_TileMode: |
92 str.append("repeat"); | 92 str.append("repeat"); |
93 break; | 93 break; |
94 case SkShader::kMirror_TileMode: | 94 case SkShader::kMirror_TileMode: |
95 str.append("mirror"); | 95 str.append("mirror"); |
96 break; | 96 break; |
97 default: | 97 default: |
98 break; | 98 break; |
99 } | 99 } |
100 str.append(fDoFilter ? "_bilerp" : "_point"); | 100 str.append(fDoFilter ? "_bilerp" : "_point"); |
101 str.append(fDoRotate ? "_rotate" : "_scale"); | 101 str.append(fDoRotate ? "_rotate" : "_scale"); |
102 return str; | 102 return str; |
103 } | 103 } |
104 | 104 |
105 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 480); } | 105 SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 480); } |
106 | 106 |
107 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 107 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
108 SkPaint paint; | 108 SkPaint paint; |
109 | 109 |
110 SkMatrix m; | 110 SkMatrix m; |
111 if (fDoRotate) { | 111 if (fDoRotate) { |
112 // m.setRotate(SkIntToScalar(30), 0, 0); | 112 // m.setRotate(SkIntToScalar(30), 0, 0); |
113 m.setSkew(SK_Scalar1, 0, 0, 0); | 113 m.setSkew(SK_Scalar1, 0, 0, 0); |
114 // m.postScale(2*SK_Scalar1/3, 2*SK_Scalar1/3); | 114 // m.postScale(2*SK_Scalar1/3, 2*SK_Scalar1/3); |
115 } else { | 115 } else { |
116 SkScalar scale = 11*SK_Scalar1/12; | 116 SkScalar scale = 11*SK_Scalar1/12; |
117 m.setScale(scale, scale); | 117 m.setScale(scale, scale); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 static skiagm::GMRegistry reg010(G010); | 154 static skiagm::GMRegistry reg010(G010); |
155 static skiagm::GMRegistry reg110(G110); | 155 static skiagm::GMRegistry reg110(G110); |
156 static skiagm::GMRegistry reg210(G210); | 156 static skiagm::GMRegistry reg210(G210); |
157 | 157 |
158 static skiagm::GMRegistry reg001(G001); | 158 static skiagm::GMRegistry reg001(G001); |
159 static skiagm::GMRegistry reg101(G101); | 159 static skiagm::GMRegistry reg101(G101); |
160 static skiagm::GMRegistry reg201(G201); | 160 static skiagm::GMRegistry reg201(G201); |
161 static skiagm::GMRegistry reg011(G011); | 161 static skiagm::GMRegistry reg011(G011); |
162 static skiagm::GMRegistry reg111(G111); | 162 static skiagm::GMRegistry reg111(G111); |
163 static skiagm::GMRegistry reg211(G211); | 163 static skiagm::GMRegistry reg211(G211); |
OLD | NEW |