summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Chromium Automerger <chromium-automerger@android>2014-04-28 17:10:16 +0000
committerAndroid Chromium Automerger <chromium-automerger@android>2014-04-28 17:10:16 +0000
commit6322cd380b2b87a29d5d70b0e1972041edc2c436 (patch)
treef3471243e83b9225837c9a2b8204b7eac527210c
parent14f76c2134352b2dcfc93a082922ff55079a8044 (diff)
parent01b0da4230d5ffe8a656a413058037194606d45f (diff)
downloadinclude-6322cd380b2b87a29d5d70b0e1972041edc2c436.tar.gz
Merge third_party/skia/include from https://chromium.googlesource.com/external/skia/include.git at 01b0da4230d5ffe8a656a413058037194606d45f
This commit was generated by merge_from_chromium.py. Change-Id: I8976a9f0a3ba986fa98e6791d24344a4b21b4811
-rw-r--r--core/SkCanvas.h52
-rw-r--r--core/SkColorShader.h8
-rw-r--r--core/SkPicture.h64
-rw-r--r--core/SkPostConfig.h8
-rw-r--r--gpu/gl/GrGLFunctions.h5
-rw-r--r--gpu/gl/GrGLInterface.h5
-rw-r--r--record/SkRecording.h35
7 files changed, 141 insertions, 36 deletions
diff --git a/core/SkCanvas.h b/core/SkCanvas.h
index 562999d..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
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/SkPicture.h b/core/SkPicture.h
index e44f697..bd723e8 100644
--- a/core/SkPicture.h
+++ b/core/SkPicture.h
@@ -326,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;
@@ -364,6 +365,67 @@ private:
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);
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/gpu/gl/GrGLFunctions.h b/gpu/gl/GrGLFunctions.h
index 5dc3dee..3f87365 100644
--- a/gpu/gl/GrGLFunctions.h
+++ b/gpu/gl/GrGLFunctions.h
@@ -211,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 fd22792..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;
diff --git a/record/SkRecording.h b/record/SkRecording.h
index 0d04b90..2716ea6 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,14 +21,15 @@ 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);
*
@@ -44,29 +47,27 @@ public:
private:
explicit SkPlayback(const SkRecord*);
- const SkRecord* fRecord;
+ SkAutoTDelete<const SkRecord> fRecord;
friend class SkRecording;
};
class 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