| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 "SkBuffer.h" | 8 #include "SkBuffer.h" |
| 9 #include "SkCubicClipper.h" | 9 #include "SkCubicClipper.h" |
| 10 #include "SkErrorInternals.h" | 10 #include "SkErrorInternals.h" |
| (...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 return 0; | 1902 return 0; |
| 1903 } | 1903 } |
| 1904 | 1904 |
| 1905 unsigned version = packed & 0xFF; | 1905 unsigned version = packed & 0xFF; |
| 1906 | 1906 |
| 1907 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; | 1907 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; |
| 1908 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; | 1908 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; |
| 1909 uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3; | 1909 uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3; |
| 1910 fIsVolatile = (packed >> kIsVolatile_SerializationShift) & 0x1; | 1910 fIsVolatile = (packed >> kIsVolatile_SerializationShift) & 0x1; |
| 1911 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer); | 1911 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer); |
| 1912 if (!pathRef) { |
| 1913 return 0; |
| 1914 } |
| 1915 |
| 1916 fPathRef.reset(pathRef); |
| 1917 SkDEBUGCODE(this->validate();) |
| 1918 buffer.skipToAlign4(); |
| 1912 | 1919 |
| 1913 // compatibility check | 1920 // compatibility check |
| 1914 if (version < kPathPrivFirstDirection_Version) { | 1921 if (version < kPathPrivFirstDirection_Version) { |
| 1915 switch (dir) { // old values | 1922 switch (dir) { // old values |
| 1916 case 0: | 1923 case 0: |
| 1917 fFirstDirection = SkPathPriv::kUnknown_FirstDirection; | 1924 fFirstDirection = SkPathPriv::kUnknown_FirstDirection; |
| 1918 break; | 1925 break; |
| 1919 case 1: | 1926 case 1: |
| 1920 fFirstDirection = SkPathPriv::kCW_FirstDirection; | 1927 fFirstDirection = SkPathPriv::kCW_FirstDirection; |
| 1921 break; | 1928 break; |
| 1922 case 2: | 1929 case 2: |
| 1923 fFirstDirection = SkPathPriv::kCCW_FirstDirection; | 1930 fFirstDirection = SkPathPriv::kCCW_FirstDirection; |
| 1924 break; | 1931 break; |
| 1925 default: | 1932 default: |
| 1926 SkASSERT(false); | 1933 SkASSERT(false); |
| 1927 } | 1934 } |
| 1928 } else { | 1935 } else { |
| 1929 fFirstDirection = dir; | 1936 fFirstDirection = dir; |
| 1930 } | 1937 } |
| 1931 | 1938 |
| 1932 size_t sizeRead = 0; | 1939 return buffer.pos(); |
| 1933 if (buffer.isValid()) { | |
| 1934 fPathRef.reset(pathRef); | |
| 1935 SkDEBUGCODE(this->validate();) | |
| 1936 buffer.skipToAlign4(); | |
| 1937 sizeRead = buffer.pos(); | |
| 1938 } else if (pathRef) { | |
| 1939 // If the buffer is not valid, pathRef should be nullptr | |
| 1940 sk_throw(); | |
| 1941 } | |
| 1942 return sizeRead; | |
| 1943 } | 1940 } |
| 1944 | 1941 |
| 1945 /////////////////////////////////////////////////////////////////////////////// | 1942 /////////////////////////////////////////////////////////////////////////////// |
| 1946 | 1943 |
| 1947 #include "SkStringUtils.h" | 1944 #include "SkStringUtils.h" |
| 1948 #include "SkStream.h" | 1945 #include "SkStream.h" |
| 1949 | 1946 |
| 1950 static void append_params(SkString* str, const char label[], const SkPoint pts[]
, | 1947 static void append_params(SkString* str, const char label[], const SkPoint pts[]
, |
| 1951 int count, SkScalarAsStringType strType, SkScalar coni
cWeight = -1) { | 1948 int count, SkScalarAsStringType strType, SkScalar coni
cWeight = -1) { |
| 1952 str->append(label); | 1949 str->append(label); |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3087 } | 3084 } |
| 3088 } while (!done); | 3085 } while (!done); |
| 3089 return SkToBool(tangents.count()) ^ isInverse; | 3086 return SkToBool(tangents.count()) ^ isInverse; |
| 3090 } | 3087 } |
| 3091 | 3088 |
| 3092 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, | 3089 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, |
| 3093 SkScalar w, SkPoint pts[], int pow2) { | 3090 SkScalar w, SkPoint pts[], int pow2) { |
| 3094 const SkConic conic(p0, p1, p2, w); | 3091 const SkConic conic(p0, p1, p2, w); |
| 3095 return conic.chopIntoQuadsPOW2(pts, pow2); | 3092 return conic.chopIntoQuadsPOW2(pts, pow2); |
| 3096 } | 3093 } |
| OLD | NEW |