Merge "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'"

This commit is contained in:
Derek Sollenberger
2013-02-06 12:57:37 +00:00
committed by Android (Google) Code Review
32 changed files with 153 additions and 150 deletions

View File

@@ -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, type.nativeInt);
return nQuickReject(mRenderer, left, top, right, bottom);
}
private static native boolean nQuickReject(int renderer, float left, float top,
float right, float bottom, int edge);
float right, float bottom);
@Override
public boolean quickReject(Path path, EdgeType type) {
path.computeBounds(mPathBounds, true);
return nQuickReject(mRenderer, mPathBounds.left, mPathBounds.top,
mPathBounds.right, mPathBounds.bottom, type.nativeInt);
mPathBounds.right, mPathBounds.bottom);
}
@Override
public boolean quickReject(RectF rect, EdgeType type) {
return nQuickReject(mRenderer, rect.left, rect.top, rect.right, rect.bottom, type.nativeInt);
return nQuickReject(mRenderer, rect.left, rect.top, rect.right, rect.bottom);
}
///////////////////////////////////////////////////////////////////////////

View File

@@ -215,7 +215,6 @@ 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.

View File

@@ -160,7 +160,8 @@ LOCAL_C_INCLUDES += \
external/skia/include/effects \
external/skia/include/images \
external/skia/include/ports \
external/skia/src/ports \
external/skia/src/core \
external/skia/src/images \
external/skia/include/utils \
external/sqlite/dist \
external/sqlite/android \

View File

@@ -231,7 +231,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
}
SkAutoTDelete<SkImageDecoder> add(decoder);
SkAutoTDelete<SkBitmap> adb(bitmap, !useExistingBitmap);
SkAutoTDelete<SkBitmap> adb(!useExistingBitmap ? bitmap : NULL);
decoder->setPeeker(&peeker);
if (!isPurgeable) {

View File

@@ -93,14 +93,6 @@ 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();
@@ -278,25 +270,25 @@ public:
canvas->setDrawFilter(filter);
}
static jboolean quickReject__RectFI(JNIEnv* env, jobject, SkCanvas* canvas,
jobject rect, int edgetype) {
static jboolean quickReject__RectF(JNIEnv* env, jobject, SkCanvas* canvas,
jobject rect) {
SkRect rect_;
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
return canvas->quickReject(rect_, (SkCanvas::EdgeType)edgetype);
return canvas->quickReject(rect_);
}
static jboolean quickReject__PathI(JNIEnv* env, jobject, SkCanvas* canvas,
SkPath* path, int edgetype) {
return canvas->quickReject(*path, (SkCanvas::EdgeType)edgetype);
static jboolean quickReject__Path(JNIEnv* env, jobject, SkCanvas* canvas,
SkPath* path) {
return canvas->quickReject(*path);
}
static jboolean quickReject__FFFFI(JNIEnv* env, jobject, SkCanvas* canvas,
static jboolean quickReject__FFFF(JNIEnv* env, jobject, SkCanvas* canvas,
jfloat left, jfloat top, jfloat right,
jfloat bottom, int edgetype) {
jfloat bottom) {
SkRect r;
r.set(SkFloatToScalar(left), SkFloatToScalar(top),
SkFloatToScalar(right), SkFloatToScalar(bottom));
return canvas->quickReject(r, (SkCanvas::EdgeType)edgetype);
return canvas->quickReject(r);
}
static void drawRGB(JNIEnv* env, jobject, SkCanvas* canvas,
@@ -938,12 +930,19 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l
jobject bounds) {
SkRect r;
SkIRect ir;
bool result = canvas->getClipBounds(&r, SkCanvas::kBW_EdgeType);
bool result = canvas->getClipBounds(&r);
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;
}
@@ -960,7 +959,6 @@ 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",
@@ -992,10 +990,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;I)Z",
(void*) SkCanvasGlue::quickReject__RectFI},
{"native_quickReject","(III)Z", (void*) SkCanvasGlue::quickReject__PathI},
{"native_quickReject","(IFFFFI)Z", (void*)SkCanvasGlue::quickReject__FFFFI},
{"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_drawRGB","(IIII)V", (void*) SkCanvasGlue::drawRGB},
{"native_drawARGB","(IIIII)V", (void*) SkCanvasGlue::drawARGB},
{"native_drawColor","(II)V", (void*) SkCanvasGlue::drawColor__I},

View File

@@ -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, SkCanvas::kBW_EdgeType)) {
if (canvas && canvas->quickReject(bounds)) {
return;
}

View File

@@ -177,7 +177,7 @@ static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject par
SkRegion* region = new SkRegion;
size_t size = p->readInt32();
region->unflatten(p->readInplace(size));
region->readFromMemory(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->flatten(NULL);
size_t size = region->writeToMemory(NULL);
p->writeInt32(size);
region->flatten(p->writeInplace(size));
region->writeToMemory(p->writeInplace(size));
return true;
}

View File

@@ -345,7 +345,7 @@ TextLayoutShaper::TextLayoutShaper() {
}
void TextLayoutShaper::init() {
mDefaultTypeface = SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, SkTypeface::kNormal);
mDefaultTypeface = SkFontHost::CreateTypeface(NULL, NULL, SkTypeface::kNormal);
}
void TextLayoutShaper::unrefTypefaces() {

View File

@@ -147,25 +147,6 @@ 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[] = {
@@ -177,7 +158,6 @@ 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)

View File

@@ -269,8 +269,7 @@ 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,
SkCanvas::EdgeType edge) {
OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom) {
return renderer->quickReject(left, top, right, bottom);
}
@@ -981,7 +980,7 @@ static JNINativeMethod gMethods[] = {
{ "nSaveLayerAlpha", "(IFFFFII)I", (void*) android_view_GLES20Canvas_saveLayerAlpha },
{ "nSaveLayerAlpha", "(III)I", (void*) android_view_GLES20Canvas_saveLayerAlphaClip },
{ "nQuickReject", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_quickReject },
{ "nQuickReject", "(IFFFF)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 },

View File

@@ -66,7 +66,6 @@ static struct {
jfieldID mNativeSurfaceControl;
jfieldID mGenerationId;
jfieldID mCanvas;
jfieldID mCanvasSaveCount;
jmethodID ctor;
} gSurfaceClassInfo;
@@ -78,10 +77,15 @@ static struct {
} gRectClassInfo;
static struct {
jfieldID mFinalizer;
jfieldID mNativeCanvas;
jfieldID mSurfaceFormat;
} gCanvasClassInfo;
static struct {
jfieldID mNativeCanvas;
} gCanvasFinalizerClassInfo;
static struct {
jfieldID width;
jfieldID height;
@@ -135,6 +139,7 @@ public:
return mScreenshot.getFormat();
}
SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
// overrides from SkPixelRef
virtual void* onLockPixels(SkColorTable** ct) {
@@ -373,6 +378,15 @@ 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)) {
@@ -409,8 +423,6 @@ 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);
@@ -423,7 +435,9 @@ static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jobject dirtyRe
// be safe with an empty bitmap.
bitmap.setPixels(NULL);
}
nativeCanvas->setBitmapDevice(bitmap);
SkCanvas* nativeCanvas = SkNEW_ARGS(SkCanvas, (bitmap));
swapCanvasPtr(env, canvasObj, nativeCanvas);
SkRegion clipReg;
if (dirtyRegion.isRect()) { // very common case
@@ -440,9 +454,6 @@ 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);
@@ -467,12 +478,8 @@ static void nativeUnlockCanvasAndPost(JNIEnv* env, jobject surfaceObj, jobject c
}
// detach the canvas from the surface
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);
SkCanvas* nativeCanvas = SkNEW(SkCanvas);
swapCanvasPtr(env, canvasObj, nativeCanvas);
// unlock surface
status_t err = surface->unlockAndPost();
@@ -888,14 +895,16 @@ 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");

View File

@@ -43,10 +43,15 @@ static struct {
} gRectClassInfo;
static struct {
jfieldID nativeCanvas;
jfieldID surfaceFormat;
jfieldID mFinalizer;
jfieldID mNativeCanvas;
jfieldID mSurfaceFormat;
} gCanvasClassInfo;
static struct {
jfieldID mNativeCanvas;
} gCanvasFinalizerClassInfo;
static struct {
jfieldID nativeWindow;
} gTextureViewClassInfo;
@@ -120,6 +125,15 @@ 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) {
@@ -157,9 +171,10 @@ static void android_view_TextureView_lockCanvas(JNIEnv* env, jobject,
bitmap.setPixels(NULL);
}
SET_INT(canvas, gCanvasClassInfo.surfaceFormat, buffer.format);
SkCanvas* nativeCanvas = (SkCanvas*) GET_INT(canvas, gCanvasClassInfo.nativeCanvas);
nativeCanvas->setBitmapDevice(bitmap);
SET_INT(canvas, gCanvasClassInfo.mSurfaceFormat, buffer.format);
SkCanvas* nativeCanvas = SkNEW_ARGS(SkCanvas, (bitmap));
swapCanvasPtr(env, canvas, nativeCanvas);
SkRect clipRect;
clipRect.set(rect.left, rect.top, rect.right, rect.bottom);
@@ -174,8 +189,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 = (SkCanvas*) GET_INT(canvas, gCanvasClassInfo.nativeCanvas);
nativeCanvas->setBitmapDevice(SkBitmap());
SkCanvas* nativeCanvas = SkNEW(SkCanvas);
swapCanvasPtr(env, canvas, nativeCanvas);
if (nativeWindow) {
sp<ANativeWindow> window((ANativeWindow*) nativeWindow);
@@ -226,8 +241,12 @@ 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.nativeCanvas, clazz, "mNativeCanvas", "I");
GET_FIELD_ID(gCanvasClassInfo.surfaceFormat, clazz, "mSurfaceFormat", "I");
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");
FIND_CLASS(clazz, "android/view/TextureView");
GET_FIELD_ID(gTextureViewClassInfo.nativeWindow, clazz, "mNativeWindow", "I");

View File

@@ -37,8 +37,8 @@ import javax.microedition.khronos.opengles.GL;
* Canvas and Drawables</a> developer guide.</p></div>
*/
public class Canvas {
// assigned in constructors, freed in finalizer
final int mNativeCanvas;
// assigned in constructors or setBitmap, freed in finalizer
int mNativeCanvas;
// may be null
private Bitmap mBitmap;
@@ -83,7 +83,7 @@ public class Canvas {
private final CanvasFinalizer mFinalizer;
private static class CanvasFinalizer {
private final int mNativeCanvas;
private int mNativeCanvas;
public CanvasFinalizer(int nativeCanvas) {
mNativeCanvas = nativeCanvas;
@@ -142,6 +142,17 @@ 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.
*
@@ -168,11 +179,11 @@ public class Canvas {
}
/**
* 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.
* 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.
*
* @param bitmap Specifies a mutable bitmap for the canvas to draw into.
*
* @see #setDensity(int)
* @see #getDensity()
*/
@@ -181,17 +192,19 @@ public class Canvas {
throw new RuntimeException("Can't set a bitmap device on a GL canvas");
}
int pointer = 0;
if (bitmap != null) {
if (bitmap == null) {
safeCanvasSwap(initRaster(0));
mDensity = Bitmap.DENSITY_NONE;
} else {
if (!bitmap.isMutable()) {
throw new IllegalStateException();
}
throwIfRecycled(bitmap);
safeCanvasSwap(initRaster(bitmap.ni()));
mDensity = bitmap.mDensity;
pointer = bitmap.ni();
}
native_setBitmap(mNativeCanvas, pointer);
mBitmap = bitmap;
}
@@ -706,7 +719,7 @@ public class Canvas {
* does not intersect with the canvas' clip
*/
public boolean quickReject(RectF rect, EdgeType type) {
return native_quickReject(mNativeCanvas, rect, type.nativeInt);
return native_quickReject(mNativeCanvas, rect);
}
/**
@@ -726,7 +739,7 @@ public class Canvas {
* does not intersect with the canvas' clip
*/
public boolean quickReject(Path path, EdgeType type) {
return native_quickReject(mNativeCanvas, path.ni(), type.nativeInt);
return native_quickReject(mNativeCanvas, path.ni());
}
/**
@@ -749,9 +762,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,
type.nativeInt);
public boolean quickReject(float left, float top, float right, float bottom,
EdgeType type) {
return native_quickReject(mNativeCanvas, left, top, right, bottom);
}
/**
@@ -1625,7 +1638,6 @@ 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,
@@ -1656,15 +1668,12 @@ 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,
int native_edgeType);
RectF rect);
private static native boolean native_quickReject(int nativeCanvas,
int path,
int native_edgeType);
int path);
private static native boolean native_quickReject(int nativeCanvas,
float left, float top,
float right, float bottom,
int native_edgeType);
float right, float bottom);
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,

View File

@@ -375,9 +375,9 @@ public class Path {
*/
public enum Direction {
/** clockwise */
CW (0), // must match enum in SkPath.h
CW (1), // must match enum in SkPath.h
/** counter-clockwise */
CCW (1); // must match enum in SkPath.h
CCW (2); // must match enum in SkPath.h
Direction(int ni) {
nativeInt = ni;

View File

@@ -225,16 +225,4 @@ 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);
}

View File

@@ -42,6 +42,7 @@ 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

View File

@@ -18,7 +18,8 @@
#define ANDROID_HWUI_DISPLAY_LIST_RENDERER_H
#include <SkChunkAlloc.h>
#include <SkFlattenable.h>
#include <SkReader32.h>
#include <SkWriter32.h>
#include <SkMatrix.h>
#include <SkCamera.h>
#include <SkPaint.h>

View File

@@ -16,6 +16,7 @@
#define LOG_TAG "OpenGLRenderer"
#include <SkGlyph.h>
#include <SkUtils.h>
#include <cutils/properties.h>

View File

@@ -23,6 +23,7 @@
#include <ui/Region.h>
#include <SkPaint.h>
#include <SkXfermode.h>
#include "Rect.h"

View File

@@ -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::kMultiply_Mode, GL_ZERO, GL_SRC_COLOR },
{ SkXfermode::kModulate_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::kMultiply_Mode, GL_DST_COLOR, GL_ZERO },
{ SkXfermode::kModulate_Mode, GL_DST_COLOR, GL_ZERO },
{ SkXfermode::kScreen_Mode, GL_ONE_MINUS_DST_COLOR, GL_ONE }
};

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <SkGlyph.h>
#include <utils/Log.h>
#include "Debug.h"

View File

@@ -20,6 +20,7 @@
#include <utils/JenkinsHash.h>
#include <SkGlyph.h>
#include <SkUtils.h>
#include "Debug.h"

View File

@@ -33,6 +33,7 @@ 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**);

View File

@@ -189,7 +189,7 @@
<string name="quick_settings_location_label" msgid="3292451598267467545">"الموقع المستخدم"</string>
<string name="quick_settings_media_device_label" msgid="1302906836372603762">"جهاز الوسائط"</string>
<string name="quick_settings_rssi_label" msgid="7725671335550695589">"RSSI"</string>
<string name="quick_settings_rssi_emergency_only" msgid="2713774041672886750">"مكالمات طوارئ فقط"</string>
<string name="quick_settings_rssi_emergency_only" msgid="2713774041672886750">"مكالمات الطوارئ فقط"</string>
<string name="quick_settings_settings_label" msgid="5326556592578065401">"الإعدادات"</string>
<string name="quick_settings_time_label" msgid="4635969182239736408">"الوقت"</string>
<string name="quick_settings_user_label" msgid="5238995632130897840">"أنا"</string>

View File

@@ -147,7 +147,7 @@
<string name="accessibility_ringer_silent" msgid="9061243307939135383">"Mode silenci."</string>
<string name="accessibility_recents_item_dismissed" msgid="6803574935084867070">"S\'ha omès <xliff:g id="APP">%s</xliff:g>."</string>
<string name="accessibility_notification_dismissed" msgid="854211387186306927">"Notificació omesa."</string>
<string name="accessibility_desc_notification_shade" msgid="4690274844447504208">"Àrea de notificacions"</string>
<string name="accessibility_desc_notification_shade" msgid="4690274844447504208">"Capa de notificació."</string>
<string name="accessibility_desc_quick_settings" msgid="6186378411582437046">"Configuració ràpida."</string>
<string name="accessibility_desc_recent_apps" msgid="9014032916410590027">"Aplicacions recents."</string>
<string name="accessibility_quick_settings_user" msgid="1104846699869476855">"Usuari <xliff:g id="USER">%s</xliff:g>."</string>

View File

@@ -133,7 +133,7 @@
<string name="accessibility_data_connection_wifi" msgid="2324496756590645221">"Wi-Fi"</string>
<string name="accessibility_no_sim" msgid="8274017118472455155">"No hay tarjeta SIM."</string>
<string name="accessibility_bluetooth_tether" msgid="4102784498140271969">"Conexión mediante Bluetooth"</string>
<string name="accessibility_airplane_mode" msgid="834748999790763092">"Modo avión"</string>
<string name="accessibility_airplane_mode" msgid="834748999790763092">"Modo de avión"</string>
<!-- String.format failed for translation -->
<!-- no translation found for accessibility_battery_level (7451474187113371965) -->
<skip />
@@ -154,7 +154,7 @@
<string name="accessibility_quick_settings_wifi" msgid="6099781031669728709">"<xliff:g id="SIGNAL">%1$s</xliff:g>. <xliff:g id="NETWORK">%2$s</xliff:g>"</string>
<string name="accessibility_quick_settings_mobile" msgid="4876806564086241341">"Móvil <xliff:g id="SIGNAL">%1$s</xliff:g>. <xliff:g id="TYPE">%2$s</xliff:g>. <xliff:g id="NETWORK">%3$s</xliff:g>."</string>
<string name="accessibility_quick_settings_battery" msgid="1480931583381408972">"Batería <xliff:g id="STATE">%s</xliff:g>"</string>
<string name="accessibility_quick_settings_airplane" msgid="4196876722090224753">"Modo avión <xliff:g id="STATE">%s</xliff:g>"</string>
<string name="accessibility_quick_settings_airplane" msgid="4196876722090224753">"Modo de avión <xliff:g id="STATE">%s</xliff:g>"</string>
<string name="accessibility_quick_settings_bluetooth" msgid="5749054971341882340">"Bluetooth <xliff:g id="STATE">%s</xliff:g>"</string>
<string name="accessibility_quick_settings_alarm" msgid="3959908972897295660">"Alarma: <xliff:g id="TIME">%s</xliff:g>"</string>
<string name="data_usage_disabled_dialog_3g_title" msgid="5257833881698644687">"Datos de 2G-3G inhabilitados"</string>

View File

@@ -157,14 +157,14 @@
<string name="accessibility_quick_settings_alarm" msgid="3959908972897295660">"Alarm ustawiony na <xliff:g id="TIME">%s</xliff:g>."</string>
<string name="data_usage_disabled_dialog_3g_title" msgid="5257833881698644687">"Wyłączono transmisję danych 2G/3G"</string>
<string name="data_usage_disabled_dialog_4g_title" msgid="4789143363492682629">"Wyłączono transmisję danych 4G"</string>
<string name="data_usage_disabled_dialog_mobile_title" msgid="1046047248844821202">"Transmisja danych została wyłączona"</string>
<string name="data_usage_disabled_dialog_mobile_title" msgid="1046047248844821202">"Wyłączono komórkową transmisję danych"</string>
<string name="data_usage_disabled_dialog_title" msgid="2086815304858964954">"Wyłączono transmisję danych"</string>
<string name="data_usage_disabled_dialog" msgid="3853117269051806280">"Ustawiony limit transmisji danych został osiągnięty."\n\n"Jeśli ponownie włączysz przesyłanie danych, operator może naliczyć dodatkowe opłaty."</string>
<string name="data_usage_disabled_dialog" msgid="3853117269051806280">"Osiągnięto określony limit wykorzystania transmisji danych."\n\n"Jeśli ponownie włączysz przesyłanie danych, operator może naliczyć opłaty."</string>
<string name="data_usage_disabled_dialog_enable" msgid="7729772039208664606">"Włącz transmisję danych"</string>
<string name="status_bar_settings_signal_meter_disconnected" msgid="1940231521274147771">"Brak internetu"</string>
<string name="status_bar_settings_signal_meter_wifi_nossid" msgid="6557486452774597820">"Wi-Fi: połączono"</string>
<string name="gps_notification_searching_text" msgid="8574247005642736060">"Wyszukiwanie sygnału GPS"</string>
<string name="gps_notification_found_text" msgid="4619274244146446464">"Lokalizacja z GPSa"</string>
<string name="gps_notification_found_text" msgid="4619274244146446464">"Lokalizacja ustawiona według GPS"</string>
<string name="accessibility_clear_all" msgid="5235938559247164925">"Usuń wszystkie powiadomienia."</string>
<string name="status_bar_notification_inspect_item_title" msgid="1163547729015390250">"O aplikacji"</string>
<string name="close_universe" msgid="3736513750241754348">"Zamknij"</string>

View File

@@ -77,7 +77,7 @@
<string name="use_ptp_button_title" msgid="7517127540301625751">"Установить как камеру (PTP)"</string>
<string name="installer_cd_button_title" msgid="2312667578562201583">"Установить приложение"</string>
<string name="accessibility_back" msgid="567011538994429120">"Назад"</string>
<string name="accessibility_home" msgid="8217216074895377641">"Домой"</string>
<string name="accessibility_home" msgid="8217216074895377641">"Главная страница"</string>
<string name="accessibility_menu" msgid="316839303324695949">"Меню"</string>
<string name="accessibility_recent" msgid="8571350598987952883">"Недавние приложения"</string>
<string name="accessibility_ime_switch_button" msgid="5032926134740456424">"Кнопка переключения способа ввода."</string>
@@ -118,8 +118,8 @@
<string name="accessibility_two_bars" msgid="6437363648385206679">"два деления"</string>
<string name="accessibility_three_bars" msgid="2648241415119396648">"три деления"</string>
<string name="accessibility_signal_full" msgid="9122922886519676839">"надежный сигнал"</string>
<string name="accessibility_desc_on" msgid="2385254693624345265">"Вкл."</string>
<string name="accessibility_desc_off" msgid="6475508157786853157">"Выкл."</string>
<string name="accessibility_desc_on" msgid="2385254693624345265">"ВКЛ"</string>
<string name="accessibility_desc_off" msgid="6475508157786853157">"ВЫКЛ"</string>
<string name="accessibility_desc_connected" msgid="8366256693719499665">"Подключено"</string>
<string name="accessibility_data_connection_gprs" msgid="1606477224486747751">"GPRS"</string>
<string name="accessibility_data_connection_1x" msgid="994133468120244018">"1 X"</string>

View File

@@ -197,8 +197,8 @@
<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 ä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_wifi_display_label" msgid="6893592964463624333">"Wi-Fi visas"</string>
<string name="quick_settings_wifi_display_no_connection_label" msgid="2355298740765736918">"Trådlös visning"</string>
<string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Ljusstyrka"</string>
<string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"AUTO"</string>
<string name="status_bar_help_title" msgid="1199237744086469217">"Meddelanden visas här"</string>

View File

@@ -35,10 +35,10 @@
<string name="status_bar_ongoing_events_title" msgid="1682504513316879202">"Поточні"</string>
<string name="status_bar_latest_events_title" msgid="6594767438577593172">"Сповіщення"</string>
<string name="battery_low_title" msgid="2783104807551211639">"Підключіть зарядний пристрій"</string>
<string name="battery_low_subtitle" msgid="1752040062087829196">"Акумулятор розряджається."</string>
<string name="battery_low_subtitle" msgid="1752040062087829196">"Батарея виснажується."</string>
<string name="battery_low_percent_format" msgid="1077244949318261761">"Залишилося <xliff:g id="NUMBER">%d%%</xliff:g>"</string>
<string name="invalid_charger" msgid="4549105996740522523">"Заряджання USB не підтримується."\n"Використовуйте лише наданий у комплекті зарядний пристрій."</string>
<string name="battery_low_why" msgid="7279169609518386372">"Використання акумулятора"</string>
<string name="battery_low_why" msgid="7279169609518386372">"Викор. батареї"</string>
<string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Налаштування"</string>
<string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
<string name="status_bar_settings_airplane" msgid="4879879698500955300">"Режим польоту"</string>
@@ -85,11 +85,11 @@
<string name="accessibility_compatibility_zoom_example" msgid="4220687294564945780">"Збільшення екрана."</string>
<string name="accessibility_bluetooth_connected" msgid="2707027633242983370">"Bluetooth під’єднано."</string>
<string name="accessibility_bluetooth_disconnected" msgid="7416648669976870175">"Bluetooth від’єднано."</string>
<string name="accessibility_no_battery" msgid="358343022352820946">"Акумулятор розряджений."</string>
<string name="accessibility_battery_one_bar" msgid="7774887721891057523">"Заряд акумулятора: одна смужка."</string>
<string name="accessibility_battery_two_bars" msgid="8500650438735009973">"Заряд акумулятора: дві смужки."</string>
<string name="accessibility_battery_three_bars" msgid="2302983330865040446">"Заряд акумулятора: три смужки."</string>
<string name="accessibility_battery_full" msgid="8909122401720158582">"Акумулятор заряджений."</string>
<string name="accessibility_no_battery" msgid="358343022352820946">"Немає заряду батареї."</string>
<string name="accessibility_battery_one_bar" msgid="7774887721891057523">"Одна смужка заряду батареї."</string>
<string name="accessibility_battery_two_bars" msgid="8500650438735009973">"Дві смужки заряду батареї."</string>
<string name="accessibility_battery_three_bars" msgid="2302983330865040446">"Три смужки заряду батареї."</string>
<string name="accessibility_battery_full" msgid="8909122401720158582">"Повний заряд батареї"</string>
<string name="accessibility_no_phone" msgid="4894708937052611281">"Немає сигналу телефону."</string>
<string name="accessibility_phone_one_bar" msgid="687699278132664115">"Одна смужка сигналу телефону."</string>
<string name="accessibility_phone_two_bars" msgid="8384905382804815201">"Дві смужки сигналу телефону."</string>
@@ -134,7 +134,7 @@
<string name="accessibility_no_sim" msgid="8274017118472455155">"Немає SIM-карти."</string>
<string name="accessibility_bluetooth_tether" msgid="4102784498140271969">"Прив’язка Bluetooth."</string>
<string name="accessibility_airplane_mode" msgid="834748999790763092">"Режим польоту."</string>
<string name="accessibility_battery_level" msgid="7451474187113371965">"Заряд акумулятора: <xliff:g id="NUMBER">%d</xliff:g>."</string>
<string name="accessibility_battery_level" msgid="7451474187113371965">"Відсотків батареї: <xliff:g id="NUMBER">%d</xliff:g>."</string>
<string name="accessibility_settings_button" msgid="799583911231893380">"Налаштування системи."</string>
<string name="accessibility_notifications_button" msgid="4498000369779421892">"Сповіщення."</string>
<string name="accessibility_remove_notification" msgid="3603099514902182350">"Очистити сповіщення."</string>

View File

@@ -208,8 +208,7 @@ void SpriteController::doUpdateSprites() {
surfaceInfo.w, surfaceInfo.h, bpr);
surfaceBitmap.setPixels(surfaceInfo.bits);
SkCanvas surfaceCanvas;
surfaceCanvas.setBitmapDevice(surfaceBitmap);
SkCanvas surfaceCanvas(surfaceBitmap);
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);

View File

@@ -188,11 +188,6 @@ 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) {