diff options
author | Chris Craik <ccraik@google.com> | 2013-02-13 10:25:12 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2013-02-13 10:50:20 -0800 |
commit | 7c1a49f5f5ed6613d736464bf5001b777e89ced2 (patch) | |
tree | c6726264bde03f4c5957876921d4b15a835b2c71 | |
parent | d04892d207d50378356feef181ac4e4eff9652d7 (diff) | |
download | frameworks_base-7c1a49f5f5ed6613d736464bf5001b777e89ced2.zip frameworks_base-7c1a49f5f5ed6613d736464bf5001b777e89ced2.tar.gz frameworks_base-7c1a49f5f5ed6613d736464bf5001b777e89ced2.tar.bz2 |
Revert "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" DO NOT MERGE
This reverts commit 6c0307dd0aefe9a08794b155fc03ee60ebd14f25, reversing
changes made to a2cd828b749c444d55c2c41c7dbb85088ff94b9f.
Conflicts:
packages/SystemUI/res/values-sv/strings.xml
Change-Id: Ia178efe8b14751583d47b2826bfe3d3d5463dd2e
26 files changed, 131 insertions, 134 deletions
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 80c9324..8051923 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -515,22 +515,22 @@ class GLES20Canvas extends HardwareCanvas { @Override public boolean quickReject(float left, float top, float right, float bottom, EdgeType type) { - return nQuickReject(mRenderer, left, top, right, bottom); + return nQuickReject(mRenderer, left, top, right, bottom, type.nativeInt); } private static native boolean nQuickReject(int renderer, float left, float top, - float right, float bottom); + float right, float bottom, int edge); @Override public boolean quickReject(Path path, EdgeType type) { path.computeBounds(mPathBounds, true); return nQuickReject(mRenderer, mPathBounds.left, mPathBounds.top, - mPathBounds.right, mPathBounds.bottom); + mPathBounds.right, mPathBounds.bottom, type.nativeInt); } @Override public boolean quickReject(RectF rect, EdgeType type) { - return nQuickReject(mRenderer, rect.left, rect.top, rect.right, rect.bottom); + return nQuickReject(mRenderer, rect.left, rect.top, rect.right, rect.bottom, type.nativeInt); } /////////////////////////////////////////////////////////////////////////// diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index c10f287..a972b75 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -215,6 +215,7 @@ public class Surface implements Parcelable { private int mNativeSurfaceControl; // SurfaceControl* private int mGenerationId; // incremented each time mNativeSurface changes private final Canvas mCanvas = new CompatibleCanvas(); + private int mCanvasSaveCount; // Canvas save count at time of lockCanvas() // The Translator for density compatibility mode. This is used for scaling // the canvas to perform the appropriate density transformation. diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 44e8757..d705024 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -160,8 +160,7 @@ LOCAL_C_INCLUDES += \ external/skia/include/effects \ external/skia/include/images \ external/skia/include/ports \ - external/skia/src/core \ - external/skia/src/images \ + external/skia/src/ports \ external/skia/include/utils \ external/sqlite/dist \ external/sqlite/android \ diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index daabce3..b7fdecf 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -231,7 +231,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, } SkAutoTDelete<SkImageDecoder> add(decoder); - SkAutoTDelete<SkBitmap> adb(!useExistingBitmap ? bitmap : NULL); + SkAutoTDelete<SkBitmap> adb(bitmap, !useExistingBitmap); decoder->setPeeker(&peeker); if (!isPurgeable) { diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp index 7208c57..5d6f738 100644 --- a/core/jni/android/graphics/Canvas.cpp +++ b/core/jni/android/graphics/Canvas.cpp @@ -93,6 +93,14 @@ public: return canvas->getDevice()->accessBitmap(false).height(); } + static void setBitmap(JNIEnv* env, jobject, SkCanvas* canvas, SkBitmap* bitmap) { + if (bitmap) { + canvas->setBitmapDevice(*bitmap); + } else { + canvas->setDevice(NULL); + } + } + static int saveAll(JNIEnv* env, jobject jcanvas) { NPE_CHECK_RETURN_ZERO(env, jcanvas); return GraphicsJNI::getNativeCanvas(env, jcanvas)->save(); @@ -270,25 +278,25 @@ public: canvas->setDrawFilter(filter); } - static jboolean quickReject__RectF(JNIEnv* env, jobject, SkCanvas* canvas, - jobject rect) { + static jboolean quickReject__RectFI(JNIEnv* env, jobject, SkCanvas* canvas, + jobject rect, int edgetype) { SkRect rect_; GraphicsJNI::jrectf_to_rect(env, rect, &rect_); - return canvas->quickReject(rect_); + return canvas->quickReject(rect_, (SkCanvas::EdgeType)edgetype); } - - static jboolean quickReject__Path(JNIEnv* env, jobject, SkCanvas* canvas, - SkPath* path) { - return canvas->quickReject(*path); + + static jboolean quickReject__PathI(JNIEnv* env, jobject, SkCanvas* canvas, + SkPath* path, int edgetype) { + return canvas->quickReject(*path, (SkCanvas::EdgeType)edgetype); } - - static jboolean quickReject__FFFF(JNIEnv* env, jobject, SkCanvas* canvas, + + static jboolean quickReject__FFFFI(JNIEnv* env, jobject, SkCanvas* canvas, jfloat left, jfloat top, jfloat right, - jfloat bottom) { + jfloat bottom, int edgetype) { SkRect r; r.set(SkFloatToScalar(left), SkFloatToScalar(top), SkFloatToScalar(right), SkFloatToScalar(bottom)); - return canvas->quickReject(r); + return canvas->quickReject(r, (SkCanvas::EdgeType)edgetype); } static void drawRGB(JNIEnv* env, jobject, SkCanvas* canvas, @@ -930,19 +938,12 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l jobject bounds) { SkRect r; SkIRect ir; - bool result = canvas->getClipBounds(&r); + bool result = canvas->getClipBounds(&r, SkCanvas::kBW_EdgeType); if (!result) { r.setEmpty(); - } else { - // ensure the clip is not larger than the canvas - SkRect canvasRect; - SkISize deviceSize = canvas->getDeviceSize(); - canvasRect.iset(0, 0, deviceSize.fWidth, deviceSize.fHeight); - r.intersect(canvasRect); } r.round(&ir); - (void)GraphicsJNI::irect_to_jrect(ir, env, bounds); return result; } @@ -959,6 +960,7 @@ static JNINativeMethod gCanvasMethods[] = { {"isOpaque","()Z", (void*) SkCanvasGlue::isOpaque}, {"getWidth","()I", (void*) SkCanvasGlue::getWidth}, {"getHeight","()I", (void*) SkCanvasGlue::getHeight}, + {"native_setBitmap","(II)V", (void*) SkCanvasGlue::setBitmap}, {"save","()I", (void*) SkCanvasGlue::saveAll}, {"save","(I)I", (void*) SkCanvasGlue::save}, {"native_saveLayer","(ILandroid/graphics/RectF;II)I", @@ -990,10 +992,10 @@ static JNINativeMethod gCanvasMethods[] = { {"native_getClipBounds","(ILandroid/graphics/Rect;)Z", (void*) SkCanvasGlue::getClipBounds}, {"native_getCTM", "(II)V", (void*)SkCanvasGlue::getCTM}, - {"native_quickReject","(ILandroid/graphics/RectF;)Z", - (void*) SkCanvasGlue::quickReject__RectF}, - {"native_quickReject","(II)Z", (void*) SkCanvasGlue::quickReject__Path}, - {"native_quickReject","(IFFFF)Z", (void*)SkCanvasGlue::quickReject__FFFF}, + {"native_quickReject","(ILandroid/graphics/RectF;I)Z", + (void*) SkCanvasGlue::quickReject__RectFI}, + {"native_quickReject","(III)Z", (void*) SkCanvasGlue::quickReject__PathI}, + {"native_quickReject","(IFFFFI)Z", (void*)SkCanvasGlue::quickReject__FFFFI}, {"native_drawRGB","(IIII)V", (void*) SkCanvasGlue::drawRGB}, {"native_drawARGB","(IIIII)V", (void*) SkCanvasGlue::drawARGB}, {"native_drawColor","(II)V", (void*) SkCanvasGlue::drawColor__I}, diff --git a/core/jni/android/graphics/NinePatchImpl.cpp b/core/jni/android/graphics/NinePatchImpl.cpp index 01e7e3e..ff0eb45 100644 --- a/core/jni/android/graphics/NinePatchImpl.cpp +++ b/core/jni/android/graphics/NinePatchImpl.cpp @@ -105,7 +105,7 @@ SkScalar calculateStretch(SkScalar boundsLimit, SkScalar startingPoint, void NinePatch_Draw(SkCanvas* canvas, const SkRect& bounds, const SkBitmap& bitmap, const android::Res_png_9patch& chunk, const SkPaint* paint, SkRegion** outRegion) { - if (canvas && canvas->quickReject(bounds)) { + if (canvas && canvas->quickReject(bounds, SkCanvas::kBW_EdgeType)) { return; } diff --git a/core/jni/android/graphics/Region.cpp b/core/jni/android/graphics/Region.cpp index ded2186..ab7cf46 100644 --- a/core/jni/android/graphics/Region.cpp +++ b/core/jni/android/graphics/Region.cpp @@ -177,7 +177,7 @@ static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject par SkRegion* region = new SkRegion; size_t size = p->readInt32(); - region->readFromMemory(p->readInplace(size)); + region->unflatten(p->readInplace(size)); return region; } @@ -190,9 +190,9 @@ static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, const SkRegion* android::Parcel* p = android::parcelForJavaObject(env, parcel); - size_t size = region->writeToMemory(NULL); + size_t size = region->flatten(NULL); p->writeInt32(size); - region->writeToMemory(p->writeInplace(size)); + region->flatten(p->writeInplace(size)); return true; } diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 7544645..6d3c878 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -345,7 +345,7 @@ TextLayoutShaper::TextLayoutShaper() { } void TextLayoutShaper::init() { - mDefaultTypeface = SkFontHost::CreateTypeface(NULL, NULL, SkTypeface::kNormal); + mDefaultTypeface = SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, SkTypeface::kNormal); } void TextLayoutShaper::unrefTypefaces() { diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp index e056b61..7f4c37b 100644 --- a/core/jni/android/graphics/Typeface.cpp +++ b/core/jni/android/graphics/Typeface.cpp @@ -147,6 +147,25 @@ static SkTypeface* Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) return SkTypeface::CreateFromFile(str.c_str()); } +#define MIN_GAMMA (0.1f) +#define MAX_GAMMA (10.0f) +static float pinGamma(float gamma) { + if (gamma < MIN_GAMMA) { + gamma = MIN_GAMMA; + } else if (gamma > MAX_GAMMA) { + gamma = MAX_GAMMA; + } + return gamma; +} + +extern void skia_set_text_gamma(float, float); + +static void Typeface_setGammaForText(JNIEnv* env, jobject, jfloat blackGamma, + jfloat whiteGamma) { + // Comment this out for release builds. This is only used during development + skia_set_text_gamma(pinGamma(blackGamma), pinGamma(whiteGamma)); +} + /////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gTypefaceMethods[] = { @@ -158,6 +177,7 @@ static JNINativeMethod gTypefaceMethods[] = { (void*)Typeface_createFromAsset }, { "nativeCreateFromFile", "(Ljava/lang/String;)I", (void*)Typeface_createFromFile }, + { "setGammaForText", "(FF)V", (void*)Typeface_setGammaForText }, }; int register_android_graphics_Typeface(JNIEnv* env) diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 895a0dc..33ed0b9 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -269,7 +269,8 @@ static jint android_view_GLES20Canvas_saveLayerAlphaClip(JNIEnv* env, jobject cl // ---------------------------------------------------------------------------- static bool android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject clazz, - OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom) { + OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom, + SkCanvas::EdgeType edge) { return renderer->quickReject(left, top, right, bottom); } @@ -980,7 +981,7 @@ static JNINativeMethod gMethods[] = { { "nSaveLayerAlpha", "(IFFFFII)I", (void*) android_view_GLES20Canvas_saveLayerAlpha }, { "nSaveLayerAlpha", "(III)I", (void*) android_view_GLES20Canvas_saveLayerAlphaClip }, - { "nQuickReject", "(IFFFF)Z", (void*) android_view_GLES20Canvas_quickReject }, + { "nQuickReject", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_quickReject }, { "nClipRect", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_clipRectF }, { "nClipRect", "(IIIIII)Z", (void*) android_view_GLES20Canvas_clipRect }, { "nClipPath", "(III)Z", (void*) android_view_GLES20Canvas_clipPath }, diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index ed92e43..1f15370 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -66,6 +66,7 @@ static struct { jfieldID mNativeSurfaceControl; jfieldID mGenerationId; jfieldID mCanvas; + jfieldID mCanvasSaveCount; jmethodID ctor; } gSurfaceClassInfo; @@ -77,16 +78,11 @@ static struct { } gRectClassInfo; static struct { - jfieldID mFinalizer; jfieldID mNativeCanvas; jfieldID mSurfaceFormat; } gCanvasClassInfo; static struct { - jfieldID mNativeCanvas; -} gCanvasFinalizerClassInfo; - -static struct { jfieldID width; jfieldID height; jfieldID refreshRate; @@ -139,7 +135,6 @@ public: return mScreenshot.getFormat(); } - SK_DECLARE_UNFLATTENABLE_OBJECT() protected: // overrides from SkPixelRef virtual void* onLockPixels(SkColorTable** ct) { @@ -378,15 +373,6 @@ static inline SkBitmap::Config convertPixelFormat(PixelFormat format) { } } -static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) { - jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer); - SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>( - env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas)); - env->SetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas, (int)newCanvas); - env->SetIntField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int)newCanvas); - SkSafeUnref(previousCanvas); -} - static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jobject dirtyRectObj) { sp<Surface> surface(getSurface(env, surfaceObj)); if (!Surface::isValid(surface)) { @@ -423,6 +409,8 @@ static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jobject dirtyRe jobject canvasObj = env->GetObjectField(surfaceObj, gSurfaceClassInfo.mCanvas); env->SetIntField(canvasObj, gCanvasClassInfo.mSurfaceFormat, info.format); + SkCanvas* nativeCanvas = reinterpret_cast<SkCanvas*>( + env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas)); SkBitmap bitmap; ssize_t bpr = info.s * bytesPerPixel(info.format); bitmap.setConfig(convertPixelFormat(info.format), info.w, info.h, bpr); @@ -435,9 +423,7 @@ static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jobject dirtyRe // be safe with an empty bitmap. bitmap.setPixels(NULL); } - - SkCanvas* nativeCanvas = SkNEW_ARGS(SkCanvas, (bitmap)); - swapCanvasPtr(env, canvasObj, nativeCanvas); + nativeCanvas->setBitmapDevice(bitmap); SkRegion clipReg; if (dirtyRegion.isRect()) { // very common case @@ -454,6 +440,9 @@ static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jobject dirtyRe nativeCanvas->clipRegion(clipReg); + int saveCount = nativeCanvas->save(); + env->SetIntField(surfaceObj, gSurfaceClassInfo.mCanvasSaveCount, saveCount); + if (dirtyRectObj) { const Rect& bounds(dirtyRegion.getBounds()); env->SetIntField(dirtyRectObj, gRectClassInfo.left, bounds.left); @@ -478,8 +467,12 @@ static void nativeUnlockCanvasAndPost(JNIEnv* env, jobject surfaceObj, jobject c } // detach the canvas from the surface - SkCanvas* nativeCanvas = SkNEW(SkCanvas); - swapCanvasPtr(env, canvasObj, nativeCanvas); + SkCanvas* nativeCanvas = reinterpret_cast<SkCanvas*>( + env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas)); + int saveCount = env->GetIntField(surfaceObj, gSurfaceClassInfo.mCanvasSaveCount); + nativeCanvas->restoreToCount(saveCount); + nativeCanvas->setBitmapDevice(SkBitmap()); + env->SetIntField(surfaceObj, gSurfaceClassInfo.mCanvasSaveCount, 0); // unlock surface status_t err = surface->unlockAndPost(); @@ -895,16 +888,14 @@ int register_android_view_Surface(JNIEnv* env) env->GetFieldID(gSurfaceClassInfo.clazz, "mGenerationId", "I"); gSurfaceClassInfo.mCanvas = env->GetFieldID(gSurfaceClassInfo.clazz, "mCanvas", "Landroid/graphics/Canvas;"); + gSurfaceClassInfo.mCanvasSaveCount = + env->GetFieldID(gSurfaceClassInfo.clazz, "mCanvasSaveCount", "I"); gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "()V"); clazz = env->FindClass("android/graphics/Canvas"); - gCanvasClassInfo.mFinalizer = env->GetFieldID(clazz, "mFinalizer", "Landroid/graphics/Canvas$CanvasFinalizer;"); gCanvasClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "I"); gCanvasClassInfo.mSurfaceFormat = env->GetFieldID(clazz, "mSurfaceFormat", "I"); - clazz = env->FindClass("android/graphics/Canvas$CanvasFinalizer"); - gCanvasFinalizerClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "I"); - clazz = env->FindClass("android/graphics/Rect"); gRectClassInfo.left = env->GetFieldID(clazz, "left", "I"); gRectClassInfo.top = env->GetFieldID(clazz, "top", "I"); diff --git a/core/jni/android_view_TextureView.cpp b/core/jni/android_view_TextureView.cpp index 64cbda3..87b312f 100644 --- a/core/jni/android_view_TextureView.cpp +++ b/core/jni/android_view_TextureView.cpp @@ -43,16 +43,11 @@ static struct { } gRectClassInfo; static struct { - jfieldID mFinalizer; - jfieldID mNativeCanvas; - jfieldID mSurfaceFormat; + jfieldID nativeCanvas; + jfieldID surfaceFormat; } gCanvasClassInfo; static struct { - jfieldID mNativeCanvas; -} gCanvasFinalizerClassInfo; - -static struct { jfieldID nativeWindow; } gTextureViewClassInfo; @@ -125,15 +120,6 @@ static void android_view_TextureView_destroyNativeWindow(JNIEnv* env, jobject te } } -static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) { - jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer); - SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>( - env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas)); - env->SetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas, (int)newCanvas); - env->SetIntField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int)newCanvas); - SkSafeUnref(previousCanvas); -} - static void android_view_TextureView_lockCanvas(JNIEnv* env, jobject, jint nativeWindow, jobject canvas, jobject dirtyRect) { @@ -171,10 +157,9 @@ static void android_view_TextureView_lockCanvas(JNIEnv* env, jobject, bitmap.setPixels(NULL); } - SET_INT(canvas, gCanvasClassInfo.mSurfaceFormat, buffer.format); - - SkCanvas* nativeCanvas = SkNEW_ARGS(SkCanvas, (bitmap)); - swapCanvasPtr(env, canvas, nativeCanvas); + SET_INT(canvas, gCanvasClassInfo.surfaceFormat, buffer.format); + SkCanvas* nativeCanvas = (SkCanvas*) GET_INT(canvas, gCanvasClassInfo.nativeCanvas); + nativeCanvas->setBitmapDevice(bitmap); SkRect clipRect; clipRect.set(rect.left, rect.top, rect.right, rect.bottom); @@ -189,8 +174,8 @@ static void android_view_TextureView_lockCanvas(JNIEnv* env, jobject, static void android_view_TextureView_unlockCanvasAndPost(JNIEnv* env, jobject, jint nativeWindow, jobject canvas) { - SkCanvas* nativeCanvas = SkNEW(SkCanvas); - swapCanvasPtr(env, canvas, nativeCanvas); + SkCanvas* nativeCanvas = (SkCanvas*) GET_INT(canvas, gCanvasClassInfo.nativeCanvas); + nativeCanvas->setBitmapDevice(SkBitmap()); if (nativeWindow) { sp<ANativeWindow> window((ANativeWindow*) nativeWindow); @@ -241,12 +226,8 @@ int register_android_view_TextureView(JNIEnv* env) { GET_FIELD_ID(gRectClassInfo.bottom, clazz, "bottom", "I"); FIND_CLASS(clazz, "android/graphics/Canvas"); - GET_FIELD_ID(gCanvasClassInfo.mFinalizer, clazz, "mFinalizer", "Landroid/graphics/Canvas$CanvasFinalizer;"); - GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I"); - GET_FIELD_ID(gCanvasClassInfo.mSurfaceFormat, clazz, "mSurfaceFormat", "I"); - - FIND_CLASS(clazz, "android/graphics/Canvas$CanvasFinalizer"); - GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I"); + GET_FIELD_ID(gCanvasClassInfo.nativeCanvas, clazz, "mNativeCanvas", "I"); + GET_FIELD_ID(gCanvasClassInfo.surfaceFormat, clazz, "mSurfaceFormat", "I"); FIND_CLASS(clazz, "android/view/TextureView"); GET_FIELD_ID(gTextureViewClassInfo.nativeWindow, clazz, "mNativeWindow", "I"); diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 483d11a..3949afd 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -37,8 +37,8 @@ import javax.microedition.khronos.opengles.GL; * Canvas and Drawables</a> developer guide.</p></div> */ public class Canvas { - // assigned in constructors or setBitmap, freed in finalizer - int mNativeCanvas; + // assigned in constructors, freed in finalizer + final int mNativeCanvas; // may be null private Bitmap mBitmap; @@ -83,7 +83,7 @@ public class Canvas { private final CanvasFinalizer mFinalizer; private static class CanvasFinalizer { - private int mNativeCanvas; + private final int mNativeCanvas; public CanvasFinalizer(int nativeCanvas) { mNativeCanvas = nativeCanvas; @@ -143,17 +143,6 @@ public class Canvas { } /** - * Replace existing canvas while ensuring that the swap has occurred before - * the previous native canvas is unreferenced. - */ - private void safeCanvasSwap(int nativeCanvas) { - final int oldCanvas = mNativeCanvas; - mNativeCanvas = nativeCanvas; - mFinalizer.mNativeCanvas = nativeCanvas; - finalizer(oldCanvas); - } - - /** * Returns null. * * @deprecated This method is not supported and should not be invoked. @@ -179,11 +168,11 @@ public class Canvas { } /** - * Specify a bitmap for the canvas to draw into. As a side-effect, the - * canvas' target density is updated to match that of the bitmap while all - * other state such as the layers, filters, matrix, and clip are reset. + * Specify a bitmap for the canvas to draw into. As a side-effect, also + * updates the canvas's target density to match that of the bitmap. * * @param bitmap Specifies a mutable bitmap for the canvas to draw into. + * * @see #setDensity(int) * @see #getDensity() */ @@ -192,19 +181,17 @@ public class Canvas { throw new RuntimeException("Can't set a bitmap device on a GL canvas"); } - if (bitmap == null) { - safeCanvasSwap(initRaster(0)); - mDensity = Bitmap.DENSITY_NONE; - } else { + int pointer = 0; + if (bitmap != null) { if (!bitmap.isMutable()) { throw new IllegalStateException(); } throwIfRecycled(bitmap); - - safeCanvasSwap(initRaster(bitmap.ni())); mDensity = bitmap.mDensity; + pointer = bitmap.ni(); } + native_setBitmap(mNativeCanvas, pointer); mBitmap = bitmap; } @@ -719,7 +706,7 @@ public class Canvas { * does not intersect with the canvas' clip */ public boolean quickReject(RectF rect, EdgeType type) { - return native_quickReject(mNativeCanvas, rect); + return native_quickReject(mNativeCanvas, rect, type.nativeInt); } /** @@ -739,7 +726,7 @@ public class Canvas { * does not intersect with the canvas' clip */ public boolean quickReject(Path path, EdgeType type) { - return native_quickReject(mNativeCanvas, path.ni()); + return native_quickReject(mNativeCanvas, path.ni(), type.nativeInt); } /** @@ -762,9 +749,9 @@ public class Canvas { * @return true if the rect (transformed by the canvas' matrix) * does not intersect with the canvas' clip */ - public boolean quickReject(float left, float top, float right, float bottom, - EdgeType type) { - return native_quickReject(mNativeCanvas, left, top, right, bottom); + public boolean quickReject(float left, float top, float right, float bottom, EdgeType type) { + return native_quickReject(mNativeCanvas, left, top, right, bottom, + type.nativeInt); } /** @@ -1638,6 +1625,7 @@ public class Canvas { public static native void freeTextLayoutCaches(); private static native int initRaster(int nativeBitmapOrZero); + private static native void native_setBitmap(int nativeCanvas, int bitmap); private static native int native_saveLayer(int nativeCanvas, RectF bounds, int paint, int layerFlags); private static native int native_saveLayer(int nativeCanvas, float l, @@ -1668,12 +1656,15 @@ public class Canvas { Rect bounds); private static native void native_getCTM(int canvas, int matrix); private static native boolean native_quickReject(int nativeCanvas, - RectF rect); + RectF rect, + int native_edgeType); private static native boolean native_quickReject(int nativeCanvas, - int path); + int path, + int native_edgeType); private static native boolean native_quickReject(int nativeCanvas, float left, float top, - float right, float bottom); + float right, float bottom, + int native_edgeType); private static native void native_drawRGB(int nativeCanvas, int r, int g, int b); private static native void native_drawARGB(int nativeCanvas, int a, int r, diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java index 157c7d1..f6b5ffc 100644 --- a/graphics/java/android/graphics/Path.java +++ b/graphics/java/android/graphics/Path.java @@ -375,9 +375,9 @@ public class Path { */ public enum Direction { /** clockwise */ - CW (1), // must match enum in SkPath.h + CW (0), // must match enum in SkPath.h /** counter-clockwise */ - CCW (2); // must match enum in SkPath.h + CCW (1); // must match enum in SkPath.h Direction(int ni) { nativeInt = ni; diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index c68c9f7..4487a3c 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -225,4 +225,16 @@ public class Typeface { private static native int nativeGetStyle(int native_instance); private static native int nativeCreateFromAsset(AssetManager mgr, String path); private static native int nativeCreateFromFile(String path); + + /** + * Set the global gamma coefficients for black and white text. This call is + * usually a no-op in shipping products, and only exists for testing during + * development. + * + * @param blackGamma gamma coefficient for black text + * @param whiteGamma gamma coefficient for white text + * + * @hide - this is just for calibrating devices, not for normal apps + */ + public static native void setGammaForText(float blackGamma, float whiteGamma); } diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk index 2111a56..9a36f71 100644 --- a/libs/hwui/Android.mk +++ b/libs/hwui/Android.mk @@ -43,7 +43,6 @@ ifeq ($(USE_OPENGL_RENDERER),true) external/skia/include/core \ external/skia/include/effects \ external/skia/include/images \ - external/skia/src/core \ external/skia/src/ports \ external/skia/include/utils diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index f3bd188..b25288b 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -18,8 +18,7 @@ #define ANDROID_HWUI_DISPLAY_LIST_RENDERER_H #include <SkChunkAlloc.h> -#include <SkReader32.h> -#include <SkWriter32.h> +#include <SkFlattenable.h> #include <SkMatrix.h> #include <SkCamera.h> #include <SkPaint.h> diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index d8297da..97988f7 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -16,7 +16,6 @@ #define LOG_TAG "OpenGLRenderer" -#include <SkGlyph.h> #include <SkUtils.h> #include <cutils/properties.h> diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h index ccf1da5..664b2f8 100644 --- a/libs/hwui/Layer.h +++ b/libs/hwui/Layer.h @@ -23,7 +23,6 @@ #include <ui/Region.h> -#include <SkPaint.h> #include <SkXfermode.h> #include "Rect.h" diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 62f268d..aea37c4 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -80,7 +80,7 @@ static const Blender gBlends[] = { { SkXfermode::kDstATop_Mode, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA }, { SkXfermode::kXor_Mode, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA }, { SkXfermode::kPlus_Mode, GL_ONE, GL_ONE }, - { SkXfermode::kModulate_Mode, GL_ZERO, GL_SRC_COLOR }, + { SkXfermode::kMultiply_Mode, GL_ZERO, GL_SRC_COLOR }, { SkXfermode::kScreen_Mode, GL_ONE, GL_ONE_MINUS_SRC_COLOR } }; @@ -101,7 +101,7 @@ static const Blender gBlendsSwap[] = { { SkXfermode::kDstATop_Mode, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA }, { SkXfermode::kXor_Mode, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA }, { SkXfermode::kPlus_Mode, GL_ONE, GL_ONE }, - { SkXfermode::kModulate_Mode, GL_DST_COLOR, GL_ZERO }, + { SkXfermode::kMultiply_Mode, GL_DST_COLOR, GL_ZERO }, { SkXfermode::kScreen_Mode, GL_ONE_MINUS_DST_COLOR, GL_ONE } }; diff --git a/libs/hwui/font/CacheTexture.cpp b/libs/hwui/font/CacheTexture.cpp index 24b0523..f653592 100644 --- a/libs/hwui/font/CacheTexture.cpp +++ b/libs/hwui/font/CacheTexture.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include <SkGlyph.h> #include <utils/Log.h> #include "Debug.h" diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp index 1a75ea8..8c5a8ff 100644 --- a/libs/hwui/font/Font.cpp +++ b/libs/hwui/font/Font.cpp @@ -20,7 +20,6 @@ #include <utils/JenkinsHash.h> -#include <SkGlyph.h> #include <SkUtils.h> #include "Debug.h" diff --git a/media/tests/omxjpegdecoder/SkOmxPixelRef.h b/media/tests/omxjpegdecoder/SkOmxPixelRef.h index 374604c..afedcbd 100644 --- a/media/tests/omxjpegdecoder/SkOmxPixelRef.h +++ b/media/tests/omxjpegdecoder/SkOmxPixelRef.h @@ -33,7 +33,6 @@ public: //! Return the allocation size for the pixels size_t getSize() const { return mSize; } - SK_DECLARE_UNFLATTENABLE_OBJECT() protected: // overrides from SkPixelRef virtual void* onLockPixels(SkColorTable**); diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml index a58c9a0..a03ca33 100644 --- a/packages/SystemUI/res/values-sv/strings.xml +++ b/packages/SystemUI/res/values-sv/strings.xml @@ -196,7 +196,7 @@ <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Ej ansluten"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Inget nätverk"</string> - <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi av"</string> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi är inaktiverat"</string> <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Trådlös skärm"</string> <string name="quick_settings_wifi_display_no_connection_label" msgid="2355298740765736918">"Trådlös skärm"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Ljusstyrka"</string> diff --git a/services/input/SpriteController.cpp b/services/input/SpriteController.cpp index 8163ea0..1f3d2cf 100644 --- a/services/input/SpriteController.cpp +++ b/services/input/SpriteController.cpp @@ -208,7 +208,8 @@ void SpriteController::doUpdateSprites() { surfaceInfo.w, surfaceInfo.h, bpr); surfaceBitmap.setPixels(surfaceInfo.bits); - SkCanvas surfaceCanvas(surfaceBitmap); + SkCanvas surfaceCanvas; + surfaceCanvas.setBitmapDevice(surfaceBitmap); SkPaint paint; paint.setXfermodeMode(SkXfermode::kSrc_Mode); diff --git a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java index 8701cc8..2414d70 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java @@ -188,6 +188,11 @@ public final class Typeface_Delegate { return delegate.mStyle; } + @LayoutlibDelegate + /*package*/ static void setGammaForText(float blackGamma, float whiteGamma) { + // This is for device testing only: pass + } + // ---- Private delegate/helper methods ---- private Typeface_Delegate(String family, int style) { |