OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include <new> | 7 #include <new> |
8 #include "SkPictureData.h" | 8 #include "SkPictureData.h" |
9 #include "SkPictureRecord.h" | 9 #include "SkPictureRecord.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 void SkPictureData::WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec) { | 186 void SkPictureData::WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec) { |
187 int count = rec.count(); | 187 int count = rec.count(); |
188 | 188 |
189 write_tag_size(stream, SK_PICT_TYPEFACE_TAG, count); | 189 write_tag_size(stream, SK_PICT_TYPEFACE_TAG, count); |
190 | 190 |
191 SkAutoSTMalloc<16, SkTypeface*> storage(count); | 191 SkAutoSTMalloc<16, SkTypeface*> storage(count); |
192 SkTypeface** array = (SkTypeface**)storage.get(); | 192 SkTypeface** array = (SkTypeface**)storage.get(); |
193 rec.copyToArray((SkRefCnt**)array); | 193 rec.copyToArray((SkRefCnt**)array); |
194 | 194 |
195 for (int i = 0; i < count; i++) { | 195 for (int i = 0; i < count; i++) { |
196 #ifdef SK_PICTURE_FORCE_FONT_EMBEDDING | |
197 array[i]->serializeForcingEmbedding(stream); | |
198 #else | |
199 // TODO: if (embedFonts) { array[i]->serializeForcingEmbedding(stream) }
else | |
200 array[i]->serialize(stream); | 196 array[i]->serialize(stream); |
201 #endif | |
202 } | 197 } |
203 } | 198 } |
204 | 199 |
205 void SkPictureData::flattenToBuffer(SkWriteBuffer& buffer) const { | 200 void SkPictureData::flattenToBuffer(SkWriteBuffer& buffer) const { |
206 int i, n; | 201 int i, n; |
207 | 202 |
208 if ((n = fBitmaps.count()) > 0) { | 203 if ((n = fBitmaps.count()) > 0) { |
209 write_tag_size(buffer, SK_PICT_BITMAP_BUFFER_TAG, n); | 204 write_tag_size(buffer, SK_PICT_BITMAP_BUFFER_TAG, n); |
210 for (i = 0; i < n; i++) { | 205 for (i = 0; i < n; i++) { |
211 buffer.writeBitmap(fBitmaps[i]); | 206 buffer.writeBitmap(fBitmaps[i]); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 634 } |
640 } | 635 } |
641 | 636 |
642 bool SkPictureData::suitableForLayerOptimization() const { | 637 bool SkPictureData::suitableForLayerOptimization() const { |
643 return fContentInfo.numLayers() > 0; | 638 return fContentInfo.numLayers() > 0; |
644 } | 639 } |
645 #endif | 640 #endif |
646 /////////////////////////////////////////////////////////////////////////////// | 641 /////////////////////////////////////////////////////////////////////////////// |
647 | 642 |
648 | 643 |
OLD | NEW |