| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #ifndef skiagm_DEFINED | 8 #ifndef skiagm_DEFINED |
| 9 #define skiagm_DEFINED | 9 #define skiagm_DEFINED |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 SkScalar height() { | 68 SkScalar height() { |
| 69 return SkIntToScalar(this->getISize().height()); | 69 return SkIntToScalar(this->getISize().height()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // TODO(vandebo) Instead of exposing this, we should run all the GMs | 72 // TODO(vandebo) Instead of exposing this, we should run all the GMs |
| 73 // with and without an initial transform. | 73 // with and without an initial transform. |
| 74 // Most GMs will return the identity matrix, but some PDFs tests | 74 // Most GMs will return the identity matrix, but some PDFs tests |
| 75 // require setting the initial transform. | 75 // require setting the initial transform. |
| 76 SkMatrix getInitialTransform() const { | 76 SkMatrix getInitialTransform() const { |
| 77 return this->onGetInitialTransform(); | 77 SkMatrix matrix = fStarterMatrix; |
| 78 matrix.preConcat(this->onGetInitialTransform()); |
| 79 return matrix; |
| 78 } | 80 } |
| 79 | 81 |
| 80 SkColor getBGColor() const { return fBGColor; } | 82 SkColor getBGColor() const { return fBGColor; } |
| 81 void setBGColor(SkColor); | 83 void setBGColor(SkColor); |
| 82 | 84 |
| 83 // helper: fill a rect in the specified color based on the | 85 // helper: fill a rect in the specified color based on the |
| 84 // GM's getISize bounds. | 86 // GM's getISize bounds. |
| 85 void drawSizeBounds(SkCanvas*, SkColor); | 87 void drawSizeBounds(SkCanvas*, SkColor); |
| 86 | 88 |
| 87 static void SetResourcePath(const char* resourcePath) { | 89 static void SetResourcePath(const char* resourcePath) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 99 | 101 |
| 100 bool isCanvasDeferred() const { return fCanvasIsDeferred; } | 102 bool isCanvasDeferred() const { return fCanvasIsDeferred; } |
| 101 void setCanvasIsDeferred(bool isDeferred) { | 103 void setCanvasIsDeferred(bool isDeferred) { |
| 102 fCanvasIsDeferred = isDeferred; | 104 fCanvasIsDeferred = isDeferred; |
| 103 } | 105 } |
| 104 | 106 |
| 105 #if SK_SUPPORT_GPU | 107 #if SK_SUPPORT_GPU |
| 106 static GrContext* GetGr(/*very nearly const*/ SkCanvas*); | 108 static GrContext* GetGr(/*very nearly const*/ SkCanvas*); |
| 107 #endif | 109 #endif |
| 108 | 110 |
| 111 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } |
| 112 void setStarterMatrix(const SkMatrix& matrix) { |
| 113 fStarterMatrix = matrix; |
| 114 } |
| 115 |
| 109 protected: | 116 protected: |
| 110 static SkString gResourcePath; | 117 static SkString gResourcePath; |
| 111 | 118 |
| 112 virtual void onOnceBeforeDraw() {} | 119 virtual void onOnceBeforeDraw() {} |
| 113 virtual void onDraw(SkCanvas*) = 0; | 120 virtual void onDraw(SkCanvas*) = 0; |
| 114 virtual void onDrawBackground(SkCanvas*); | 121 virtual void onDrawBackground(SkCanvas*); |
| 115 virtual SkISize onISize() = 0; | 122 virtual SkISize onISize() = 0; |
| 116 virtual SkString onShortName() = 0; | 123 virtual SkString onShortName() = 0; |
| 117 virtual uint32_t onGetFlags() const { return 0; } | 124 virtual uint32_t onGetFlags() const { return 0; } |
| 118 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } | 125 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } |
| 119 | 126 |
| 120 private: | 127 private: |
| 121 SkString fShortName; | 128 SkString fShortName; |
| 122 SkColor fBGColor; | 129 SkColor fBGColor; |
| 123 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 130 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
| 124 bool fHaveCalledOnceBeforeDraw; | 131 bool fHaveCalledOnceBeforeDraw; |
| 125 bool fIgnoreFailures; // whether to file any failures as failure-ign
ored | 132 bool fIgnoreFailures; // whether to file any failures as failure-ign
ored |
| 133 SkMatrix fStarterMatrix; |
| 126 }; | 134 }; |
| 127 | 135 |
| 128 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 136 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
| 129 } | 137 } |
| 130 | 138 |
| 131 #endif | 139 #endif |
| OLD | NEW |