summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2014-03-31 16:52:13 -0400
committerLeon Scroggins III <scroggo@google.com>2014-04-04 14:42:39 -0400
commitcc11f15f76a62ded3e403cb2bc818c6aa5bf261c (patch)
tree1df94766a0343820a8b542d3a79705a33d9fcf59
parent35dec44394358bac2cdf31d5e8377687a1723476 (diff)
downloadframeworks_base-cc11f15f76a62ded3e403cb2bc818c6aa5bf261c.zip
frameworks_base-cc11f15f76a62ded3e403cb2bc818c6aa5bf261c.tar.gz
frameworks_base-cc11f15f76a62ded3e403cb2bc818c6aa5bf261c.tar.bz2
Update to call new Skia APIs.
I816129d49c0118453222916f3c818eccac33663d merges a new version of Skia that updates various APIs. Call the new ones. SkBitmap::copyTo now takes an SkColorType instead of an SkBitmap::Config, so do the conversion with SkBitmapConfigToColorType or use the enum when it makes sense. Call SkImageDecoder::decodeSubset instead of (deprecated) SkImageDecoder::decodeRegion. Override SkCanvas::ClipVisitor::clipRRect in ClipCopier. In Canvas::clip calls, call SkCanvas::isClipEmpty(), which was previously called inside the clip call, to determine the return value. For various SkPaint effects, call the new factories (as the constructors have been made protected). Implement SkJavaOutputStream::bytesWritten(), overriding a new pure virtual function on SkWStream. Update Matrix calls to always return true (since SkMatrix calls no longer return a value). Depends on I816129d49c0118453222916f3c818eccac33663d (skia). Change-Id: I5cdcea827ebff587df0bbddc0965e3e0fbf48002
-rw-r--r--core/jni/android/graphics/Bitmap.cpp2
-rw-r--r--core/jni/android/graphics/BitmapFactory.cpp2
-rw-r--r--core/jni/android/graphics/BitmapRegionDecoder.cpp2
-rw-r--r--core/jni/android/graphics/Canvas.cpp44
-rw-r--r--core/jni/android/graphics/ColorFilter.cpp2
-rw-r--r--core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp8
-rw-r--r--core/jni/android/graphics/MaskFilter.cpp2
-rw-r--r--core/jni/android/graphics/Matrix.cpp102
-rw-r--r--core/jni/android/graphics/PathEffect.cpp12
-rw-r--r--core/jni/android/graphics/Xfermode.cpp4
-rw-r--r--graphics/java/android/graphics/Matrix.java134
-rw-r--r--libs/input/SpriteController.cpp2
-rw-r--r--libs/input/SpriteController.h2
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp2
14 files changed, 179 insertions, 141 deletions
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 310966c..e0fa9ba 100644
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -329,7 +329,7 @@ static jobject Bitmap_copy(JNIEnv* env, jobject, jlong srcHandle,
SkBitmap result;
JavaPixelAllocator allocator(env);
- if (!src->copyTo(&result, dstConfig, &allocator)) {
+ if (!src->copyTo(&result, SkBitmapConfigToColorType(dstConfig), &allocator)) {
return NULL;
}
return GraphicsJNI::createBitmap(env, new SkBitmap(result), allocator.getStorageObj(),
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index b89dced..7aa241a 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -151,7 +151,7 @@ static SkColorType colorTypeForScaledOutput(SkColorType colorType) {
switch (colorType) {
case kUnknown_SkColorType:
case kIndex_8_SkColorType:
- return kPMColor_SkColorType;
+ return kNative_8888_SkColorType;
default:
break;
}
diff --git a/core/jni/android/graphics/BitmapRegionDecoder.cpp b/core/jni/android/graphics/BitmapRegionDecoder.cpp
index 098643b..ead2de3 100644
--- a/core/jni/android/graphics/BitmapRegionDecoder.cpp
+++ b/core/jni/android/graphics/BitmapRegionDecoder.cpp
@@ -62,7 +62,7 @@ public:
bool decodeRegion(SkBitmap* bitmap, const SkIRect& rect,
SkBitmap::Config pref, int sampleSize) {
fDecoder->setSampleSize(sampleSize);
- return fDecoder->decodeRegion(bitmap, rect, pref);
+ return fDecoder->decodeSubset(bitmap, rect, pref);
}
SkImageDecoder* getDecoder() const { return fDecoder; }
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 946b898..27ed0f6 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -65,6 +65,9 @@ public:
virtual void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) {
m_dstCanvas->clipRect(rect, op, antialias);
}
+ virtual void clipRRect(const SkRRect& rrect, SkRegion::Op op, bool antialias) {
+ m_dstCanvas->clipRRect(rrect, op, antialias);
+ }
virtual void clipPath(const SkPath& path, SkRegion::Op op, bool antialias) {
m_dstCanvas->clipPath(path, op, antialias);
}
@@ -73,6 +76,12 @@ private:
SkCanvas* m_dstCanvas;
};
+// Returns true if the SkCanvas's clip is non-empty.
+static jboolean hasNonEmptyClip(const SkCanvas& canvas) {
+ bool emptyClip = canvas.isClipEmpty();
+ return emptyClip ? JNI_FALSE : JNI_TRUE;
+}
+
class SkCanvasGlue {
public:
@@ -281,8 +290,8 @@ public:
r.set(SkFloatToScalar(left), SkFloatToScalar(top),
SkFloatToScalar(right), SkFloatToScalar(bottom));
SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
- bool result = c->clipRect(r);
- return result ? JNI_TRUE : JNI_FALSE;
+ c->clipRect(r);
+ return hasNonEmptyClip(*c);
}
static jboolean clipRect_IIII(JNIEnv* env, jobject jcanvas, jint left,
@@ -291,8 +300,9 @@ public:
SkRect r;
r.set(SkIntToScalar(left), SkIntToScalar(top),
SkIntToScalar(right), SkIntToScalar(bottom));
- bool result = GraphicsJNI::getNativeCanvas(env, jcanvas)->clipRect(r);
- return result ? JNI_TRUE : JNI_FALSE;
+ SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
+ c->clipRect(r);
+ return hasNonEmptyClip(*c);
}
static jboolean clipRect_RectF(JNIEnv* env, jobject jcanvas, jobject rectf) {
@@ -300,8 +310,8 @@ public:
NPE_CHECK_RETURN_ZERO(env, rectf);
SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
SkRect tmp;
- bool result = c->clipRect(*GraphicsJNI::jrectf_to_rect(env, rectf, &tmp));
- return result ? JNI_TRUE : JNI_FALSE;
+ c->clipRect(*GraphicsJNI::jrectf_to_rect(env, rectf, &tmp));
+ return hasNonEmptyClip(*c);
}
static jboolean clipRect_Rect(JNIEnv* env, jobject jcanvas, jobject rect) {
@@ -309,8 +319,8 @@ public:
NPE_CHECK_RETURN_ZERO(env, rect);
SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
SkRect tmp;
- bool result = c->clipRect(*GraphicsJNI::jrect_to_rect(env, rect, &tmp));
- return result ? JNI_TRUE : JNI_FALSE;
+ c->clipRect(*GraphicsJNI::jrect_to_rect(env, rect, &tmp));
+ return hasNonEmptyClip(*c);
}
@@ -321,25 +331,24 @@ public:
SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
rect.set(SkFloatToScalar(left), SkFloatToScalar(top),
SkFloatToScalar(right), SkFloatToScalar(bottom));
- bool result = canvas->clipRect(rect, static_cast<SkRegion::Op>(op));
- return result ? JNI_TRUE : JNI_FALSE;
-
+ canvas->clipRect(rect, static_cast<SkRegion::Op>(op));
+ return hasNonEmptyClip(*canvas);
}
static jboolean clipPath(JNIEnv* env, jobject, jlong canvasHandle,
jlong pathHandle, jint op) {
SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
- bool result = canvas->clipPath(*reinterpret_cast<SkPath*>(pathHandle),
- static_cast<SkRegion::Op>(op));
- return result ? JNI_TRUE : JNI_FALSE;
+ canvas->clipPath(*reinterpret_cast<SkPath*>(pathHandle),
+ static_cast<SkRegion::Op>(op));
+ return hasNonEmptyClip(*canvas);
}
static jboolean clipRegion(JNIEnv* env, jobject, jlong canvasHandle,
jlong deviceRgnHandle, jint op) {
SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
SkRegion* deviceRgn = reinterpret_cast<SkRegion*>(deviceRgnHandle);
- bool result = canvas->clipRegion(*deviceRgn, static_cast<SkRegion::Op>(op));
- return result ? JNI_TRUE : JNI_FALSE;
+ canvas->clipRegion(*deviceRgn, static_cast<SkRegion::Op>(op));
+ return hasNonEmptyClip(*canvas);
}
static void setDrawFilter(JNIEnv* env, jobject, jlong canvasHandle,
@@ -353,7 +362,8 @@ public:
SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
SkRect rect_;
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
- return canvas->quickReject(rect_);
+ bool result = canvas->quickReject(rect_);
+ return result ? JNI_TRUE : JNI_FALSE;
}
static jboolean quickReject__Path(JNIEnv* env, jobject, jlong canvasHandle,
diff --git a/core/jni/android/graphics/ColorFilter.cpp b/core/jni/android/graphics/ColorFilter.cpp
index a59ed19..c66c844 100644
--- a/core/jni/android/graphics/ColorFilter.cpp
+++ b/core/jni/android/graphics/ColorFilter.cpp
@@ -51,7 +51,7 @@ public:
const float* src = autoArray.ptr();
#ifdef SK_SCALAR_IS_FLOAT
- return reinterpret_cast<jlong>(new SkColorMatrixFilter(src));
+ return reinterpret_cast<jlong>(SkColorMatrixFilter::Create(src));
#else
SkASSERT(false);
#endif
diff --git a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
index 2cb1015..b64ab0d 100644
--- a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
+++ b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
@@ -175,10 +175,14 @@ static jmethodID gOutputStream_flushMethodID;
class SkJavaOutputStream : public SkWStream {
public:
SkJavaOutputStream(JNIEnv* env, jobject stream, jbyteArray storage)
- : fEnv(env), fJavaOutputStream(stream), fJavaByteArray(storage) {
+ : fEnv(env), fJavaOutputStream(stream), fJavaByteArray(storage), fBytesWritten(0) {
fCapacity = env->GetArrayLength(storage);
}
+ virtual size_t bytesWritten() const {
+ return fBytesWritten;
+ }
+
virtual bool write(const void* buffer, size_t size) {
JNIEnv* env = fEnv;
jbyteArray storage = fJavaByteArray;
@@ -213,6 +217,7 @@ public:
buffer = (void*)((char*)buffer + requested);
size -= requested;
+ fBytesWritten += requested;
}
return true;
}
@@ -226,6 +231,7 @@ private:
jobject fJavaOutputStream; // the caller owns this object
jbyteArray fJavaByteArray; // the caller owns this object
jint fCapacity;
+ size_t fBytesWritten;
};
SkWStream* CreateJavaOutputStreamAdaptor(JNIEnv* env, jobject stream,
diff --git a/core/jni/android/graphics/MaskFilter.cpp b/core/jni/android/graphics/MaskFilter.cpp
index 5573366..7dc0446 100644
--- a/core/jni/android/graphics/MaskFilter.cpp
+++ b/core/jni/android/graphics/MaskFilter.cpp
@@ -45,7 +45,7 @@ public:
static jlong createTable(JNIEnv* env, jobject, jbyteArray jtable) {
AutoJavaByteArray autoTable(env, jtable, 256);
- SkMaskFilter* filter = new SkTableMaskFilter((const uint8_t*)autoTable.ptr());
+ SkMaskFilter* filter = SkTableMaskFilter::Create((const uint8_t*)autoTable.ptr());
return reinterpret_cast<jlong>(filter);
}
diff --git a/core/jni/android/graphics/Matrix.cpp b/core/jni/android/graphics/Matrix.cpp
index c400c57..d573aa8 100644
--- a/core/jni/android/graphics/Matrix.cpp
+++ b/core/jni/android/graphics/Matrix.cpp
@@ -123,129 +123,129 @@ public:
SkScalar ky_ = SkFloatToScalar(ky);
obj->setSkew(kx_, ky_);
}
- static jboolean setConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong aHandle, jlong bHandle) {
+ static void setConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong aHandle, jlong bHandle) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkMatrix* a = reinterpret_cast<SkMatrix*>(aHandle);
SkMatrix* b = reinterpret_cast<SkMatrix*>(bHandle);
- return obj->setConcat(*a, *b) ? JNI_TRUE : JNI_FALSE;
+ obj->setConcat(*a, *b);
}
- static jboolean preTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ static void preTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
- return obj->preTranslate(dx_, dy_) ? JNI_TRUE : JNI_FALSE;
+ obj->preTranslate(dx_, dy_);
}
- static jboolean preScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+ static void preScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->preScale(sx_, sy_, px_, py_) ? JNI_TRUE : JNI_FALSE;
+ obj->preScale(sx_, sy_, px_, py_);
}
- static jboolean preScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+ static void preScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
- return obj->preScale(sx_, sy_) ? JNI_TRUE : JNI_FALSE;
+ obj->preScale(sx_, sy_);
}
- static jboolean preRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+ static void preRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->preRotate(degrees_, px_, py_) ? JNI_TRUE : JNI_FALSE;
+ obj->preRotate(degrees_, px_, py_);
}
- static jboolean preRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+ static void preRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
- return obj->preRotate(degrees_) ? JNI_TRUE : JNI_FALSE;
+ obj->preRotate(degrees_);
}
- static jboolean preSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+ static void preSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->preSkew(kx_, ky_, px_, py_) ? JNI_TRUE : JNI_FALSE;
+ obj->preSkew(kx_, ky_, px_, py_);
}
- static jboolean preSkew__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky) {
+ static void preSkew__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
- return obj->preSkew(kx_, ky_) ? JNI_TRUE : JNI_FALSE;
+ obj->preSkew(kx_, ky_);
}
- static jboolean preConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong otherHandle) {
+ static void preConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong otherHandle) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
- return obj->preConcat(*other) ? JNI_TRUE : JNI_FALSE;
+ obj->preConcat(*other);
}
- static jboolean postTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ static void postTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
- return obj->postTranslate(dx_, dy_) ? JNI_TRUE : JNI_FALSE;
+ obj->postTranslate(dx_, dy_);
}
- static jboolean postScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+ static void postScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->postScale(sx_, sy_, px_, py_) ? JNI_TRUE : JNI_FALSE;
+ obj->postScale(sx_, sy_, px_, py_);
}
- static jboolean postScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+ static void postScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
- return obj->postScale(sx_, sy_) ? JNI_TRUE : JNI_FALSE;
+ obj->postScale(sx_, sy_);
}
- static jboolean postRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+ static void postRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->postRotate(degrees_, px_, py_) ? JNI_TRUE : JNI_FALSE;
+ obj->postRotate(degrees_, px_, py_);
}
- static jboolean postRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+ static void postRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
- return obj->postRotate(degrees_) ? JNI_TRUE : JNI_FALSE;
+ obj->postRotate(degrees_);
}
- static jboolean postSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+ static void postSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->postSkew(kx_, ky_, px_, py_) ? JNI_TRUE : JNI_FALSE;
+ obj->postSkew(kx_, ky_, px_, py_);
}
- static jboolean postSkew__FF(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloat kx, jfloat ky) {
+ static void postSkew__FF(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloat kx, jfloat ky) {
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
- return matrix->postSkew(kx_, ky_) ? JNI_TRUE : JNI_FALSE;
+ matrix->postSkew(kx_, ky_);
}
- static jboolean postConcat(JNIEnv* env, jobject clazz, jlong matrixHandle, jlong otherHandle) {
+ static void postConcat(JNIEnv* env, jobject clazz, jlong matrixHandle, jlong otherHandle) {
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
- return matrix->postConcat(*other) ? JNI_TRUE : JNI_FALSE;
+ matrix->postConcat(*other);
}
static jboolean setRectToRect(JNIEnv* env, jobject clazz, jlong matrixHandle, jobject src, jobject dst, jint stfHandle) {
@@ -374,23 +374,23 @@ static JNINativeMethod methods[] = {
{"native_setSinCos","(JFF)V", (void*) SkMatrixGlue::setSinCos__FF},
{"native_setSkew","(JFFFF)V", (void*) SkMatrixGlue::setSkew__FFFF},
{"native_setSkew","(JFF)V", (void*) SkMatrixGlue::setSkew__FF},
- {"native_setConcat","(JJJ)Z", (void*) SkMatrixGlue::setConcat},
- {"native_preTranslate","(JFF)Z", (void*) SkMatrixGlue::preTranslate},
- {"native_preScale","(JFFFF)Z", (void*) SkMatrixGlue::preScale__FFFF},
- {"native_preScale","(JFF)Z", (void*) SkMatrixGlue::preScale__FF},
- {"native_preRotate","(JFFF)Z", (void*) SkMatrixGlue::preRotate__FFF},
- {"native_preRotate","(JF)Z", (void*) SkMatrixGlue::preRotate__F},
- {"native_preSkew","(JFFFF)Z", (void*) SkMatrixGlue::preSkew__FFFF},
- {"native_preSkew","(JFF)Z", (void*) SkMatrixGlue::preSkew__FF},
- {"native_preConcat","(JJ)Z", (void*) SkMatrixGlue::preConcat},
- {"native_postTranslate","(JFF)Z", (void*) SkMatrixGlue::postTranslate},
- {"native_postScale","(JFFFF)Z", (void*) SkMatrixGlue::postScale__FFFF},
- {"native_postScale","(JFF)Z", (void*) SkMatrixGlue::postScale__FF},
- {"native_postRotate","(JFFF)Z", (void*) SkMatrixGlue::postRotate__FFF},
- {"native_postRotate","(JF)Z", (void*) SkMatrixGlue::postRotate__F},
- {"native_postSkew","(JFFFF)Z", (void*) SkMatrixGlue::postSkew__FFFF},
- {"native_postSkew","(JFF)Z", (void*) SkMatrixGlue::postSkew__FF},
- {"native_postConcat","(JJ)Z", (void*) SkMatrixGlue::postConcat},
+ {"native_setConcat","(JJJ)V", (void*) SkMatrixGlue::setConcat},
+ {"native_preTranslate","(JFF)V", (void*) SkMatrixGlue::preTranslate},
+ {"native_preScale","(JFFFF)V", (void*) SkMatrixGlue::preScale__FFFF},
+ {"native_preScale","(JFF)V", (void*) SkMatrixGlue::preScale__FF},
+ {"native_preRotate","(JFFF)V", (void*) SkMatrixGlue::preRotate__FFF},
+ {"native_preRotate","(JF)V", (void*) SkMatrixGlue::preRotate__F},
+ {"native_preSkew","(JFFFF)V", (void*) SkMatrixGlue::preSkew__FFFF},
+ {"native_preSkew","(JFF)V", (void*) SkMatrixGlue::preSkew__FF},
+ {"native_preConcat","(JJ)V", (void*) SkMatrixGlue::preConcat},
+ {"native_postTranslate","(JFF)V", (void*) SkMatrixGlue::postTranslate},
+ {"native_postScale","(JFFFF)V", (void*) SkMatrixGlue::postScale__FFFF},
+ {"native_postScale","(JFF)V", (void*) SkMatrixGlue::postScale__FF},
+ {"native_postRotate","(JFFF)V", (void*) SkMatrixGlue::postRotate__FFF},
+ {"native_postRotate","(JF)V", (void*) SkMatrixGlue::postRotate__F},
+ {"native_postSkew","(JFFFF)V", (void*) SkMatrixGlue::postSkew__FFFF},
+ {"native_postSkew","(JFF)V", (void*) SkMatrixGlue::postSkew__FF},
+ {"native_postConcat","(JJ)V", (void*) SkMatrixGlue::postConcat},
{"native_setRectToRect","(JLandroid/graphics/RectF;Landroid/graphics/RectF;I)Z", (void*) SkMatrixGlue::setRectToRect},
{"native_setPolyToPoly","(J[FI[FII)Z", (void*) SkMatrixGlue::setPolyToPoly},
{"native_invert","(JJ)Z", (void*) SkMatrixGlue::invert},
diff --git a/core/jni/android/graphics/PathEffect.cpp b/core/jni/android/graphics/PathEffect.cpp
index 2803758..81b46ce 100644
--- a/core/jni/android/graphics/PathEffect.cpp
+++ b/core/jni/android/graphics/PathEffect.cpp
@@ -20,7 +20,7 @@ public:
jlong outerHandle, jlong innerHandle) {
SkPathEffect* outer = reinterpret_cast<SkPathEffect*>(outerHandle);
SkPathEffect* inner = reinterpret_cast<SkPathEffect*>(innerHandle);
- SkPathEffect* effect = new SkComposePathEffect(outer, inner);
+ SkPathEffect* effect = SkComposePathEffect::Create(outer, inner);
return reinterpret_cast<jlong>(effect);
}
@@ -28,7 +28,7 @@ public:
jlong firstHandle, jlong secondHandle) {
SkPathEffect* first = reinterpret_cast<SkPathEffect*>(firstHandle);
SkPathEffect* second = reinterpret_cast<SkPathEffect*>(secondHandle);
- SkPathEffect* effect = new SkSumPathEffect(first, second);
+ SkPathEffect* effect = SkSumPathEffect::Create(first, second);
return reinterpret_cast<jlong>(effect);
}
@@ -43,7 +43,7 @@ public:
for (int i = 0; i < count; i++) {
intervals[i] = SkFloatToScalar(values[i]);
}
- SkPathEffect* effect = new SkDashPathEffect(intervals, count, SkFloatToScalar(phase));
+ SkPathEffect* effect = SkDashPathEffect::Create(intervals, count, SkFloatToScalar(phase));
return reinterpret_cast<jlong>(effect);
}
@@ -51,19 +51,19 @@ public:
jlong shapeHandle, jfloat advance, jfloat phase, jint style) {
const SkPath* shape = reinterpret_cast<SkPath*>(shapeHandle);
SkASSERT(shape != NULL);
- SkPathEffect* effect = new SkPath1DPathEffect(*shape, SkFloatToScalar(advance),
+ SkPathEffect* effect = SkPath1DPathEffect::Create(*shape, SkFloatToScalar(advance),
SkFloatToScalar(phase), (SkPath1DPathEffect::Style)style);
return reinterpret_cast<jlong>(effect);
}
static jlong Corner_constructor(JNIEnv* env, jobject, jfloat radius){
- SkPathEffect* effect = new SkCornerPathEffect(SkFloatToScalar(radius));
+ SkPathEffect* effect = SkCornerPathEffect::Create(SkFloatToScalar(radius));
return reinterpret_cast<jlong>(effect);
}
static jlong Discrete_constructor(JNIEnv* env, jobject,
jfloat length, jfloat deviation) {
- SkPathEffect* effect = new SkDiscretePathEffect(SkFloatToScalar(length),
+ SkPathEffect* effect = SkDiscretePathEffect::Create(SkFloatToScalar(length),
SkFloatToScalar(deviation));
return reinterpret_cast<jlong>(effect);
}
diff --git a/core/jni/android/graphics/Xfermode.cpp b/core/jni/android/graphics/Xfermode.cpp
index eedceb7..6bf6f8a 100644
--- a/core/jni/android/graphics/Xfermode.cpp
+++ b/core/jni/android/graphics/Xfermode.cpp
@@ -36,12 +36,12 @@ public:
jint tolerance, jint modeHandle)
{
SkAvoidXfermode::Mode mode = static_cast<SkAvoidXfermode::Mode>(modeHandle);
- return reinterpret_cast<jlong>(new SkAvoidXfermode(opColor, tolerance, mode));
+ return reinterpret_cast<jlong>(SkAvoidXfermode::Create(opColor, tolerance, mode));
}
static jlong pixelxor_create(JNIEnv* env, jobject, jint opColor)
{
- return reinterpret_cast<jlong>(new SkPixelXorXfermode(opColor));
+ return reinterpret_cast<jlong>(SkPixelXorXfermode::Create(opColor));
}
};
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index c8bcf26..66bf75c 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -352,13 +352,19 @@ public class Matrix {
}
/**
- * Set the matrix to the concatenation of the two specified matrices,
- * returning true if the the result can be represented. Either of the two
- * matrices may also be the target matrix. this = a * b
+ * Set the matrix to the concatenation of the two specified matrices and
+ * return true.
+ *
+ * <p>Either of the two matrices may also be the target matrix, that is
+ * <code>matrixA.setConcat(matrixA, matrixB);</code> is valid.</p>
+ *
+ * <p class="note">In {@link android.os.Build.VERSION_CODES#GINGERBREAD_MR1} and below, this
+ * function returns true only if the result can be represented. In
+ * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and above, it always returns true.</p>
*/
public boolean setConcat(Matrix a, Matrix b) {
- return native_setConcat(native_instance, a.native_instance,
- b.native_instance);
+ native_setConcat(native_instance, a.native_instance, b.native_instance);
+ return true;
}
/**
@@ -366,7 +372,8 @@ public class Matrix {
* M' = M * T(dx, dy)
*/
public boolean preTranslate(float dx, float dy) {
- return native_preTranslate(native_instance, dx, dy);
+ native_preTranslate(native_instance, dx, dy);
+ return true;
}
/**
@@ -374,7 +381,8 @@ public class Matrix {
* M' = M * S(sx, sy, px, py)
*/
public boolean preScale(float sx, float sy, float px, float py) {
- return native_preScale(native_instance, sx, sy, px, py);
+ native_preScale(native_instance, sx, sy, px, py);
+ return true;
}
/**
@@ -382,7 +390,8 @@ public class Matrix {
* M' = M * S(sx, sy)
*/
public boolean preScale(float sx, float sy) {
- return native_preScale(native_instance, sx, sy);
+ native_preScale(native_instance, sx, sy);
+ return true;
}
/**
@@ -390,7 +399,8 @@ public class Matrix {
* M' = M * R(degrees, px, py)
*/
public boolean preRotate(float degrees, float px, float py) {
- return native_preRotate(native_instance, degrees, px, py);
+ native_preRotate(native_instance, degrees, px, py);
+ return true;
}
/**
@@ -398,7 +408,8 @@ public class Matrix {
* M' = M * R(degrees)
*/
public boolean preRotate(float degrees) {
- return native_preRotate(native_instance, degrees);
+ native_preRotate(native_instance, degrees);
+ return true;
}
/**
@@ -406,7 +417,8 @@ public class Matrix {
* M' = M * K(kx, ky, px, py)
*/
public boolean preSkew(float kx, float ky, float px, float py) {
- return native_preSkew(native_instance, kx, ky, px, py);
+ native_preSkew(native_instance, kx, ky, px, py);
+ return true;
}
/**
@@ -414,7 +426,8 @@ public class Matrix {
* M' = M * K(kx, ky)
*/
public boolean preSkew(float kx, float ky) {
- return native_preSkew(native_instance, kx, ky);
+ native_preSkew(native_instance, kx, ky);
+ return true;
}
/**
@@ -422,7 +435,8 @@ public class Matrix {
* M' = M * other
*/
public boolean preConcat(Matrix other) {
- return native_preConcat(native_instance, other.native_instance);
+ native_preConcat(native_instance, other.native_instance);
+ return true;
}
/**
@@ -430,7 +444,8 @@ public class Matrix {
* M' = T(dx, dy) * M
*/
public boolean postTranslate(float dx, float dy) {
- return native_postTranslate(native_instance, dx, dy);
+ native_postTranslate(native_instance, dx, dy);
+ return true;
}
/**
@@ -438,7 +453,8 @@ public class Matrix {
* M' = S(sx, sy, px, py) * M
*/
public boolean postScale(float sx, float sy, float px, float py) {
- return native_postScale(native_instance, sx, sy, px, py);
+ native_postScale(native_instance, sx, sy, px, py);
+ return true;
}
/**
@@ -446,7 +462,8 @@ public class Matrix {
* M' = S(sx, sy) * M
*/
public boolean postScale(float sx, float sy) {
- return native_postScale(native_instance, sx, sy);
+ native_postScale(native_instance, sx, sy);
+ return true;
}
/**
@@ -454,7 +471,8 @@ public class Matrix {
* M' = R(degrees, px, py) * M
*/
public boolean postRotate(float degrees, float px, float py) {
- return native_postRotate(native_instance, degrees, px, py);
+ native_postRotate(native_instance, degrees, px, py);
+ return true;
}
/**
@@ -462,7 +480,8 @@ public class Matrix {
* M' = R(degrees) * M
*/
public boolean postRotate(float degrees) {
- return native_postRotate(native_instance, degrees);
+ native_postRotate(native_instance, degrees);
+ return true;
}
/**
@@ -470,7 +489,8 @@ public class Matrix {
* M' = K(kx, ky, px, py) * M
*/
public boolean postSkew(float kx, float ky, float px, float py) {
- return native_postSkew(native_instance, kx, ky, px, py);
+ native_postSkew(native_instance, kx, ky, px, py);
+ return true;
}
/**
@@ -478,7 +498,8 @@ public class Matrix {
* M' = K(kx, ky) * M
*/
public boolean postSkew(float kx, float ky) {
- return native_postSkew(native_instance, kx, ky);
+ native_postSkew(native_instance, kx, ky);
+ return true;
}
/**
@@ -486,7 +507,8 @@ public class Matrix {
* M' = other * M
*/
public boolean postConcat(Matrix other) {
- return native_postConcat(native_instance, other.native_instance);
+ native_postConcat(native_instance, other.native_instance);
+ return true;
}
/** Controlls how the src rect should align into the dst rect for
@@ -828,41 +850,41 @@ public class Matrix {
float kx, float ky, float px, float py);
private static native void native_setSkew(long native_object,
float kx, float ky);
- private static native boolean native_setConcat(long native_object,
- long native_a,
- long native_b);
- private static native boolean native_preTranslate(long native_object,
- float dx, float dy);
- private static native boolean native_preScale(long native_object,
- float sx, float sy, float px, float py);
- private static native boolean native_preScale(long native_object,
- float sx, float sy);
- private static native boolean native_preRotate(long native_object,
- float degrees, float px, float py);
- private static native boolean native_preRotate(long native_object,
- float degrees);
- private static native boolean native_preSkew(long native_object,
- float kx, float ky, float px, float py);
- private static native boolean native_preSkew(long native_object,
- float kx, float ky);
- private static native boolean native_preConcat(long native_object,
- long native_other_matrix);
- private static native boolean native_postTranslate(long native_object,
- float dx, float dy);
- private static native boolean native_postScale(long native_object,
- float sx, float sy, float px, float py);
- private static native boolean native_postScale(long native_object,
- float sx, float sy);
- private static native boolean native_postRotate(long native_object,
- float degrees, float px, float py);
- private static native boolean native_postRotate(long native_object,
- float degrees);
- private static native boolean native_postSkew(long native_object,
- float kx, float ky, float px, float py);
- private static native boolean native_postSkew(long native_object,
- float kx, float ky);
- private static native boolean native_postConcat(long native_object,
- long native_other_matrix);
+ private static native void native_setConcat(long native_object,
+ long native_a,
+ long native_b);
+ private static native void native_preTranslate(long native_object,
+ float dx, float dy);
+ private static native void native_preScale(long native_object,
+ float sx, float sy, float px, float py);
+ private static native void native_preScale(long native_object,
+ float sx, float sy);
+ private static native void native_preRotate(long native_object,
+ float degrees, float px, float py);
+ private static native void native_preRotate(long native_object,
+ float degrees);
+ private static native void native_preSkew(long native_object,
+ float kx, float ky, float px, float py);
+ private static native void native_preSkew(long native_object,
+ float kx, float ky);
+ private static native void native_preConcat(long native_object,
+ long native_other_matrix);
+ private static native void native_postTranslate(long native_object,
+ float dx, float dy);
+ private static native void native_postScale(long native_object,
+ float sx, float sy, float px, float py);
+ private static native void native_postScale(long native_object,
+ float sx, float sy);
+ private static native void native_postRotate(long native_object,
+ float degrees, float px, float py);
+ private static native void native_postRotate(long native_object,
+ float degrees);
+ private static native void native_postSkew(long native_object,
+ float kx, float ky, float px, float py);
+ private static native void native_postSkew(long native_object,
+ float kx, float ky);
+ private static native void native_postConcat(long native_object,
+ long native_other_matrix);
private static native boolean native_setRectToRect(long native_object,
RectF src, RectF dst, int stf);
private static native boolean native_setPolyToPoly(long native_object,
diff --git a/libs/input/SpriteController.cpp b/libs/input/SpriteController.cpp
index 2667a72..3f6ccc9 100644
--- a/libs/input/SpriteController.cpp
+++ b/libs/input/SpriteController.cpp
@@ -402,7 +402,7 @@ void SpriteController::SpriteImpl::setIcon(const SpriteIcon& icon) {
uint32_t dirty;
if (icon.isValid()) {
- icon.bitmap.copyTo(&mLocked.state.icon.bitmap, SkBitmap::kARGB_8888_Config);
+ icon.bitmap.copyTo(&mLocked.state.icon.bitmap, kNative_8888_SkColorType);
if (!mLocked.state.icon.isValid()
|| mLocked.state.icon.hotSpotX != icon.hotSpotX
diff --git a/libs/input/SpriteController.h b/libs/input/SpriteController.h
index 75e4843..797efd7 100644
--- a/libs/input/SpriteController.h
+++ b/libs/input/SpriteController.h
@@ -65,7 +65,7 @@ struct SpriteIcon {
inline SpriteIcon copy() const {
SkBitmap bitmapCopy;
- bitmap.copyTo(&bitmapCopy, SkBitmap::kARGB_8888_Config);
+ bitmap.copyTo(&bitmapCopy, kNative_8888_SkColorType);
return SpriteIcon(bitmapCopy, hotSpotX, hotSpotY);
}
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index e1069ae..08d6ca6 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -150,7 +150,7 @@ static void loadSystemIconAsSprite(JNIEnv* env, jobject contextObj, int32_t styl
status_t status = android_view_PointerIcon_loadSystemIcon(env,
contextObj, style, &pointerIcon);
if (!status) {
- pointerIcon.bitmap.copyTo(&outSpriteIcon->bitmap, SkBitmap::kARGB_8888_Config);
+ pointerIcon.bitmap.copyTo(&outSpriteIcon->bitmap, kNative_8888_SkColorType);
outSpriteIcon->hotSpotX = pointerIcon.hotSpotX;
outSpriteIcon->hotSpotY = pointerIcon.hotSpotY;
}