OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 virtual bool onQuery(SkEvent* evt) { | 93 virtual bool onQuery(SkEvent* evt) { |
94 if (SampleCode::TitleQ(*evt)) { | 94 if (SampleCode::TitleQ(*evt)) { |
95 SampleCode::TitleR(evt, "DitherBitmap"); | 95 SampleCode::TitleR(evt, "DitherBitmap"); |
96 return true; | 96 return true; |
97 } | 97 } |
98 return this->INHERITED::onQuery(evt); | 98 return this->INHERITED::onQuery(evt); |
99 } | 99 } |
100 | 100 |
101 static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) { | 101 static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) { |
102 SkAutoLockPixels alp(*bm); // needed for ctable | 102 SkAutoLockPixels alp(*bm); // needed for ctable |
103 bm->setIsOpaque(isOpaque); | 103 bm->setAlphaType(isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); |
104 #if 0 | 104 #if 0 |
105 SkColorTable* ctable = bm->getColorTable(); | 105 SkColorTable* ctable = bm->getColorTable(); |
106 if (ctable) { | 106 if (ctable) { |
107 if (ctable->isOpaque() != isOpaque) { | 107 if (ctable->isOpaque() != isOpaque) { |
108 // how do we change a colortable? don't want to | 108 // how do we change a colortable? don't want to |
109 } | 109 } |
110 } | 110 } |
111 #endif | 111 #endif |
112 } | 112 } |
113 | 113 |
(...skipping 27 matching lines...) Expand all Loading... |
141 } | 141 } |
142 | 142 |
143 private: | 143 private: |
144 typedef SampleView INHERITED; | 144 typedef SampleView INHERITED; |
145 }; | 145 }; |
146 | 146 |
147 ////////////////////////////////////////////////////////////////////////////// | 147 ////////////////////////////////////////////////////////////////////////////// |
148 | 148 |
149 static SkView* MyFactory() { return new DitherBitmapView; } | 149 static SkView* MyFactory() { return new DitherBitmapView; } |
150 static SkViewRegister reg(MyFactory); | 150 static SkViewRegister reg(MyFactory); |
OLD | NEW |