gfx/skia/trunk/src/animator/SkPaintParts.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/animator/SkPaintParts.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,101 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2006 The Android Open Source Project
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#include "SkPaintParts.h"
    1.14 +#include "SkDrawPaint.h"
    1.15 +#ifdef SK_DUMP_ENABLED
    1.16 +#include "SkDisplayList.h"
    1.17 +#include "SkDump.h"
    1.18 +#endif
    1.19 +
    1.20 +SkPaintPart::SkPaintPart() : fPaint(NULL) {
    1.21 +}
    1.22 +
    1.23 +SkDisplayable* SkPaintPart::getParent() const {
    1.24 +    return fPaint;
    1.25 +}
    1.26 +
    1.27 +bool SkPaintPart::setParent(SkDisplayable* parent) {
    1.28 +    SkASSERT(parent != NULL);
    1.29 +    if (parent->isPaint() == false)
    1.30 +        return true;
    1.31 +    fPaint = (SkDrawPaint*) parent;
    1.32 +    return false;
    1.33 +}
    1.34 +
    1.35 +
    1.36 +// SkDrawMaskFilter
    1.37 +bool SkDrawMaskFilter::add() {
    1.38 +    if (fPaint->maskFilter != (SkDrawMaskFilter*) -1)
    1.39 +        return true;
    1.40 +    fPaint->maskFilter = this;
    1.41 +    fPaint->fOwnsMaskFilter = true;
    1.42 +    return false;
    1.43 +}
    1.44 +
    1.45 +SkMaskFilter* SkDrawMaskFilter::getMaskFilter() {
    1.46 +    return NULL;
    1.47 +}
    1.48 +
    1.49 +
    1.50 +// SkDrawPathEffect
    1.51 +bool SkDrawPathEffect::add() {
    1.52 +    if (fPaint->isPaint()) {
    1.53 +        if (fPaint->pathEffect != (SkDrawPathEffect*) -1)
    1.54 +            return true;
    1.55 +        fPaint->pathEffect = this;
    1.56 +        fPaint->fOwnsPathEffect = true;
    1.57 +        return false;
    1.58 +    }
    1.59 +    fPaint->add(NULL, this);
    1.60 +    return false;
    1.61 +}
    1.62 +
    1.63 +SkPathEffect* SkDrawPathEffect::getPathEffect() {
    1.64 +    return NULL;
    1.65 +}
    1.66 +
    1.67 +
    1.68 +// SkDrawShader
    1.69 +SkShader* SkDrawShader::getShader() {
    1.70 +    return NULL;
    1.71 +}
    1.72 +
    1.73 +
    1.74 +// Typeface
    1.75 +#if SK_USE_CONDENSED_INFO == 0
    1.76 +
    1.77 +const SkMemberInfo SkDrawTypeface::fInfo[] = {
    1.78 +    SK_MEMBER(fontName, String),
    1.79 +    SK_MEMBER(style, FontStyle)
    1.80 +};
    1.81 +
    1.82 +#endif
    1.83 +
    1.84 +DEFINE_GET_MEMBER(SkDrawTypeface);
    1.85 +
    1.86 +SkDrawTypeface::SkDrawTypeface() : style (SkTypeface::kNormal){
    1.87 +}
    1.88 +
    1.89 +bool SkDrawTypeface::add() {
    1.90 +    if (fPaint->typeface != (SkDrawTypeface*) -1)
    1.91 +        return true;
    1.92 +    fPaint->typeface = this;
    1.93 +    fPaint->fOwnsTypeface = true;
    1.94 +    return false;
    1.95 +}
    1.96 +
    1.97 +#ifdef SK_DUMP_ENABLED
    1.98 +void SkDrawTypeface::dump(SkAnimateMaker*) {
    1.99 +    SkDebugf("%*s<typeface fontName=\"%s\" ", SkDisplayList::fIndent, "", fontName.c_str());
   1.100 +    SkString string;
   1.101 +    SkDump::GetEnumString(SkType_FontStyle, style, &string);
   1.102 +    SkDebugf("style=\"%s\" />\n", string.c_str());
   1.103 +}
   1.104 +#endif

mercurial