aboutsummaryrefslogtreecommitdiffstats
path: root/include/core
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2010-02-11 06:20:08 -0500
committerMike Reed <reed@google.com>2010-02-11 06:20:08 -0500
commit6b79d6ada02fb549f79a1f7ca5efa222be37dee5 (patch)
treee36de6385ecb0adc4c0d43beab7ba8c3602fab8c /include/core
parent1c980e0d7772f05f570ae0227d91635f017c2227 (diff)
downloadexternal_skia-6b79d6ada02fb549f79a1f7ca5efa222be37dee5.zip
external_skia-6b79d6ada02fb549f79a1f7ca5efa222be37dee5.tar.gz
external_skia-6b79d6ada02fb549f79a1f7ca5efa222be37dee5.tar.bz2
refresh from trunk: add static Make for SkSize
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkSize.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/core/SkSize.h b/include/core/SkSize.h
index d432102..9df9508 100644
--- a/include/core/SkSize.h
+++ b/include/core/SkSize.h
@@ -7,6 +7,13 @@ template <typename T> struct SkTSize {
T fWidth;
T fHeight;
+ static SkTSize Make(T w, T h) {
+ SkTSize s;
+ s.fWidth = w;
+ s.fHeight = h;
+ return s;
+ }
+
void set(T w, T h) {
fWidth = w;
fHeight = h;
@@ -58,11 +65,19 @@ static inline bool operator!=(const SkTSize<T>& a, const SkTSize<T>& b) {
///////////////////////////////////////////////////////////////////////////////
-struct SkISize : public SkTSize<int32_t> {};
+typedef SkTSize<int32_t> SkISize;
#include "SkScalar.h"
struct SkSize : public SkTSize<SkScalar> {
+ static SkSize Make(SkScalar w, SkScalar h) {
+ SkSize s;
+ s.fWidth = w;
+ s.fHeight = h;
+ return s;
+ }
+
+
SkSize& operator=(const SkISize& src) {
this->set(SkIntToScalar(src.fWidth), SkIntToScalar(src.fHeight));
return *this;