summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2014-05-01 10:38:25 -0700
committerBo Liu <boliu@google.com>2014-05-01 10:38:25 -0700
commitab7cfa50cee8463f0dc077cbeca69107303793e1 (patch)
treed674b988ab30208fb952619e98a2284d77cdf5b0
parent74b8162081284bdbef0523fa274b5568575f7992 (diff)
parentfad7d51df7e53b3ff30c0842150288e4b4f3f107 (diff)
downloadinclude-ab7cfa50cee8463f0dc077cbeca69107303793e1.tar.gz
Merge from Chromium at DEPS revision 267519idea133-weekly-release
This commit was generated by merge_to_master.py. Change-Id: I352045c456812e4311361c41049f1f6bcbeec5a3
-rw-r--r--core/SkBlurTypes.h29
-rw-r--r--core/SkCanvas.h58
-rw-r--r--core/SkColorShader.h8
-rw-r--r--core/SkDrawLooper.h21
-rw-r--r--core/SkEndian.h13
-rw-r--r--core/SkImageFilter.h2
-rw-r--r--core/SkMaskFilter.h13
-rw-r--r--core/SkPicture.h82
-rw-r--r--core/SkPostConfig.h8
-rw-r--r--core/SkReadBuffer.h4
-rw-r--r--core/SkReader32.h8
-rw-r--r--core/SkShader.h5
-rw-r--r--effects/SkBlurDrawLooper.h5
-rw-r--r--effects/SkBlurMaskFilter.h21
-rw-r--r--effects/SkEmbossMaskFilter.h4
-rw-r--r--effects/SkGradientShader.h15
-rw-r--r--effects/SkLayerDrawLooper.h2
-rw-r--r--effects/SkMatrixConvolutionImageFilter.h2
-rw-r--r--effects/SkTileImageFilter.h2
-rw-r--r--gpu/SkGr.h5
-rw-r--r--gpu/gl/GrGLFunctions.h8
-rw-r--r--gpu/gl/GrGLInterface.h7
-rw-r--r--record/SkRecording.h39
23 files changed, 286 insertions, 75 deletions
diff --git a/core/SkBlurTypes.h b/core/SkBlurTypes.h
new file mode 100644
index 0000000..afbec19
--- /dev/null
+++ b/core/SkBlurTypes.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkBlurTypes_DEFINED
+#define SkBlurTypes_DEFINED
+
+#include "SkTypes.h"
+
+enum SkBlurStyle {
+ kNormal_SkBlurStyle, //!< fuzzy inside and outside
+ kSolid_SkBlurStyle, //!< solid inside, fuzzy outside
+ kOuter_SkBlurStyle, //!< nothing inside, fuzzy outside
+ kInner_SkBlurStyle, //!< fuzzy inside, nothing outside
+
+ kLastEnum_SkBlurStyle = kInner_SkBlurStyle
+};
+
+enum SkBlurQuality {
+ kLow_SkBlurQuality, //!< e.g. box filter
+ kHigh_SkBlurQuality, //!< e.g. 3-pass similar to gaussian
+
+ kLastEnum_SkBlurQuality
+};
+
+#endif
diff --git a/core/SkCanvas.h b/core/SkCanvas.h
index 91fb642..70cfe28 100644
--- a/core/SkCanvas.h
+++ b/core/SkCanvas.h
@@ -330,6 +330,16 @@ public:
operate on this copy.
When the balancing call to restore() is made, the previous matrix, clip,
and drawFilter are restored.
+
+ @return The value to pass to restoreToCount() to balance this save()
+ */
+ int save();
+
+ /** DEPRECATED - use save() instead.
+
+ This behaves the same as save(), but it allows fine-grained control of
+ which state bits to be saved (and subsequently restored).
+
@param flags The flags govern what portion of the Matrix/Clip/drawFilter
state the save (and matching restore) effect. For example,
if only kMatrix is specified, then only the matrix state
@@ -338,7 +348,8 @@ public:
by calls to save/restore.
@return The value to pass to restoreToCount() to balance this save()
*/
- int save(SaveFlags flags = kMatrixClip_SaveFlag);
+ SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
+ int save(SaveFlags flags);
/** This behaves the same as save(), but in addition it allocates an
offscreen bitmap. All drawing calls are directed there, and only when
@@ -350,11 +361,27 @@ public:
happen. If exact clipping is desired, use clipRect().
@param paint (may be null) This is copied, and is applied to the
offscreen when restore() is called
+ @return The value to pass to restoreToCount() to balance this save()
+ */
+ int saveLayer(const SkRect* bounds, const SkPaint* paint);
+
+ /** DEPRECATED - use saveLayer(const SkRect*, const SkPaint*) instead.
+
+ This behaves the same as saveLayer(const SkRect*, const SkPaint*),
+ but it allows fine-grained control of which state bits to be saved
+ (and subsequently restored).
+
+ @param bounds (may be null) This rect, if non-null, is used as a hint to
+ limit the size of the offscreen, and thus drawing may be
+ clipped to it, though that clipping is not guaranteed to
+ happen. If exact clipping is desired, use clipRect().
+ @param paint (may be null) This is copied, and is applied to the
+ offscreen when restore() is called
@param flags LayerFlags
@return The value to pass to restoreToCount() to balance this save()
*/
- int saveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags = kARGB_ClipLayer_SaveFlag);
+ SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
+ int saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags);
/** This behaves the same as save(), but in addition it allocates an
offscreen bitmap. All drawing calls are directed there, and only when
@@ -365,11 +392,26 @@ public:
clipped to it, though that clipping is not guaranteed to
happen. If exact clipping is desired, use clipRect().
@param alpha This is applied to the offscreen when restore() is called.
+ @return The value to pass to restoreToCount() to balance this save()
+ */
+ int saveLayerAlpha(const SkRect* bounds, U8CPU alpha);
+
+ /** DEPRECATED - use saveLayerAlpha(const SkRect*, U8CPU) instead.
+
+ This behaves the same as saveLayerAlpha(const SkRect*, U8CPU),
+ but it allows fine-grained control of which state bits to be saved
+ (and subsequently restored).
+
+ @param bounds (may be null) This rect, if non-null, is used as a hint to
+ limit the size of the offscreen, and thus drawing may be
+ clipped to it, though that clipping is not guaranteed to
+ happen. If exact clipping is desired, use clipRect().
+ @param alpha This is applied to the offscreen when restore() is called.
@param flags LayerFlags
@return The value to pass to restoreToCount() to balance this save()
*/
- int saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
- SaveFlags flags = kARGB_ClipLayer_SaveFlag);
+ SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
+ int saveLayerAlpha(const SkRect* bounds, U8CPU alpha, SaveFlags flags);
/** This call balances a previous call to save(), and is used to remove all
modifications to the matrix/clip/drawFilter state since the last save
@@ -1195,14 +1237,14 @@ protected:
virtual void onDrawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint);
-
+
virtual void onDrawPosText(const void* text, size_t byteLength,
const SkPoint pos[], const SkPaint& paint);
-
+
virtual void onDrawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint);
-
+
virtual void onDrawTextOnPath(const void* text, size_t byteLength,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint);
diff --git a/core/SkColorShader.h b/core/SkColorShader.h
index 56e5add..9e19a71 100644
--- a/core/SkColorShader.h
+++ b/core/SkColorShader.h
@@ -19,16 +19,11 @@
*/
class SK_API SkColorShader : public SkShader {
public:
- /** Create a ColorShader that will inherit its color from the Paint
- at draw time.
- */
- SkColorShader();
-
/** Create a ColorShader that ignores the color in the paint, and uses the
specified color. Note: like all shaders, at draw time the paint's alpha
will be respected, and is applied to the specified color.
*/
- SkColorShader(SkColor c);
+ explicit SkColorShader(SkColor c);
virtual bool isOpaque() const SK_OVERRIDE;
@@ -76,7 +71,6 @@ protected:
private:
SkColor fColor; // ignored if fInheritColor is true
- SkBool8 fInheritColor;
typedef SkShader INHERITED;
};
diff --git a/core/SkDrawLooper.h b/core/SkDrawLooper.h
index cc42952..b92bacc 100644
--- a/core/SkDrawLooper.h
+++ b/core/SkDrawLooper.h
@@ -10,7 +10,10 @@
#ifndef SkDrawLooper_DEFINED
#define SkDrawLooper_DEFINED
+#include "SkBlurTypes.h"
#include "SkFlattenable.h"
+#include "SkPoint.h"
+#include "SkColor.h"
class SkCanvas;
class SkPaint;
@@ -88,6 +91,24 @@ public:
virtual void computeFastBounds(const SkPaint& paint,
const SkRect& src, SkRect* dst) const;
+ struct BlurShadowRec {
+ SkScalar fSigma;
+ SkVector fOffset;
+ SkColor fColor;
+ SkBlurStyle fStyle;
+ SkBlurQuality fQuality;
+ };
+ /**
+ * If this looper can be interpreted as having two layers, such that
+ * 1. The first layer (bottom most) just has a blur and translate
+ * 2. The second layer has no modifications to either paint or canvas
+ * 3. No other layers.
+ * then return true, and if not null, fill out the BlurShadowRec).
+ *
+ * If any of the above are not met, return false and ignore the BlurShadowRec parameter.
+ */
+ virtual bool asABlurShadow(BlurShadowRec*) const;
+
SK_TO_STRING_PUREVIRT()
SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper)
diff --git a/core/SkEndian.h b/core/SkEndian.h
index 6eba297..0955fcc 100644
--- a/core/SkEndian.h
+++ b/core/SkEndian.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef SkEndian_DEFINED
#define SkEndian_DEFINED
@@ -29,10 +27,10 @@
/** Swap the two bytes in the low 16bits of the parameters.
e.g. 0x1234 -> 0x3412
*/
-static inline uint16_t SkEndianSwap16(U16CPU value) {
- SkASSERT(value == (uint16_t)value);
+static inline uint16_t SkEndianSwap16(uint16_t value) {
return static_cast<uint16_t>((value >> 8) | (value << 8));
}
+
template<uint16_t N> struct SkTEndianSwap16 {
static const uint16_t value = static_cast<uint16_t>((N >> 8) | ((N & 0xFF) << 8));
};
@@ -53,11 +51,12 @@ static inline void SkEndianSwap16s(uint16_t array[], int count) {
e.g. 0x12345678 -> 0x78563412
*/
static inline uint32_t SkEndianSwap32(uint32_t value) {
- return ((value & 0xFF) << 24) |
- ((value & 0xFF00) << 8) |
- ((value & 0xFF0000) >> 8) |
+ return ((value & 0xFF) << 24) |
+ ((value & 0xFF00) << 8) |
+ ((value & 0xFF0000) >> 8) |
(value >> 24);
}
+
template<uint32_t N> struct SkTEndianSwap32 {
static const uint32_t value = ((N & 0xFF) << 24) |
((N & 0xFF00) << 8) |
diff --git a/core/SkImageFilter.h b/core/SkImageFilter.h
index b3d7480..9cdd275 100644
--- a/core/SkImageFilter.h
+++ b/core/SkImageFilter.h
@@ -48,7 +48,7 @@ public:
uint32_t fFlags;
};
- class Cache : public SkRefCnt {
+ class SK_API Cache : public SkRefCnt {
public:
// By default, we cache only image filters with 2 or more children.
static Cache* Create(int minChildren = 2);
diff --git a/core/SkMaskFilter.h b/core/SkMaskFilter.h
index 3113c93..8051e7d 100644
--- a/core/SkMaskFilter.h
+++ b/core/SkMaskFilter.h
@@ -10,6 +10,7 @@
#ifndef SkMaskFilter_DEFINED
#define SkMaskFilter_DEFINED
+#include "SkBlurTypes.h"
#include "SkFlattenable.h"
#include "SkMask.h"
#include "SkPaint.h"
@@ -138,6 +139,18 @@ public:
*/
virtual void computeFastBounds(const SkRect& src, SkRect* dest) const;
+ struct BlurRec {
+ SkScalar fSigma;
+ SkBlurStyle fStyle;
+ SkBlurQuality fQuality;
+ };
+ /**
+ * If this filter can be represented by a BlurRec, return true and (if not null) fill in the
+ * provided BlurRec parameter. If this effect cannot be represented as a BlurRec, return false
+ * and ignore the BlurRec parameter.
+ */
+ virtual bool asABlur(BlurRec*) const;
+
SK_TO_STRING_PUREVIRT()
SK_DEFINE_FLATTENABLE_TYPE(SkMaskFilter)
diff --git a/core/SkPicture.h b/core/SkPicture.h
index 996d857..bd723e8 100644
--- a/core/SkPicture.h
+++ b/core/SkPicture.h
@@ -23,6 +23,7 @@ class SkBBoxHierarchy;
class SkCanvas;
class SkDrawPictureCallback;
class SkData;
+class SkPathHeap;
class SkPicturePlayback;
class SkPictureRecord;
class SkStream;
@@ -325,13 +326,14 @@ protected:
// V23: SkPaint::FilterLevel became a real enum
// V24: SkTwoPointConicalGradient now has fFlipped flag for gradient flipping
// V25: SkDashPathEffect now only writes phase and interval array when flattening
+ // V26: Removed boolean from SkColorShader for inheriting color from SkPaint.
// Note: If the picture version needs to be increased then please follow the
// steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw
// Only SKPs within the min/current picture version range (inclusive) can be read.
static const uint32_t MIN_PICTURE_VERSION = 19;
- static const uint32_t CURRENT_PICTURE_VERSION = 25;
+ static const uint32_t CURRENT_PICTURE_VERSION = 26;
mutable uint32_t fUniqueID;
@@ -358,6 +360,84 @@ protected:
SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint32_t recordFlags);
private:
+ friend class SkPictureRecord;
+ friend class SkPictureTester; // for unit testing
+
+ SkAutoTUnref<SkPathHeap> fPathHeap; // reference counted
+
+ // ContentInfo is not serialized! It is intended solely for use
+ // with suitableForGpuRasterization.
+ class ContentInfo {
+ public:
+ ContentInfo() { this->reset(); }
+
+ ContentInfo(const ContentInfo& src) { this->set(src); }
+
+ void set(const ContentInfo& src) {
+ fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses;
+ fNumAAConcavePaths = src.fNumAAConcavePaths;
+ fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths;
+ }
+
+ void reset() {
+ fNumPaintWithPathEffectUses = 0;
+ fNumAAConcavePaths = 0;
+ fNumAAHairlineConcavePaths = 0;
+ }
+
+ void swap(ContentInfo* other) {
+ SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectUses);
+ SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths);
+ SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths);
+ }
+
+ // This field is incremented every time a paint with a path effect is
+ // used (i.e., it is not a de-duplicated count)
+ int fNumPaintWithPathEffectUses;
+ // This field is incremented every time an anti-aliased drawPath call is
+ // issued with a concave path
+ int fNumAAConcavePaths;
+ // This field is incremented every time a drawPath call is
+ // issued for a hairline stroked concave path.
+ int fNumAAHairlineConcavePaths;
+ };
+
+ ContentInfo fContentInfo;
+
+ void incPaintWithPathEffectUses() {
+ ++fContentInfo.fNumPaintWithPathEffectUses;
+ }
+ int numPaintWithPathEffectUses() const {
+ return fContentInfo.fNumPaintWithPathEffectUses;
+ }
+
+ void incAAConcavePaths() {
+ ++fContentInfo.fNumAAConcavePaths;
+ }
+ int numAAConcavePaths() const {
+ return fContentInfo.fNumAAConcavePaths;
+ }
+
+ void incAAHairlineConcavePaths() {
+ ++fContentInfo.fNumAAHairlineConcavePaths;
+ SkASSERT(fContentInfo.fNumAAHairlineConcavePaths <= fContentInfo.fNumAAConcavePaths);
+ }
+ int numAAHairlineConcavePaths() const {
+ return fContentInfo.fNumAAHairlineConcavePaths;
+ }
+
+ const SkPath& getPath(int index) const;
+ int addPathToHeap(const SkPath& path);
+
+ void flattenToBuffer(SkWriteBuffer& buffer) const;
+ bool parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t size);
+
+ static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size);
+ static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size);
+
+ void initForPlayback() const;
+ void dumpSize() const;
+
// An OperationList encapsulates a set of operation offsets into the picture byte
// stream along with the CTMs needed for those operation.
class OperationList : ::SkNoncopyable {
diff --git a/core/SkPostConfig.h b/core/SkPostConfig.h
index 53b4adf..bee87e6 100644
--- a/core/SkPostConfig.h
+++ b/core/SkPostConfig.h
@@ -323,6 +323,14 @@
# define SK_ATTR_DEPRECATED(msg) SK_ATTRIBUTE(deprecated)
#endif
+#if !defined(SK_ATTR_EXTERNALLY_DEPRECATED)
+# if !defined(SK_INTERNAL)
+# define SK_ATTR_EXTERNALLY_DEPRECATED(msg) SK_ATTR_DEPRECATED(msg)
+# else
+# define SK_ATTR_EXTERNALLY_DEPRECATED(msg)
+# endif
+#endif
+
/**
* If your judgment is better than the compiler's (i.e. you've profiled it),
* you can use SK_ALWAYS_INLINE to force inlining. E.g.
diff --git a/core/SkReadBuffer.h b/core/SkReadBuffer.h
index f6b1919..dfd92ee 100644
--- a/core/SkReadBuffer.h
+++ b/core/SkReadBuffer.h
@@ -69,8 +69,8 @@ public:
SkReader32* getReader32() { return &fReader; }
- uint32_t size() { return fReader.size(); }
- uint32_t offset() { return fReader.offset(); }
+ size_t size() { return fReader.size(); }
+ size_t offset() { return fReader.offset(); }
bool eof() { return fReader.eof(); }
const void* skip(size_t size) { return fReader.skip(size); }
void* readFunctionPtr() { return fReader.readPtr(); }
diff --git a/core/SkReader32.h b/core/SkReader32.h
index 40ae12c..51e28ef 100644
--- a/core/SkReader32.h
+++ b/core/SkReader32.h
@@ -33,14 +33,14 @@ public:
fStop = (const char*)data + size;
}
- uint32_t size() const { return SkToU32(fStop - fBase); }
- uint32_t offset() const { return SkToU32(fCurr - fBase); }
+ size_t size() const { return fStop - fBase; }
+ size_t offset() const { return fCurr - fBase; }
bool eof() const { return fCurr >= fStop; }
const void* base() const { return fBase; }
const void* peek() const { return fCurr; }
- uint32_t available() const { return SkToU32(fStop - fCurr); }
- bool isAvailable(uint32_t size) const { return fCurr + size <= fStop; }
+ size_t available() const { return fStop - fCurr; }
+ bool isAvailable(size_t size) const { return size <= this->available(); }
void rewind() { fCurr = fBase; }
diff --git a/core/SkShader.h b/core/SkShader.h
index cc2cc75..4af8f78 100644
--- a/core/SkShader.h
+++ b/core/SkShader.h
@@ -34,7 +34,7 @@ class SK_API SkShader : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkShader)
- SkShader();
+ SkShader(const SkMatrix* localMatrix = NULL);
virtual ~SkShader();
/**
@@ -371,7 +371,8 @@ public:
* @return Returns a new shader object. Note: this function never returns null.
*/
static SkShader* CreateBitmapShader(const SkBitmap& src,
- TileMode tmx, TileMode tmy);
+ TileMode tmx, TileMode tmy,
+ const SkMatrix* localMatrix = NULL);
/** Call this to create a new shader that will draw with the specified picture.
*
diff --git a/effects/SkBlurDrawLooper.h b/effects/SkBlurDrawLooper.h
index fe945c3..75ed80e 100644
--- a/effects/SkBlurDrawLooper.h
+++ b/effects/SkBlurDrawLooper.h
@@ -61,10 +61,12 @@ protected:
SkBlurDrawLooper(SkReadBuffer&);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+ virtual bool asABlurShadow(BlurShadowRec*) const SK_OVERRIDE;
+
private:
SkMaskFilter* fBlur;
SkColorFilter* fColorFilter;
- SkScalar fDx, fDy;
+ SkScalar fDx, fDy, fSigma;
SkColor fBlurColor;
uint32_t fBlurFlags;
@@ -86,6 +88,7 @@ private:
};
void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);
+ void initEffects();
typedef SkDrawLooper INHERITED;
};
diff --git a/effects/SkBlurMaskFilter.h b/effects/SkBlurMaskFilter.h
index 9b352dc..ddb163e 100644
--- a/effects/SkBlurMaskFilter.h
+++ b/effects/SkBlurMaskFilter.h
@@ -11,17 +11,20 @@
// we include this since our callers will need to at least be able to ref/unref
#include "SkMaskFilter.h"
#include "SkScalar.h"
+#include "SkBlurTypes.h"
class SK_API SkBlurMaskFilter {
public:
+#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE
enum BlurStyle {
- kNormal_BlurStyle, //!< fuzzy inside and outside
- kSolid_BlurStyle, //!< solid inside, fuzzy outside
- kOuter_BlurStyle, //!< nothing inside, fuzzy outside
- kInner_BlurStyle, //!< fuzzy inside, nothing outside
+ kNormal_BlurStyle = kNormal_SkBlurStyle, //!< fuzzy inside and outside
+ kSolid_BlurStyle = kSolid_SkBlurStyle, //!< solid inside, fuzzy outside
+ kOuter_BlurStyle = kOuter_SkBlurStyle, //!< nothing inside, fuzzy outside
+ kInner_BlurStyle = kInner_SkBlurStyle, //!< fuzzy inside, nothing outside
kBlurStyleCount
};
+#endif
enum BlurFlags {
kNone_BlurFlag = 0x00,
@@ -33,6 +36,7 @@ public:
kAll_BlurFlag = 0x03
};
+#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE
SK_ATTR_DEPRECATED("use sigma version")
static SkMaskFilter* Create(SkScalar radius, BlurStyle style,
uint32_t flags = kNone_BlurFlag);
@@ -45,6 +49,15 @@ public:
*/
static SkMaskFilter* Create(BlurStyle style, SkScalar sigma,
uint32_t flags = kNone_BlurFlag);
+#endif
+
+ /** Create a blur maskfilter.
+ * @param style The SkBlurStyle to use
+ * @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
+ * @param flags Flags to use - defaults to none
+ * @return The new blur maskfilter
+ */
+ static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flags = kNone_BlurFlag);
/** Create an emboss maskfilter
@param blurSigma standard deviation of the Gaussian blur to apply
diff --git a/effects/SkEmbossMaskFilter.h b/effects/SkEmbossMaskFilter.h
index eb8f811..65dbbe7 100644
--- a/effects/SkEmbossMaskFilter.h
+++ b/effects/SkEmbossMaskFilter.h
@@ -23,9 +23,7 @@ public:
uint8_t fSpecular; // exponent, 4.4 right now
};
- static SkEmbossMaskFilter* Create(SkScalar blurSigma, const Light& light) {
- return SkNEW_ARGS(SkEmbossMaskFilter, (blurSigma, light));
- }
+ static SkEmbossMaskFilter* Create(SkScalar blurSigma, const Light& light);
// overrides from SkMaskFilter
// This method is not exported to java.
diff --git a/effects/SkGradientShader.h b/effects/SkGradientShader.h
index ed0f1bf..871b34a 100644
--- a/effects/SkGradientShader.h
+++ b/effects/SkGradientShader.h
@@ -49,7 +49,8 @@ public:
const SkColor colors[], const SkScalar pos[], int count,
SkShader::TileMode mode,
SkUnitMapper* mapper = NULL,
- uint32_t flags = 0);
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/** Returns a shader that generates a radial gradient given the center and radius.
<p />
@@ -72,7 +73,8 @@ public:
const SkColor colors[], const SkScalar pos[], int count,
SkShader::TileMode mode,
SkUnitMapper* mapper = NULL,
- uint32_t flags = 0);
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/** Returns a shader that generates a radial gradient given the start position, start radius, end position and end radius.
<p />
@@ -102,7 +104,8 @@ public:
const SkScalar pos[], int count,
SkShader::TileMode mode,
SkUnitMapper* mapper = NULL,
- uint32_t flags = 0);
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/**
* Returns a shader that generates a conical gradient given two circles, or
@@ -118,7 +121,8 @@ public:
const SkScalar pos[], int count,
SkShader::TileMode mode,
SkUnitMapper* mapper = NULL,
- uint32_t flags = 0);
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/** Returns a shader that generates a sweep gradient given a center.
<p />
@@ -139,7 +143,8 @@ public:
static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
const SkColor colors[], const SkScalar pos[],
int count, SkUnitMapper* mapper = NULL,
- uint32_t flags = 0);
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
};
diff --git a/effects/SkLayerDrawLooper.h b/effects/SkLayerDrawLooper.h
index fe660a8..ac56e28 100644
--- a/effects/SkLayerDrawLooper.h
+++ b/effects/SkLayerDrawLooper.h
@@ -77,6 +77,8 @@ public:
virtual size_t contextSize() const SK_OVERRIDE { return sizeof(LayerDrawLooperContext); }
+ virtual bool asABlurShadow(BlurShadowRec* rec) const SK_OVERRIDE;
+
SK_TO_STRING_OVERRIDE()
/// Implements Flattenable.
diff --git a/effects/SkMatrixConvolutionImageFilter.h b/effects/SkMatrixConvolutionImageFilter.h
index 5b02fba..ee1bfcf 100644
--- a/effects/SkMatrixConvolutionImageFilter.h
+++ b/effects/SkMatrixConvolutionImageFilter.h
@@ -73,6 +73,8 @@ protected:
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
+
#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect,
diff --git a/effects/SkTileImageFilter.h b/effects/SkTileImageFilter.h
index 6c0fa68..c26ae9a 100644
--- a/effects/SkTileImageFilter.h
+++ b/effects/SkTileImageFilter.h
@@ -26,6 +26,8 @@ public:
virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+ SkIRect* dst) const SK_OVERRIDE;
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter)
diff --git a/gpu/SkGr.h b/gpu/SkGr.h
index 2d0418b..1f3c5af 100644
--- a/gpu/SkGr.h
+++ b/gpu/SkGr.h
@@ -51,6 +51,11 @@ GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff);
*/
GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config);
GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType);
+
+static inline GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info) {
+ return SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType());
+}
+
bool GrPixelConfig2ColorType(GrPixelConfig, SkColorType*);
static inline GrColor SkColor2GrColor(SkColor c) {
diff --git a/gpu/gl/GrGLFunctions.h b/gpu/gl/GrGLFunctions.h
index a6bfd4a..3f87365 100644
--- a/gpu/gl/GrGLFunctions.h
+++ b/gpu/gl/GrGLFunctions.h
@@ -175,9 +175,6 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilMaskSeparateProc)(GrGLenum face, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilOpProc)(GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilOpSeparateProc)(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGenfProc)(GrGLenum coord, GrGLenum pname, GrGLfloat param);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGenfvProc)(GrGLenum coord, GrGLenum pname, const GrGLfloat* params);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGeniProc)(GrGLenum coord, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexImage2DProc)(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameterivProc)(GrGLenum target, GrGLenum pname, const GrGLint* params);
@@ -214,9 +211,8 @@ extern "C" {
// Experimental: Functions for GL_NV_path_rendering. These will be
// alphabetized with the above functions once this is fully supported
// (and functions we are unlikely to use will possibly be omitted).
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixModeProc)(GrGLenum);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLoadIdentityProc)();
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLoadMatrixfProc)(const GrGLfloat* m);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixLoadfProc)(GrGLenum matrixMode, const GrGLfloat* m);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixLoadIdentityProc)(GrGLenum);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathCommandsProc)(GrGLuint path, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathCoordsProc)(GrGLuint path, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathSubCommandsProc)(GrGLuint path, GrGLsizei commandStart, GrGLsizei commandsToDelete, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords);
diff --git a/gpu/gl/GrGLInterface.h b/gpu/gl/GrGLInterface.h
index f206c6b..9070af2 100644
--- a/gpu/gl/GrGLInterface.h
+++ b/gpu/gl/GrGLInterface.h
@@ -230,12 +230,11 @@ public:
GLPtr<GrGLInvalidateTexSubImageProc> fInvalidateTexSubImage;
GLPtr<GrGLLineWidthProc> fLineWidth;
GLPtr<GrGLLinkProgramProc> fLinkProgram;
- GLPtr<GrGLLoadIdentityProc> fLoadIdentity;
- GLPtr<GrGLLoadMatrixfProc> fLoadMatrixf;
GLPtr<GrGLMapBufferProc> fMapBuffer;
GLPtr<GrGLMapBufferSubDataProc> fMapBufferSubData;
GLPtr<GrGLMapTexSubImage2DProc> fMapTexSubImage2D;
- GLPtr<GrGLMatrixModeProc> fMatrixMode;
+ GLPtr<GrGLMatrixLoadfProc> fMatrixLoadf;
+ GLPtr<GrGLMatrixLoadIdentityProc> fMatrixLoadIdentity;
GLPtr<GrGLPixelStoreiProc> fPixelStorei;
GLPtr<GrGLPopGroupMarkerProc> fPopGroupMarker;
GLPtr<GrGLPushGroupMarkerProc> fPushGroupMarker;
@@ -279,8 +278,6 @@ public:
GLPtr<GrGLStencilMaskSeparateProc> fStencilMaskSeparate;
GLPtr<GrGLStencilOpProc> fStencilOp;
GLPtr<GrGLStencilOpSeparateProc> fStencilOpSeparate;
- GLPtr<GrGLTexGenfvProc> fTexGenfv;
- GLPtr<GrGLTexGeniProc> fTexGeni;
GLPtr<GrGLTexImage2DProc> fTexImage2D;
GLPtr<GrGLTexParameteriProc> fTexParameteri;
GLPtr<GrGLTexParameterivProc> fTexParameteriv;
diff --git a/record/SkRecording.h b/record/SkRecording.h
index 0d04b90..a4e8809 100644
--- a/record/SkRecording.h
+++ b/record/SkRecording.h
@@ -8,8 +8,10 @@
#ifndef SkRecording_DEFINED
#define SkRecording_DEFINED
-#include "SkCanvas.h" // SkCanvas
-#include "SkTypes.h" // SkNoncopyable
+#include "SkCanvas.h" // SkCanvas
+#include "SkRefCnt.h" // SkAutoTUnref
+#include "SkTemplates.h" // SkAutoTDelete
+#include "SkTypes.h" // SkNoncopyable
// These are intentionally left opaque.
class SkRecord;
@@ -19,21 +21,22 @@ namespace EXPERIMENTAL {
/** Easy mode interface to SkRecord-based SkCanvas recording.
*
- * SkRecording* recording = SkRecording::Create(1920, 1080);
+ * scoped_ptr<SkRecording> recording(new SkRecording(1920, 1080));
+ * skia::RefPtr<SkCanvas> canvas(skia::SharePtr(recording->canvas()));
*
- * SkCanvas* canvas = recording->canvas();
* canvas->drawThis();
* canvas->clipThat();
* ...
*
- * scoped_ptr<const SkPlayback> playback(SkRecording::Delete(recording));
+ * canvas.clear(); // You must deref the canvas before you may call releasePlayback().
+ * scoped_ptr<const SkPlayback> playback(recording->releasePlayback());
* playback->draw(&someCanvas);
* playback->draw(&someOtherCanvas);
*
* SkPlayback is thread safe; SkRecording is not.
*/
-class SkPlayback : SkNoncopyable {
+class SK_API SkPlayback : SkNoncopyable {
public:
// Remember, if you've got an SkPlayback*, you probably own it. Don't forget to delete it!
~SkPlayback();
@@ -44,29 +47,27 @@ public:
private:
explicit SkPlayback(const SkRecord*);
- const SkRecord* fRecord;
+ SkAutoTDelete<const SkRecord> fRecord;
friend class SkRecording;
};
-class SkRecording : SkNoncopyable {
+class SK_API SkRecording : SkNoncopyable {
public:
- // Result must be returned via SkRecording::Delete.
- static SkRecording* Create(int width, int height);
-
- // Caller takes ownership of SkPlayback.
- static const SkPlayback* Delete(SkRecording*);
+ SkRecording(int width, int height);
+ ~SkRecording();
// Draws issued to this canvas will be replayed by SkPlayback::draw().
- // This pointer is owned by the SkRecording; the caller must not take ownership.
+ // Any refs held on canvas() must be dropped before you may call releasePlayback().
SkCanvas* canvas();
-private:
- SkRecording(int width, int height);
- ~SkRecording();
+ // Release exclusive ownership of an SkPlayback to the caller.
+ // Any refs held on canvas() must be dropped before you may call releasePlayback().
+ SkPlayback* releasePlayback();
- SkRecorder* fRecorder;
- SkRecord* fRecord;
+private:
+ SkAutoTDelete<SkRecord> fRecord;
+ SkAutoTUnref<SkRecorder> fRecorder;
};
} // namespace EXPERIMENTAL