Revert "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" DO NOT MERGE
This reverts commit6c0307dd0a, reversing changes made toa2cd828b74. Conflicts: packages/SystemUI/res/values-sv/strings.xml Change-Id: Ia178efe8b14751583d47b2826bfe3d3d5463dd2e
This commit is contained in:
committed by
The Android Automerger
parent
ca42382f36
commit
3d850df9b4
@@ -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);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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},
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -66,6 +66,7 @@ static struct {
|
||||
jfieldID mNativeSurfaceControl;
|
||||
jfieldID mGenerationId;
|
||||
jfieldID mCanvas;
|
||||
jfieldID mCanvasSaveCount;
|
||||
jmethodID ctor;
|
||||
} gSurfaceClassInfo;
|
||||
|
||||
@@ -77,15 +78,10 @@ static struct {
|
||||
} gRectClassInfo;
|
||||
|
||||
static struct {
|
||||
jfieldID mFinalizer;
|
||||
jfieldID mNativeCanvas;
|
||||
jfieldID mSurfaceFormat;
|
||||
} gCanvasClassInfo;
|
||||
|
||||
static struct {
|
||||
jfieldID mNativeCanvas;
|
||||
} gCanvasFinalizerClassInfo;
|
||||
|
||||
static struct {
|
||||
jfieldID width;
|
||||
jfieldID height;
|
||||
@@ -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");
|
||||
|
||||
@@ -43,15 +43,10 @@ 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");
|
||||
|
||||
@@ -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;
|
||||
@@ -142,17 +142,6 @@ public class Canvas {
|
||||
mDensity = Bitmap.getDefaultDensity();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#define LOG_TAG "OpenGLRenderer"
|
||||
|
||||
#include <SkGlyph.h>
|
||||
#include <SkUtils.h>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include <ui/Region.h>
|
||||
|
||||
#include <SkPaint.h>
|
||||
#include <SkXfermode.h>
|
||||
|
||||
#include "Rect.h"
|
||||
|
||||
@@ -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 }
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <SkGlyph.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "Debug.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include <utils/JenkinsHash.h>
|
||||
|
||||
#include <SkGlyph.h>
|
||||
#include <SkUtils.h>
|
||||
|
||||
#include "Debug.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**);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user