| 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 "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 fVertexBounds.setLargestInverted(); | 68 fVertexBounds.setLargestInverted(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 GrDistanceFieldTextContext* GrDistanceFieldTextContext::Create(GrContext* contex
t, | 71 GrDistanceFieldTextContext* GrDistanceFieldTextContext::Create(GrContext* contex
t, |
| 72 SkGpuDevice* gpuD
evice, | 72 SkGpuDevice* gpuD
evice, |
| 73 const SkDevicePro
perties& props, | 73 const SkDevicePro
perties& props, |
| 74 bool enable) { | 74 bool enable) { |
| 75 GrDistanceFieldTextContext* textContext = SkNEW_ARGS(GrDistanceFieldTextCont
ext, | 75 GrDistanceFieldTextContext* textContext = SkNEW_ARGS(GrDistanceFieldTextCont
ext, |
| 76 (context, gpuDevice, pr
ops, enable)); | 76 (context, gpuDevice, pr
ops, enable)); |
| 77 #ifdef USE_BITMAP_TEXTBLOBS |
| 78 textContext->fFallbackTextContext = GrBitmapTextContextB::Create(context, gp
uDevice, props); |
| 79 #else |
| 77 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpu
Device, props); | 80 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpu
Device, props); |
| 81 #endif |
| 78 | 82 |
| 79 return textContext; | 83 return textContext; |
| 80 } | 84 } |
| 81 | 85 |
| 82 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() { | 86 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() { |
| 83 SkSafeSetNull(fGammaTexture); | 87 SkSafeSetNull(fGammaTexture); |
| 84 } | 88 } |
| 85 | 89 |
| 86 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint, const SkMatrix& v
iewMatrix) { | 90 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint, const SkMatrix& v
iewMatrix) { |
| 87 // TODO: support perspective (need getMaxScale replacement) | 91 // TODO: support perspective (need getMaxScale replacement) |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 } | 732 } |
| 729 } | 733 } |
| 730 | 734 |
| 731 inline void GrDistanceFieldTextContext::finish() { | 735 inline void GrDistanceFieldTextContext::finish() { |
| 732 this->flush(); | 736 this->flush(); |
| 733 fTotalVertexCount = 0; | 737 fTotalVertexCount = 0; |
| 734 | 738 |
| 735 GrTextContext::finish(); | 739 GrTextContext::finish(); |
| 736 } | 740 } |
| 737 | 741 |
| OLD | NEW |