gfx/skia/trunk/include/views/animated/SkImageView.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     2 /*
     3  * Copyright 2006 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef SkImageView_DEFINED
    11 #define SkImageView_DEFINED
    13 #include "SkView.h"
    14 #include "SkString.h"
    16 class SkAnimator;
    17 class SkBitmap;
    18 class SkMatrix;
    20 class SkImageView : public SkView {
    21 public:
    22             SkImageView();
    23     virtual ~SkImageView();
    25     void    getUri(SkString*) const;
    26     void    setUri(const char []);
    27     void    setUri(const SkString&);
    30     enum ScaleType {
    31         kMatrix_ScaleType,
    32         kFitXY_ScaleType,
    33         kFitStart_ScaleType,
    34         kFitCenter_ScaleType,
    35         kFitEnd_ScaleType
    36     };
    37     ScaleType   getScaleType() const { return (ScaleType)fScaleType; }
    38     void        setScaleType(ScaleType);
    40     bool    getImageMatrix(SkMatrix*) const;
    41     void    setImageMatrix(const SkMatrix*);
    43 protected:
    44     // overrides
    45     virtual bool    onEvent(const SkEvent&);
    46     virtual void    onDraw(SkCanvas*);
    47     virtual void    onInflate(const SkDOM&, const SkDOMNode*);
    49 private:
    50     SkString    fUri;
    51     SkMatrix*   fMatrix;    // null or copy of caller's matrix ,,,,,
    52     union {
    53         SkAnimator* fAnim;
    54         SkBitmap* fBitmap;
    55     } fData;
    56     uint8_t     fScaleType;
    57     SkBool8     fDataIsAnim;    // as opposed to bitmap
    58     SkBool8     fUriIsValid;
    60     void    onUriChange();
    61     bool    getDataBounds(SkRect* bounds);
    62     bool    freeData();
    63     bool    ensureUriIsLoaded();
    65     typedef SkView INHERITED;
    66 };
    68 #endif

mercurial