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

Side by Side Diff: src/core/SkScalerContext.cpp

Issue 473543004: Revert of Remove SkPaintOptionsAndroid (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/core/SkScalerContext.h ('k') | src/ports/SkFontConfigParser_android.h » ('j') | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkScalerContext.h" 10 #include "SkScalerContext.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkDescriptor.h" 12 #include "SkDescriptor.h"
13 #include "SkDraw.h" 13 #include "SkDraw.h"
14 #include "SkFontHost.h" 14 #include "SkFontHost.h"
15 #include "SkGlyph.h" 15 #include "SkGlyph.h"
16 #include "SkMaskFilter.h" 16 #include "SkMaskFilter.h"
17 #include "SkMaskGamma.h" 17 #include "SkMaskGamma.h"
18 #include "SkReadBuffer.h" 18 #include "SkReadBuffer.h"
19 #include "SkWriteBuffer.h" 19 #include "SkWriteBuffer.h"
20 #include "SkPathEffect.h" 20 #include "SkPathEffect.h"
21 #include "SkRasterizer.h" 21 #include "SkRasterizer.h"
22 #include "SkRasterClip.h" 22 #include "SkRasterClip.h"
23 #include "SkStroke.h" 23 #include "SkStroke.h"
24 #include "SkThread.h" 24 #include "SkThread.h"
25 25
26 #ifdef SK_BUILD_FOR_ANDROID
27 #include "SkTypeface_android.h"
28 #endif
29
26 #define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3) 30 #define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3)
27 31
28 void SkGlyph::toMask(SkMask* mask) const { 32 void SkGlyph::toMask(SkMask* mask) const {
29 SkASSERT(mask); 33 SkASSERT(mask);
30 34
31 mask->fImage = (uint8_t*)fImage; 35 mask->fImage = (uint8_t*)fImage;
32 mask->fBounds.set(fLeft, fTop, fLeft + fWidth, fTop + fHeight); 36 mask->fBounds.set(fLeft, fTop, fLeft + fWidth, fTop + fHeight);
33 mask->fRowBytes = this->rowBytes(); 37 mask->fRowBytes = this->rowBytes();
34 mask->fFormat = static_cast<SkMask::Format>(fMaskFormat); 38 mask->fFormat = static_cast<SkMask::Format>(fMaskFormat);
35 } 39 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 SkDebugf(" textsize %g prescale %g preskew %g post [%g %g %g %g]\n", 104 SkDebugf(" textsize %g prescale %g preskew %g post [%g %g %g %g]\n",
101 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0], 105 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0],
102 rec->fPost2x2[0][1], rec->fPost2x2[1][0], rec->fPost2x2[1][1]); 106 rec->fPost2x2[0][1], rec->fPost2x2[1][0], rec->fPost2x2[1][1]);
103 SkDebugf(" frame %g miter %g hints %d framefill %d format %d join %d\n", 107 SkDebugf(" frame %g miter %g hints %d framefill %d format %d join %d\n",
104 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill, 108 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill,
105 rec->fMaskFormat, rec->fStrokeJoin); 109 rec->fMaskFormat, rec->fStrokeJoin);
106 SkDebugf(" pathEffect %x maskFilter %x\n", 110 SkDebugf(" pathEffect %x maskFilter %x\n",
107 desc->findEntry(kPathEffect_SkDescriptorTag, NULL), 111 desc->findEntry(kPathEffect_SkDescriptorTag, NULL),
108 desc->findEntry(kMaskFilter_SkDescriptorTag, NULL)); 112 desc->findEntry(kMaskFilter_SkDescriptorTag, NULL));
109 #endif 113 #endif
114 #ifdef SK_BUILD_FOR_ANDROID
115 uint32_t len;
116 const void* data = desc->findEntry(kAndroidOpts_SkDescriptorTag, &len);
117 if (data) {
118 SkReadBuffer buffer(data, len);
119 fPaintOptionsAndroid.unflatten(buffer);
120 SkASSERT(buffer.offset() == buffer.size());
121 }
122 #endif
110 } 123 }
111 124
112 SkScalerContext::~SkScalerContext() { 125 SkScalerContext::~SkScalerContext() {
113 SkSafeUnref(fPathEffect); 126 SkSafeUnref(fPathEffect);
114 SkSafeUnref(fMaskFilter); 127 SkSafeUnref(fMaskFilter);
115 SkSafeUnref(fRasterizer); 128 SkSafeUnref(fRasterizer);
116 } 129 }
117 130
118 void SkScalerContext::getAdvance(SkGlyph* glyph) { 131 void SkScalerContext::getAdvance(SkGlyph* glyph) {
119 // mark us as just having a valid advance 132 // mark us as just having a valid advance
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 805 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
793 bool allowFailure) const { 806 bool allowFailure) const {
794 SkScalerContext* c = this->onCreateScalerContext(desc); 807 SkScalerContext* c = this->onCreateScalerContext(desc);
795 808
796 if (!c && !allowFailure) { 809 if (!c && !allowFailure) {
797 c = SkNEW_ARGS(SkScalerContext_Empty, 810 c = SkNEW_ARGS(SkScalerContext_Empty,
798 (const_cast<SkTypeface*>(this), desc)); 811 (const_cast<SkTypeface*>(this), desc));
799 } 812 }
800 return c; 813 return c;
801 } 814 }
OLDNEW
« no previous file with comments | « src/core/SkScalerContext.h ('k') | src/ports/SkFontConfigParser_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698