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