Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: tests/FontHostStreamTest.cpp

Issue 869763002: SkTypeface to use SkStreamAsset. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sfnt/SkOTUtils.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 drawBG(&origCanvas); 89 drawBG(&origCanvas);
90 origCanvas.drawText("A", 1, point.fX, point.fY, paint); 90 origCanvas.drawText("A", 1, point.fX, point.fY, paint);
91 91
92 SkTypeface* origTypeface = paint.getTypeface(); 92 SkTypeface* origTypeface = paint.getTypeface();
93 SkAutoTUnref<SkTypeface> aur; 93 SkAutoTUnref<SkTypeface> aur;
94 if (NULL == origTypeface) { 94 if (NULL == origTypeface) {
95 origTypeface = aur.reset(SkTypeface::RefDefault()); 95 origTypeface = aur.reset(SkTypeface::RefDefault());
96 } 96 }
97 97
98 int ttcIndex; 98 int ttcIndex;
99 SkAutoTDelete<SkStream> fontData(origTypeface->openStream(&ttcIndex)); 99 SkAutoTDelete<SkStreamAsset> fontData(origTypeface->openStream(&ttcIndex ));
100 SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData.detac h()); 100 SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData.detac h());
101 101
102 SkFontDescriptor desc; 102 SkFontDescriptor desc;
103 bool isLocalStream = false; 103 bool isLocalStream = false;
104 streamTypeface->getFontDescriptor(&desc, &isLocalStream); 104 streamTypeface->getFontDescriptor(&desc, &isLocalStream);
105 REPORTER_ASSERT(reporter, isLocalStream); 105 REPORTER_ASSERT(reporter, isLocalStream);
106 106
107 SkSafeUnref(paint.setTypeface(streamTypeface)); 107 SkSafeUnref(paint.setTypeface(streamTypeface));
108 drawBG(&streamCanvas); 108 drawBG(&streamCanvas);
109 streamCanvas.drawPosText("A", 1, &point, paint); 109 streamCanvas.drawPosText("A", 1, &point, paint);
110 110
111 REPORTER_ASSERT(reporter, 111 REPORTER_ASSERT(reporter,
112 compare(origBitmap, origRect, streamBitmap, streamRect)) ; 112 compare(origBitmap, origRect, streamBitmap, streamRect)) ;
113 } 113 }
114 //Make sure the typeface is deleted and removed. 114 //Make sure the typeface is deleted and removed.
115 SkGraphics::PurgeFontCache(); 115 SkGraphics::PurgeFontCache();
116 } 116 }
OLDNEW
« no previous file with comments | « src/sfnt/SkOTUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698