Home | History | Annotate | Download | only in hwui
      1 /*
      2  * Copyright (C) 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "Paint.h"
     18 
     19 namespace android {
     20 
     21 Paint::Paint()
     22         : SkPaint()
     23         , mLetterSpacing(0)
     24         , mWordSpacing(0)
     25         , mFontFeatureSettings()
     26         , mMinikinLocaleListId(0)
     27         , mFamilyVariant(minikin::FontFamily::Variant::DEFAULT) {}
     28 
     29 Paint::Paint(const Paint& paint)
     30         : SkPaint(paint)
     31         , mLetterSpacing(paint.mLetterSpacing)
     32         , mWordSpacing(paint.mWordSpacing)
     33         , mFontFeatureSettings(paint.mFontFeatureSettings)
     34         , mMinikinLocaleListId(paint.mMinikinLocaleListId)
     35         , mFamilyVariant(paint.mFamilyVariant)
     36         , mHyphenEdit(paint.mHyphenEdit)
     37         , mTypeface(paint.mTypeface) {}
     38 
     39 Paint::Paint(const SkPaint& paint)
     40         : SkPaint(paint)
     41         , mLetterSpacing(0)
     42         , mWordSpacing(0)
     43         , mFontFeatureSettings()
     44         , mMinikinLocaleListId(0)
     45         , mFamilyVariant(minikin::FontFamily::Variant::DEFAULT) {}
     46 
     47 Paint::~Paint() {}
     48 
     49 Paint& Paint::operator=(const Paint& other) {
     50     SkPaint::operator=(other);
     51     mLetterSpacing = other.mLetterSpacing;
     52     mWordSpacing = other.mWordSpacing;
     53     mFontFeatureSettings = other.mFontFeatureSettings;
     54     mMinikinLocaleListId = other.mMinikinLocaleListId;
     55     mFamilyVariant = other.mFamilyVariant;
     56     mHyphenEdit = other.mHyphenEdit;
     57     mTypeface = other.mTypeface;
     58     return *this;
     59 }
     60 
     61 bool operator==(const Paint& a, const Paint& b) {
     62     return static_cast<const SkPaint&>(a) == static_cast<const SkPaint&>(b) &&
     63            a.mLetterSpacing == b.mLetterSpacing && a.mWordSpacing == b.mWordSpacing &&
     64            a.mFontFeatureSettings == b.mFontFeatureSettings &&
     65            a.mMinikinLocaleListId == b.mMinikinLocaleListId &&
     66            a.mFamilyVariant == b.mFamilyVariant && a.mHyphenEdit == b.mHyphenEdit &&
     67            a.mTypeface == b.mTypeface;
     68 }
     69 }  // namespace android
     70