| 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 | 7 |
| 8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
| 9 #if defined(SK_BUILD_FOR_WIN32) | 9 #if defined(SK_BUILD_FOR_WIN32) |
| 10 | 10 |
| (...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 | 2037 |
| 2038 static int num_glyph_guess(SkPaint::TextEncoding encoding, const void* text, siz
e_t byteLength) { | 2038 static int num_glyph_guess(SkPaint::TextEncoding encoding, const void* text, siz
e_t byteLength) { |
| 2039 switch (encoding) { | 2039 switch (encoding) { |
| 2040 case SkPaint::kUTF8_TextEncoding: | 2040 case SkPaint::kUTF8_TextEncoding: |
| 2041 return SkUTF8_CountUnichars(static_cast<const char *>(text), byteLength)
; | 2041 return SkUTF8_CountUnichars(static_cast<const char *>(text), byteLength)
; |
| 2042 case SkPaint::kUTF16_TextEncoding: | 2042 case SkPaint::kUTF16_TextEncoding: |
| 2043 return SkUTF16_CountUnichars(static_cast<const uint16_t *>(text), SkToIn
t(byteLength)); | 2043 return SkUTF16_CountUnichars(static_cast<const uint16_t *>(text), SkToIn
t(byteLength)); |
| 2044 case SkPaint::kGlyphID_TextEncoding: | 2044 case SkPaint::kGlyphID_TextEncoding: |
| 2045 return SkToInt(byteLength / 2); | 2045 return SkToInt(byteLength / 2); |
| 2046 default: | 2046 default: |
| 2047 SK_ALWAYSBREAK(true); | 2047 SK_ABORT("Invalid Text Encoding"); |
| 2048 } | 2048 } |
| 2049 return 0; | 2049 return 0; |
| 2050 } | 2050 } |
| 2051 | 2051 |
| 2052 static bool text_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) { | 2052 static bool text_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) { |
| 2053 const SkPaint::Style style = paint.getStyle(); | 2053 const SkPaint::Style style = paint.getStyle(); |
| 2054 return matrix.hasPerspective() | 2054 return matrix.hasPerspective() |
| 2055 || SkPaint::kStroke_Style == style | 2055 || SkPaint::kStroke_Style == style |
| 2056 || SkPaint::kStrokeAndFill_Style == style | 2056 || SkPaint::kStrokeAndFill_Style == style |
| 2057 || paint.getMaskFilter() | 2057 || paint.getMaskFilter() |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 "Could not get current visuals for layer."); | 2247 "Could not get current visuals for layer."); |
| 2248 HRVM(currentVisuals->Append(that->fCurrentXpsCanvas.get()), | 2248 HRVM(currentVisuals->Append(that->fCurrentXpsCanvas.get()), |
| 2249 "Could not add layer to current visuals."); | 2249 "Could not add layer to current visuals."); |
| 2250 } | 2250 } |
| 2251 | 2251 |
| 2252 SkBaseDevice* SkXPSDevice::onCreateDevice(const CreateInfo& info, const SkPaint*
) { | 2252 SkBaseDevice* SkXPSDevice::onCreateDevice(const CreateInfo& info, const SkPaint*
) { |
| 2253 //Conditional for bug compatibility with PDF device. | 2253 //Conditional for bug compatibility with PDF device. |
| 2254 #if 0 | 2254 #if 0 |
| 2255 if (SkBaseDevice::kGeneral_Usage == info.fUsage) { | 2255 if (SkBaseDevice::kGeneral_Usage == info.fUsage) { |
| 2256 return nullptr; | 2256 return nullptr; |
| 2257 SK_CRASH(); | |
| 2258 //To what stream do we write? | 2257 //To what stream do we write? |
| 2259 //SkXPSDevice* dev = new SkXPSDevice(this); | 2258 //SkXPSDevice* dev = new SkXPSDevice(this); |
| 2260 //SkSize s = SkSize::Make(width, height); | 2259 //SkSize s = SkSize::Make(width, height); |
| 2261 //dev->BeginCanvas(s, s, SkMatrix::I()); | 2260 //dev->BeginCanvas(s, s, SkMatrix::I()); |
| 2262 //return dev; | 2261 //return dev; |
| 2263 } | 2262 } |
| 2264 #endif | 2263 #endif |
| 2265 return new SkXPSDevice(this->fXpsFactory.get()); | 2264 return new SkXPSDevice(this->fXpsFactory.get()); |
| 2266 } | 2265 } |
| 2267 | 2266 |
| 2268 #endif//defined(SK_BUILD_FOR_WIN32) | 2267 #endif//defined(SK_BUILD_FOR_WIN32) |
| OLD | NEW |