2d9e543a58
- Replace sk_memory_order with std::memory_order. - Remove SkAtomic<T>. SkPath was the only user of SkAtomic<T>, for its fConvexity and fFirstDirection fields. I've replaced them with std::atomic types, and funneled access to them through methods that enforce the relaxed memory order like SkAtomic<T> did. For fConvexity, we can use the exisiting setConvexity() and getConvexityOrUnknown() methods, adding a private const setConvexity() to mutate convexity from const methods. For fFirstDirection I've added private setFirstDirection() and getFirstDirection() methods. Removing SkAtomic<T> means SkAtomics.h no longer needs SkNoncopyable.h. I've had to update a bunch of other headers that were depending on transitive inclusion. Change-Id: Ib238be71a121519db6e970a9a8955834e1298c87 Reviewed-on: https://skia-review.googlesource.com/c/174220 Commit-Queue: Brian Salomon <bsalomon@google.com> Auto-Submit: Mike Klein <mtklein@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
/*
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkSVGAttributeParser_DEFINED
|
|
#define SkSVGAttributeParser_DEFINED
|
|
|
|
#include "SkNoncopyable.h"
|
|
#include "SkSVGTypes.h"
|
|
|
|
class SkSVGAttributeParser : public SkNoncopyable {
|
|
public:
|
|
SkSVGAttributeParser(const char[]);
|
|
|
|
bool parseColor(SkSVGColorType*);
|
|
bool parseClipPath(SkSVGClip*);
|
|
bool parseFillRule(SkSVGFillRule*);
|
|
bool parseNumber(SkSVGNumberType*);
|
|
bool parseLength(SkSVGLength*);
|
|
bool parseViewBox(SkSVGViewBoxType*);
|
|
bool parseTransform(SkSVGTransformType*);
|
|
bool parsePaint(SkSVGPaint*);
|
|
bool parseLineCap(SkSVGLineCap*);
|
|
bool parseLineJoin(SkSVGLineJoin*);
|
|
bool parsePoints(SkSVGPointsType*);
|
|
bool parseIRI(SkSVGStringType*);
|
|
bool parseSpreadMethod(SkSVGSpreadMethod*);
|
|
bool parseVisibility(SkSVGVisibility*);
|
|
bool parseDashArray(SkSVGDashArray*);
|
|
|
|
private:
|
|
// Stack-only
|
|
void* operator new(size_t) = delete;
|
|
void* operator new(size_t, void*) = delete;
|
|
|
|
template <typename F>
|
|
bool advanceWhile(F func);
|
|
|
|
bool parseWSToken();
|
|
bool parseEOSToken();
|
|
bool parseSepToken();
|
|
bool parseExpectedStringToken(const char*);
|
|
bool parseScalarToken(SkScalar*);
|
|
bool parseHexToken(uint32_t*);
|
|
bool parseLengthUnitToken(SkSVGLength::Unit*);
|
|
bool parseNamedColorToken(SkColor*);
|
|
bool parseHexColorToken(SkColor*);
|
|
bool parseColorComponentToken(int32_t*);
|
|
bool parseRGBColorToken(SkColor*);
|
|
bool parseFuncIRI(SkSVGStringType*);
|
|
|
|
// Transform helpers
|
|
bool parseMatrixToken(SkMatrix*);
|
|
bool parseTranslateToken(SkMatrix*);
|
|
bool parseScaleToken(SkMatrix*);
|
|
bool parseRotateToken(SkMatrix*);
|
|
bool parseSkewXToken(SkMatrix*);
|
|
bool parseSkewYToken(SkMatrix*);
|
|
|
|
// Parses a sequence of 'WS* <prefix> WS* (<nested>)', where the nested sequence
|
|
// is handled by the passed functor.
|
|
template <typename Func, typename T>
|
|
bool parseParenthesized(const char* prefix, Func, T* result);
|
|
|
|
// The current position in the input string.
|
|
const char* fCurPos;
|
|
|
|
typedef SkNoncopyable INHERITED;
|
|
};
|
|
|
|
#endif // SkSVGAttributeParser_DEFINED
|