Chromium Code Reviews| 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 |
| 11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkBitmapDevice.h" | 12 #include "SkBitmapDevice.h" |
| 13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
| 14 #include "SkCommandLineFlags.h" | |
| 14 #include "SkPaint.h" | 15 #include "SkPaint.h" |
| 15 #include "SkSize.h" | 16 #include "SkSize.h" |
| 16 #include "SkString.h" | 17 #include "SkString.h" |
| 17 #include "SkTRegistry.h" | 18 #include "SkTRegistry.h" |
| 18 | 19 |
| 19 #if SK_SUPPORT_GPU | 20 #if SK_SUPPORT_GPU |
| 20 #include "GrContext.h" | 21 #include "GrContext.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 24 DECLARE_bool(forcePerspectiveMatrix); | |
| 25 | |
| 23 #define DEF_GM(code) \ | 26 #define DEF_GM(code) \ |
| 24 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ | 27 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ |
| 25 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_ )); | 28 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_ )); |
| 26 | 29 |
| 27 namespace skiagm { | 30 namespace skiagm { |
| 28 | 31 |
| 29 static inline SkISize make_isize(int w, int h) { | 32 static inline SkISize make_isize(int w, int h) { |
| 30 SkISize sz; | 33 SkISize sz; |
| 31 sz.set(w, h); | 34 sz.set(w, h); |
| 32 return sz; | 35 return sz; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 return SkIntToScalar(this->getISize().width()); | 69 return SkIntToScalar(this->getISize().width()); |
| 67 } | 70 } |
| 68 SkScalar height() { | 71 SkScalar height() { |
| 69 return SkIntToScalar(this->getISize().height()); | 72 return SkIntToScalar(this->getISize().height()); |
| 70 } | 73 } |
| 71 | 74 |
| 72 // TODO(vandebo) Instead of exposing this, we should run all the GMs | 75 // TODO(vandebo) Instead of exposing this, we should run all the GMs |
| 73 // with and without an initial transform. | 76 // with and without an initial transform. |
| 74 // Most GMs will return the identity matrix, but some PDFs tests | 77 // Most GMs will return the identity matrix, but some PDFs tests |
| 75 // require setting the initial transform. | 78 // require setting the initial transform. |
| 76 SkMatrix getInitialTransform() const { | 79 SkMatrix getInitialTransform() const { |
|
reed1
2013/09/23 18:48:40
I think we could generalize this guy a little for
edisonn
2013/09/23 19:38:04
Done.
| |
| 80 if (FLAGS_forcePerspectiveMatrix) { | |
| 81 SkMatrix perspective; | |
| 82 perspective.setIdentity(); | |
| 83 perspective.setPerspY(SkScalarDiv(SK_Scalar1, SkIntToScalar(1000 ))); | |
| 84 perspective.setSkewX(SkScalarDiv(SkIntToScalar(8), SkIntToScalar (25))); | |
| 85 return perspective; | |
| 86 } | |
| 77 return this->onGetInitialTransform(); | 87 return this->onGetInitialTransform(); |
| 78 } | 88 } |
| 79 | 89 |
| 80 SkColor getBGColor() const { return fBGColor; } | 90 SkColor getBGColor() const { return fBGColor; } |
| 81 void setBGColor(SkColor); | 91 void setBGColor(SkColor); |
| 82 | 92 |
| 83 // helper: fill a rect in the specified color based on the | 93 // helper: fill a rect in the specified color based on the |
| 84 // GM's getISize bounds. | 94 // GM's getISize bounds. |
| 85 void drawSizeBounds(SkCanvas*, SkColor); | 95 void drawSizeBounds(SkCanvas*, SkColor); |
| 86 | 96 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 SkColor fBGColor; | 132 SkColor fBGColor; |
| 123 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 133 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
| 124 bool fHaveCalledOnceBeforeDraw; | 134 bool fHaveCalledOnceBeforeDraw; |
| 125 bool fIgnoreFailures; // whether to file any failures as failure-ign ored | 135 bool fIgnoreFailures; // whether to file any failures as failure-ign ored |
| 126 }; | 136 }; |
| 127 | 137 |
| 128 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 138 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
| 129 } | 139 } |
| 130 | 140 |
| 131 #endif | 141 #endif |
| OLD | NEW |