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 "GrDistanceFieldTextContext.h" | 8 #include "GrDistanceFieldTextContext.h" |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 desc.fFlags = kDynamicUpdate_GrTextureFlagBit; | 183 desc.fFlags = kDynamicUpdate_GrTextureFlagBit; |
184 desc.fWidth = width; | 184 desc.fWidth = width; |
185 desc.fHeight = height; | 185 desc.fHeight = height; |
186 desc.fConfig = kAlpha_8_GrPixelConfig; | 186 desc.fConfig = kAlpha_8_GrPixelConfig; |
187 | 187 |
188 *gammaTexture = context->getGpu()->createTexture(desc, NULL, 0); | 188 *gammaTexture = context->getGpu()->createTexture(desc, NULL, 0); |
189 if (NULL == *gammaTexture) { | 189 if (NULL == *gammaTexture) { |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 context->writeTexturePixels(*gammaTexture, | 193 (*gammaTexture)->writePixels(0, 0, width, height, |
194 0, 0, width, height, | 194 (*gammaTexture)->config(), data.get(), 0, |
195 (*gammaTexture)->config(), data.get(), 0, | 195 GrContext::kDontFlush_PixelOpsFlag); |
196 GrContext::kDontFlush_PixelOpsFlag); | |
197 } | 196 } |
198 } | 197 } |
199 | 198 |
200 void GrDistanceFieldTextContext::drawText(const GrPaint& paint, const SkPaint& s
kPaint, | 199 void GrDistanceFieldTextContext::drawText(const GrPaint& paint, const SkPaint& s
kPaint, |
201 const char text[], size_t byteLength, | 200 const char text[], size_t byteLength, |
202 SkScalar x, SkScalar y) { | 201 SkScalar x, SkScalar y) { |
203 SkASSERT(byteLength == 0 || text != NULL); | 202 SkASSERT(byteLength == 0 || text != NULL); |
204 | 203 |
205 // nothing to draw or can't draw | 204 // nothing to draw or can't draw |
206 if (text == NULL || byteLength == 0 /* no raster clip? || fRC->isEmpty()*/ | 205 if (text == NULL || byteLength == 0 /* no raster clip? || fRC->isEmpty()*/ |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 fVertexBounds.setLargestInverted(); | 667 fVertexBounds.setLargestInverted(); |
669 } | 668 } |
670 } | 669 } |
671 | 670 |
672 inline void GrDistanceFieldTextContext::finish() { | 671 inline void GrDistanceFieldTextContext::finish() { |
673 this->flush(); | 672 this->flush(); |
674 | 673 |
675 GrTextContext::finish(); | 674 GrTextContext::finish(); |
676 } | 675 } |
677 | 676 |
OLD | NEW |