OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkGScalerContext.h" | 8 #include "SkGScalerContext.h" |
9 #include "SkGlyph.h" | 9 #include "SkGlyph.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 glyph->fHeight = ibounds.height(); | 112 glyph->fHeight = ibounds.height(); |
113 glyph->fMaskFormat = SkMask::kARGB32_Format; | 113 glyph->fMaskFormat = SkMask::kARGB32_Format; |
114 } | 114 } |
115 | 115 |
116 void SkGScalerContext::generateImage(const SkGlyph& glyph) { | 116 void SkGScalerContext::generateImage(const SkGlyph& glyph) { |
117 if (SkMask::kARGB32_Format == glyph.fMaskFormat) { | 117 if (SkMask::kARGB32_Format == glyph.fMaskFormat) { |
118 SkPath path; | 118 SkPath path; |
119 fProxy->getPath(glyph, &path); | 119 fProxy->getPath(glyph, &path); |
120 | 120 |
121 SkBitmap bm; | 121 SkBitmap bm; |
122 bm.setConfig(SkBitmap::kARGB_8888_Config, glyph.fWidth, glyph.fHeight, | 122 bm.installPixels(SkImageInfo::MakeN32Premul(glyph.fWidth, glyph.fHeight)
, |
123 glyph.rowBytes()); | 123 glyph.fImage, glyph.rowBytes()); |
124 bm.setPixels(glyph.fImage); | |
125 bm.eraseColor(0); | 124 bm.eraseColor(0); |
126 | 125 |
127 SkCanvas canvas(bm); | 126 SkCanvas canvas(bm); |
128 canvas.translate(-SkIntToScalar(glyph.fLeft), | 127 canvas.translate(-SkIntToScalar(glyph.fLeft), |
129 -SkIntToScalar(glyph.fTop)); | 128 -SkIntToScalar(glyph.fTop)); |
130 canvas.concat(fMatrix); | 129 canvas.concat(fMatrix); |
131 canvas.drawPath(path, fFace->paint()); | 130 canvas.drawPath(path, fFace->paint()); |
132 } else { | 131 } else { |
133 fProxy->getImage(glyph); | 132 fProxy->getImage(glyph); |
134 } | 133 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 255 |
257 friend class SkGFontBuilder; | 256 friend class SkGFontBuilder; |
258 SkGFont(int count, Glyph* array); | 257 SkGFont(int count, Glyph* array); |
259 }; | 258 }; |
260 | 259 |
261 class SkGFontBuilder { | 260 class SkGFontBuilder { |
262 public: | 261 public: |
263 | 262 |
264 }; | 263 }; |
265 #endif | 264 #endif |
OLD | NEW |