aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-02-11 11:09:39 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-02-11 11:09:39 +0000
commit60bc6d5cb0af7cef0e49cc35f28f36f89b10853e (patch)
treea019716911f2ad54194d2b3483867aaed74ccf66 /include
parentf0ad0864af632736819b9f3f34dbba488c73e3af (diff)
add Make to SkTSize
git-svn-id: http://skia.googlecode.com/svn/trunk@497 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkSize.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/core/SkSize.h b/include/core/SkSize.h
index d432102c3b..dae6fe91c2 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,13 @@ 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> {
+ SkSize(const SkTSize<SkScalar& src) : fWidth(src.fWidth), fHeight(src.fHeight) {}
+
SkSize& operator=(const SkISize& src) {
this->set(SkIntToScalar(src.fWidth), SkIntToScalar(src.fHeight));
return *this;