| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrStencilAndCoverTextContext.h" | 8 #include "GrStencilAndCoverTextContext.h" |
| 9 #include "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 template<typename Key, typename Val> static void delete_hash_map_entry(const Key
&, Val* val) { | 30 template<typename Key, typename Val> static void delete_hash_map_entry(const Key
&, Val* val) { |
| 31 SkASSERT(*val); | 31 SkASSERT(*val); |
| 32 delete *val; | 32 delete *val; |
| 33 } | 33 } |
| 34 | 34 |
| 35 template<typename T> static void delete_hash_table_entry(T* val) { | 35 template<typename T> static void delete_hash_table_entry(T* val) { |
| 36 SkASSERT(*val); | 36 SkASSERT(*val); |
| 37 delete *val; | 37 delete *val; |
| 38 } | 38 } |
| 39 | 39 |
| 40 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext() | 40 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrAtlasTextContext* f
allbackTextContext) |
| 41 : fFallbackTextContext(nullptr) | 41 : fFallbackTextContext(fallbackTextContext) |
| 42 , fCacheSize(0) { | 42 , fCacheSize(0) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 GrStencilAndCoverTextContext* | 45 GrStencilAndCoverTextContext* |
| 46 GrStencilAndCoverTextContext::Create() { | 46 GrStencilAndCoverTextContext::Create(GrAtlasTextContext* fallbackTextContext) { |
| 47 GrStencilAndCoverTextContext* textContext = new GrStencilAndCoverTextContext
(); | 47 return new GrStencilAndCoverTextContext(fallbackTextContext);; |
| 48 textContext->fFallbackTextContext = GrAtlasTextContext::Create(); | |
| 49 | |
| 50 return textContext; | |
| 51 } | 48 } |
| 52 | 49 |
| 53 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() { | 50 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() { |
| 54 delete fFallbackTextContext; | |
| 55 fBlobIdCache.foreach(delete_hash_map_entry<uint32_t, TextBlob*>); | 51 fBlobIdCache.foreach(delete_hash_map_entry<uint32_t, TextBlob*>); |
| 56 fBlobKeyCache.foreach(delete_hash_table_entry<TextBlob*>); | 52 fBlobKeyCache.foreach(delete_hash_table_entry<TextBlob*>); |
| 57 } | 53 } |
| 58 | 54 |
| 59 bool GrStencilAndCoverTextContext::internalCanDraw(const SkPaint& skPaint) { | 55 bool GrStencilAndCoverTextContext::internalCanDraw(const SkPaint& skPaint) { |
| 60 if (skPaint.getRasterizer()) { | 56 if (skPaint.getRasterizer()) { |
| 61 return false; | 57 return false; |
| 62 } | 58 } |
| 63 if (skPaint.getMaskFilter()) { | 59 if (skPaint.getMaskFilter()) { |
| 64 return false; | 60 return false; |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 } | 729 } |
| 734 | 730 |
| 735 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 731 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
| 736 *count = fCount; | 732 *count = fCount; |
| 737 if (fCount) { | 733 if (fCount) { |
| 738 this->flush(); | 734 this->flush(); |
| 739 return fBuilder->build(); | 735 return fBuilder->build(); |
| 740 } | 736 } |
| 741 return nullptr; | 737 return nullptr; |
| 742 } | 738 } |
| OLD | NEW |