diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-02-24 05:27:24 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-24 05:27:24 -0800 |
commit | 7157c81e3a5c916ab44a02273b140e1cd8a6d1bb (patch) | |
tree | a88326e04fd6523340a9e33b2a5642655894e61a /include/utils | |
parent | c7382c661f9256c4e53d613e4897a44597e4213b (diff) | |
parent | 40528743dbb9ce7f39f093e0cdc47849ac8887cf (diff) | |
download | external_skia-7157c81e3a5c916ab44a02273b140e1cd8a6d1bb.zip external_skia-7157c81e3a5c916ab44a02273b140e1cd8a6d1bb.tar.gz external_skia-7157c81e3a5c916ab44a02273b140e1cd8a6d1bb.tar.bz2 |
Merge "Skia Merge (revision 808)"
Diffstat (limited to 'include/utils')
-rw-r--r-- | include/utils/SkCubicInterval.h | 16 | ||||
-rw-r--r-- | include/utils/SkEGLContext.h | 20 | ||||
-rw-r--r-- | include/utils/SkLayer.h | 2 | ||||
-rw-r--r-- | include/utils/SkParsePath.h | 31 | ||||
-rw-r--r-- | include/utils/SkProxyCanvas.h | 3 | ||||
-rw-r--r-- | include/utils/SkTextBox.h | 8 | ||||
-rw-r--r-- | include/utils/mac/SkCGUtils.h | 31 |
7 files changed, 106 insertions, 5 deletions
diff --git a/include/utils/SkCubicInterval.h b/include/utils/SkCubicInterval.h new file mode 100644 index 0000000..bd6fc5f --- /dev/null +++ b/include/utils/SkCubicInterval.h @@ -0,0 +1,16 @@ +#ifndef SkCubicInterval_DEFINED +#define SkCubicInterval_DEFINED + +#include "SkPoint.h" + +SkScalar SkEvalCubicInterval(SkScalar x1, SkScalar y1, + SkScalar x2, SkScalar y2, + SkScalar unitX); + +static inline SkScalar SkEvalCubicInterval(const SkPoint pts[2], SkScalar x) { + return SkEvalCubicInterval(pts[0].fX, pts[0].fY, + pts[1].fX, pts[1].fY, x); +} + +#endif + diff --git a/include/utils/SkEGLContext.h b/include/utils/SkEGLContext.h new file mode 100644 index 0000000..4b17be1 --- /dev/null +++ b/include/utils/SkEGLContext.h @@ -0,0 +1,20 @@ +#ifndef SkEGLContext_DEFINED +#define SkEGLContext_DEFINED + +#include "SkTypes.h" + +/** + * Create an offscreen opengl context + */ +class SkEGLContext { +public: + SkEGLContext(); + ~SkEGLContext(); + + bool init(int width, int height); + +private: + void* fContext; +}; + +#endif diff --git a/include/utils/SkLayer.h b/include/utils/SkLayer.h index c42261f..80a2137 100644 --- a/include/utils/SkLayer.h +++ b/include/utils/SkLayer.h @@ -128,6 +128,8 @@ private: uint32_t fFlags; SkTDArray<SkLayer*> m_children; + + typedef SkRefCnt INHERITED; }; #endif diff --git a/include/utils/SkParsePath.h b/include/utils/SkParsePath.h new file mode 100644 index 0000000..d271f7e --- /dev/null +++ b/include/utils/SkParsePath.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SkParsePath_DEFINED +#define SkParsePath_DEFINED + +#include "SkPath.h" + +class SkString; + +class SkParsePath { +public: + static bool FromSVGString(const char str[], SkPath*); + static void ToSVGString(const SkPath&, SkString*); +}; + +#endif + diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h index 082e0fd..98ef778 100644 --- a/include/utils/SkProxyCanvas.h +++ b/include/utils/SkProxyCanvas.h @@ -22,10 +22,7 @@ public: // overrides from SkCanvas virtual bool getViewport(SkIPoint* size) const; - virtual bool setViewport(int x, int y); - virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap); - virtual int save(SaveFlags flags = kMatrixClip_SaveFlag); virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags = kARGB_ClipLayer_SaveFlag); diff --git a/include/utils/SkTextBox.h b/include/utils/SkTextBox.h index 2c34448..3471f5b 100644 --- a/include/utils/SkTextBox.h +++ b/include/utils/SkTextBox.h @@ -62,10 +62,18 @@ public: void draw(SkCanvas*, const char text[], size_t len, const SkPaint&); + void setText(const char text[], size_t len, const SkPaint&); + void draw(SkCanvas*); + int countLines() const; + SkScalar getTextHeight() const; + private: SkRect fBox; SkScalar fSpacingMul, fSpacingAdd; uint8_t fMode, fSpacingAlign; + const char* fText; + size_t fLen; + const SkPaint* fPaint; }; class SkTextLineBreaker { diff --git a/include/utils/mac/SkCGUtils.h b/include/utils/mac/SkCGUtils.h index 3b74b55..db67edf 100644 --- a/include/utils/mac/SkCGUtils.h +++ b/include/utils/mac/SkCGUtils.h @@ -1,10 +1,37 @@ #ifndef SkCGUtils_DEFINED #define SkCGUtils_DEFINED -#include <Carbon/Carbon.h> +#include "SkTypes.h" + +#ifdef SK_BUILD_FOR_MAC + #include <Carbon/Carbon.h> +#else + #include <CoreGraphics/CoreGraphics.h> +#endif class SkBitmap; -CGImageRef SkCreateCGImageRef(const SkBitmap&); +/** + * Create an imageref from the specified bitmap using the specified colorspace. + * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. + */ +CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, + CGColorSpaceRef space); + +/** + * Create an imageref from the specified bitmap using the colorspace returned + * by CGColorSpaceCreateDeviceRGB() + */ +static inline CGImageRef SkCreateCGImageRef(const SkBitmap& bm) { + return SkCreateCGImageRefWithColorspace(bm, NULL); +} + +/** + * Draw the bitmap into the specified CG context. The bitmap will be converted + * to a CGImage using the generic RGB colorspace. (x,y) specifies the position + * of the top-left corner of the bitmap. The bitmap is converted using the + * colorspace returned by CGColorSpaceCreateDeviceRGB() + */ +void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y); #endif |